Skip to content

Commit fe2231b

Browse files
committed
Merge branch 'dev' (#64)
2 parents 2ee751a + 26869a9 commit fe2231b

10 files changed

Lines changed: 25 additions & 13 deletions

File tree

build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ trap {
2424
if (-not (Test-Path "$PSScriptRoot/build")) {
2525
New-Item -Path "$PSScriptRoot/build" -ItemType "directory"
2626
}
27+
28+
# Enable TLS 1.2 since GitHub requires it.
29+
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
30+
2731
wget -UseBasicParsing -Uri "https://raw.githubusercontent.com/NuGet/ServerCommon/$BuildBranch/build/init.ps1" -OutFile "$PSScriptRoot/build/init.ps1"
2832
. "$PSScriptRoot/build/init.ps1" -BuildBranch "$BuildBranch"
2933

src/NuGet.Server.Core/NuGet.Server.Core.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
1010
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
1111
<copyright>$copyright$</copyright>
12+
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
1213
<frameworkAssemblies>
1314
<frameworkAssembly assemblyName="System.Data.Services" targetFramework="net46" />
1415
</frameworkAssemblies>

src/NuGet.Server.V2/NuGet.Server.V2.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
1010
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
1111
<copyright>$copyright$</copyright>
12+
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
1213
<frameworkAssemblies>
1314
<frameworkAssembly assemblyName="System.Data.Services" targetFramework="net46" />
1415
</frameworkAssemblies>

src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ public static HttpConfiguration UseNuGetV2WebApiFeed(this HttpConfiguration conf
5353
constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Delete) }
5454
);
5555

56+
config.Routes.MapHttpRoute(
57+
name: "apiv2package_upload",
58+
routeTemplate: "api/v2/package",
59+
defaults: new { controller = oDatacontrollerName, action = "UploadPackage" },
60+
constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Put) }
61+
);
62+
5663
config.Routes.MapODataServiceRoute(routeName, routeUrlRoot, oDataModel, new CountODataPathHandler(), conventions);
5764
return config;
5865
}

src/NuGet.Server/Controllers/PackagesODataController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected PackagesODataController(IServiceResolver serviceResolver)
2929
// Exposed through ordinary Web API route. Bypasses OData pipeline.
3030
public async Task<HttpResponseMessage> ClearCache(CancellationToken token)
3131
{
32-
if (RequestContext.IsLocal)
32+
if (RequestContext.IsLocal || ServiceResolver.Current.Resolve<ISettingsProvider>().GetBoolSetting("allowRemoteCacheManagement", false))
3333
{
3434
await _serverRepository.ClearCacheAsync(token);
3535
return CreateStringResponse(HttpStatusCode.OK, "Server cache has been cleared.");

src/NuGet.Server/Core/DefaultServiceResolver.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public object Resolve(Type type)
5353
return _packageAuthenticationService;
5454
}
5555

56+
if (type == typeof(ISettingsProvider))
57+
{
58+
return _settingsProvider;
59+
}
60+
5661
return null;
5762
}
5863

src/NuGet.Server/Default.aspx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<% } %>
3535
</fieldset>
3636

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

src/NuGet.Server/NuGet.Server.csproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,7 @@
174174
<VisualStudio>
175175
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
176176
<WebProjectProperties>
177-
<UseIIS>True</UseIIS>
178-
<AutoAssignPort>True</AutoAssignPort>
179-
<DevelopmentServerPort>1425</DevelopmentServerPort>
180-
<DevelopmentServerVPath>/</DevelopmentServerVPath>
181-
<IISUrl>http://localhost:40221/</IISUrl>
182-
<NTLMAuthentication>False</NTLMAuthentication>
183-
<UseCustomServer>False</UseCustomServer>
184-
<CustomServerUrl>
185-
</CustomServerUrl>
186-
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
177+
<SaveServerSettingsInUserFile>True</SaveServerSettingsInUserFile>
187178
</WebProjectProperties>
188179
</FlavorProperties>
189180
</VisualStudio>

src/NuGet.Server/NuGet.Server.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Server/dev/LICENSE.txt</licenseUrl>
1010
<projectUrl>https://github.com/NuGet/NuGet.Server</projectUrl>
1111
<copyright>© .NET Foundation. All rights reserved.</copyright>
12+
<repository type="git" url="https://github.com/NuGet/NuGet.Server" />
1213
<frameworkAssemblies>
1314
<frameworkAssembly assemblyName="System.ServiceModel" targetFramework="net46" />
1415
<frameworkAssembly assemblyName="System.ServiceModel.Web" targetFramework="net46" />

src/NuGet.Server/Web.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
on a fixed 1-hour interval.
7070
-->
7171
<add key="enableFileSystemMonitoring" value="true" />
72+
<!--Set allowRemoteCacheManagement to true to enable the "clear cache" and other cache operations initiated via requests originating from remote hosts.-->
73+
<add key="allowRemoteCacheManagement" value="false" />
7274
</appSettings>
7375
<!--
7476
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
@@ -137,4 +139,4 @@
137139
</dependentAssembly>
138140
</assemblyBinding>
139141
</runtime>
140-
</configuration>
142+
</configuration>

0 commit comments

Comments
 (0)