mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 23:42:36 -07:00
Fixed #1189
This commit is contained in:
parent
4df12281c5
commit
9a1b0c49ec
4 changed files with 45 additions and 22 deletions
|
@ -35,6 +35,10 @@ namespace Ombi.Helpers
|
||||||
{
|
{
|
||||||
public static string CalcuateMd5Hash(string input)
|
public static string CalcuateMd5Hash(string input)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(input))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
using (var md5 = MD5.Create())
|
using (var md5 = MD5.Create())
|
||||||
{
|
{
|
||||||
var inputBytes = Encoding.UTF8.GetBytes(input);
|
var inputBytes = Encoding.UTF8.GetBytes(input);
|
||||||
|
|
|
@ -128,6 +128,13 @@ namespace Ombi.UI.Modules
|
||||||
{
|
{
|
||||||
var user = UserHelper.GetUser(Username);
|
var user = UserHelper.GetUser(Username);
|
||||||
var hashed = StringHasher.CalcuateMd5Hash(user.EmailAddress);
|
var hashed = StringHasher.CalcuateMd5Hash(user.EmailAddress);
|
||||||
|
if (string.IsNullOrEmpty(hashed))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = false
|
||||||
|
});
|
||||||
|
}
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel
|
Response.AsJson(new JsonResponseModel
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ using Nancy;
|
||||||
using Nancy.Responses.Negotiation;
|
using Nancy.Responses.Negotiation;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Ombi.Api.Interfaces;
|
using Ombi.Api.Interfaces;
|
||||||
|
using Ombi.Api.Models.Sonarr;
|
||||||
using Ombi.Core;
|
using Ombi.Core;
|
||||||
using Ombi.Core.Models;
|
using Ombi.Core.Models;
|
||||||
using Ombi.Core.SettingModels;
|
using Ombi.Core.SettingModels;
|
||||||
|
@ -104,7 +105,8 @@ namespace Ombi.UI.Modules
|
||||||
|
|
||||||
Post["/changeavailability", true] = async (x, ct) => await ChangeRequestAvailability((int)Request.Form.Id, (bool)Request.Form.Available);
|
Post["/changeavailability", true] = async (x, ct) => await ChangeRequestAvailability((int)Request.Form.Id, (bool)Request.Form.Available);
|
||||||
|
|
||||||
Post["/changeRootFolder", true] = async (x, ct) => await ChangeRootFolder((int) Request.Form.requestId, (int) Request.Form.rootFolderId);
|
Post["/changeRootFoldertv", true] = async (x, ct) => await ChangeRootFolder(RequestType.TvShow, (int)Request.Form.requestId, (int)Request.Form.rootFolderId);
|
||||||
|
Post["/changeRootFoldermovie", true] = async (x, ct) => await ChangeRootFolder(RequestType.Movie, (int)Request.Form.requestId, (int)Request.Form.rootFolderId);
|
||||||
|
|
||||||
Get["/UpdateFilters", true] = async (x, ct) => await GetFilterAndSortSettings();
|
Get["/UpdateFilters", true] = async (x, ct) => await GetFilterAndSortSettings();
|
||||||
}
|
}
|
||||||
|
@ -555,11 +557,21 @@ namespace Ombi.UI.Modules
|
||||||
return Response.AsJson(vm);
|
return Response.AsJson(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Response> ChangeRootFolder(int id, int rootFolderId)
|
private async Task<Response> ChangeRootFolder(RequestType type, int id, int rootFolderId)
|
||||||
|
{
|
||||||
|
var rootFolders = new List<SonarrRootFolder>();
|
||||||
|
if (type == RequestType.TvShow)
|
||||||
{
|
{
|
||||||
// Get all root folders
|
// Get all root folders
|
||||||
var settings = await SonarrSettings.GetSettingsAsync();
|
var settings = await SonarrSettings.GetSettingsAsync();
|
||||||
var rootFolders = SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
rootFolders = SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var settings = await Radarr.GetSettingsAsync();
|
||||||
|
rootFolders = RadarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||||
|
}
|
||||||
|
|
||||||
// Get Request
|
// Get Request
|
||||||
var allRequests = await Service.GetAllAsync();
|
var allRequests = await Service.GetAllAsync();
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<form method="POST" action="@formAction/requests/changeRootFolder" id="changeFolder{{requestId}}">
|
<form method="POST" action="@formAction/requests/changeRootFolder{{#if_eq type "tv"}}tv{{else}}movie{{/if_eq}}" id="changeFolder{{requestId}}">
|
||||||
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
|
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
|
||||||
{{#if_eq hasRootFolders true}}
|
{{#if_eq hasRootFolders true}}
|
||||||
<div class="btn-group btn-split">
|
<div class="btn-group btn-split">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue