Skip to content

Commit

Permalink
Merge branch 'dev' (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Oct 22, 2018
2 parents 2ee751a + 26869a9 commit fe2231b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
4 changes: 4 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ trap {
if (-not (Test-Path "$PSScriptRoot/build")) {
New-Item -Path "$PSScriptRoot/build" -ItemType "directory"
}

# Enable TLS 1.2 since GitHub requires it.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

wget -UseBasicParsing -Uri "https://raw.githubusercontent.com/NuGet/ServerCommon/$BuildBranch/build/init.ps1" -OutFile "$PSScriptRoot/build/init.ps1"
. "$PSScriptRoot/build/init.ps1" -BuildBranch "$BuildBranch"

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Server.Core/NuGet.Server.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
<copyright>$copyright$</copyright>
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Data.Services" targetFramework="net46" />
</frameworkAssemblies>
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Server.V2/NuGet.Server.V2.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
<copyright>$copyright$</copyright>
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Data.Services" targetFramework="net46" />
</frameworkAssemblies>
Expand Down
7 changes: 7 additions & 0 deletions src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ public static HttpConfiguration UseNuGetV2WebApiFeed(this HttpConfiguration conf
constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Delete) }
);

config.Routes.MapHttpRoute(
name: "apiv2package_upload",
routeTemplate: "api/v2/package",
defaults: new { controller = oDatacontrollerName, action = "UploadPackage" },
constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Put) }
);

config.Routes.MapODataServiceRoute(routeName, routeUrlRoot, oDataModel, new CountODataPathHandler(), conventions);
return config;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NuGet.Server/Controllers/PackagesODataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected PackagesODataController(IServiceResolver serviceResolver)
// Exposed through ordinary Web API route. Bypasses OData pipeline.
public async Task<HttpResponseMessage> ClearCache(CancellationToken token)
{
if (RequestContext.IsLocal)
if (RequestContext.IsLocal || ServiceResolver.Current.Resolve<ISettingsProvider>().GetBoolSetting("allowRemoteCacheManagement", false))
{
await _serverRepository.ClearCacheAsync(token);
return CreateStringResponse(HttpStatusCode.OK, "Server cache has been cleared.");
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Server/Core/DefaultServiceResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public object Resolve(Type type)
return _packageAuthenticationService;
}

if (type == typeof(ISettingsProvider))
{
return _settingsProvider;
}

return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/NuGet.Server/Default.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<% } %>
</fieldset>

<% if (Request.IsLocal) { %>
<% if (Request.IsLocal || ServiceResolver.Current.Resolve<NuGet.Server.Core.Infrastructure.ISettingsProvider>().GetBoolSetting("allowRemoteCacheManagement", false)) { %>
<fieldset style="width:800px">
<legend><strong>Adding packages</strong></legend>

Expand Down
11 changes: 1 addition & 10 deletions src/NuGet.Server/NuGet.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>1425</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:40221/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
<SaveServerSettingsInUserFile>True</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Server/NuGet.Server.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
<copyright>© .NET Foundation. All rights reserved.</copyright>
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.ServiceModel" targetFramework="net46" />
<frameworkAssembly assemblyName="System.ServiceModel.Web" targetFramework="net46" />
Expand Down
4 changes: 3 additions & 1 deletion src/NuGet.Server/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
on a fixed 1-hour interval.
-->
<add key="enableFileSystemMonitoring" value="true" />
<!--Set allowRemoteCacheManagement to true to enable the "clear cache" and other cache operations initiated via requests originating from remote hosts.-->
<add key="allowRemoteCacheManagement" value="false" />
</appSettings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
Expand Down Expand Up @@ -137,4 +139,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

0 comments on commit fe2231b

Please sign in to comment.