New: Many UI Updates and Performance Tweaks

This commit is contained in:
Qstick
2019-04-12 23:25:58 -04:00
parent b24a40797f
commit 6275737ced
389 changed files with 7961 additions and 5635 deletions
@@ -1,9 +1,8 @@
using System;
using System;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Extensions;
using Nancy.ModelBinding;
using NzbDrone.Common.EnsureThat;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration;
@@ -24,11 +23,6 @@ namespace Radarr.Http.Authentication
private Response Login(LoginResource resource)
{
Ensure.That(resource.Username, () => resource.Username).IsNotNullOrWhiteSpace();
// TODO: A null or empty password should not be allowed, uncomment in v3
//Ensure.That(resource.Password, () => resource.Password).IsNotNullOrWhiteSpace();
var user = _userService.FindUser(resource.Username, resource.Password);
if (user == null)
+3 -3
View File
@@ -1,4 +1,4 @@
using System;
using System;
using Nancy;
using Nancy.Responses;
using Radarr.Http.ErrorManagement;
@@ -30,10 +30,10 @@ namespace Radarr.Http.Exceptions
if (content != null)
{
result = result + " :" + content;
result = $"{result}: {content}";
}
return result;
}
}
}
}
@@ -12,7 +12,7 @@ namespace Radarr.Http.Frontend.Mappers
{
private readonly IDiskProvider _diskProvider;
private readonly Func<ICacheBreakerProvider> _cacheBreakProviderFactory;
private static readonly Regex ReplaceRegex = new Regex(@"(?:(?<attribute>href|src)=\"")(?<path>.*?(?<extension>css|js|png|ico|ics|svg))(?:\"")(?:\s(?<nohash>data-no-hash))?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex ReplaceRegex = new Regex(@"(?:(?<attribute>href|src|json)=\"")(?<path>.*?(?<extension>css|js|png|ico|ics|svg))(?:\"")(?:\s(?<nohash>data-no-hash))?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private string _generatedContent;
+11 -2
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using FluentValidation;
using Nancy;
using Newtonsoft.Json;
using NzbDrone.Core.Datastore;
using Radarr.Http.Extensions;
@@ -194,8 +195,16 @@ namespace Radarr.Http.REST
protected TResource ReadResourceFromRequest(bool skipValidate = false)
{
//TODO: handle when request is null
var resource = Request.Body.FromJson<TResource>();
TResource resource;
try
{
resource = Request.Body.FromJson<TResource>();
}
catch (JsonReaderException e)
{
throw new BadRequestException($"Invalid request body. {e.Message}");
}
if (resource == null)
{