mirror of
https://github.com/Sonarr/Sonarr
synced 2025-02-25 15:33:11 +00:00
Redirect /api/missing to new endpoint
This commit is contained in:
parent
45f748cf03
commit
79767aa7bf
2 changed files with 35 additions and 0 deletions
|
@ -151,6 +151,7 @@
|
||||||
<Compile Include="Mapping\ResourceMappingException.cs" />
|
<Compile Include="Mapping\ResourceMappingException.cs" />
|
||||||
<Compile Include="Mapping\ValueInjectorExtensions.cs" />
|
<Compile Include="Mapping\ValueInjectorExtensions.cs" />
|
||||||
<Compile Include="Wanted\CutoffModule.cs" />
|
<Compile Include="Wanted\CutoffModule.cs" />
|
||||||
|
<Compile Include="Wanted\LegacyMissingModule.cs" />
|
||||||
<Compile Include="Wanted\MissingModule.cs" />
|
<Compile Include="Wanted\MissingModule.cs" />
|
||||||
<Compile Include="Config\NamingSampleResource.cs" />
|
<Compile Include="Config\NamingSampleResource.cs" />
|
||||||
<Compile Include="NzbDroneRestModuleWithSignalR.cs" />
|
<Compile Include="NzbDroneRestModuleWithSignalR.cs" />
|
||||||
|
|
34
src/NzbDrone.Api/Wanted/LegacyMissingModule.cs
Normal file
34
src/NzbDrone.Api/Wanted/LegacyMissingModule.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using Nancy;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api.Wanted
|
||||||
|
{
|
||||||
|
class LegacyMissingModule : NzbDroneApiModule
|
||||||
|
{
|
||||||
|
public LegacyMissingModule() : base("missing")
|
||||||
|
{
|
||||||
|
Get["/"] = x =>
|
||||||
|
{
|
||||||
|
string queryString = ConvertQueryParams(Request.Query);
|
||||||
|
var url = String.Format("/api/wanted/missing?{0}", queryString);
|
||||||
|
|
||||||
|
return Response.AsRedirect(url);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ConvertQueryParams(DynamicDictionary query)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var key in query)
|
||||||
|
{
|
||||||
|
var value = query[key];
|
||||||
|
|
||||||
|
sb.AppendFormat("&{0}={1}", key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString().Trim('&');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue