Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Sonarr/commit/317586c1023fbbf75840cbca29960ec4f0d2e376
You should set ROOT_URL correctly, otherwise the web may not work correctly.
3 changed files with
27 additions and
3 deletions
@ -6,6 +6,8 @@ using NzbDrone.Api.REST;
using NzbDrone.Core.Indexers ;
using Omu.ValueInjecter ;
using FluentValidation ;
using NzbDrone.Api.Extensions ;
using NzbDrone.Api.Mapping ;
namespace NzbDrone.Api.Indexers
{
@ -17,6 +19,7 @@ namespace NzbDrone.Api.Indexers
{
_indexerService = indexerService ;
GetResourceAll = GetAll ;
GetResourceById = GetIndexer ;
CreateResource = CreateIndexer ;
UpdateResource = UpdateIndexer ;
DeleteResource = DeleteIndexer ;
@ -28,6 +31,11 @@ namespace NzbDrone.Api.Indexers
PostValidator . RuleFor ( c = > c . Fields ) . NotEmpty ( ) ;
}
private IndexerResource GetIndexer ( int id )
{
return _indexerService . Get ( id ) . InjectTo < IndexerResource > ( ) ;
}
private List < IndexerResource > GetAll ( )
{
var indexers = _indexerService . All ( ) ;
@ -18,11 +18,17 @@ namespace NzbDrone.Api.Notifications
_notificationService = notificationService ;
GetResourceAll = GetAll ;
GetResourceById = GetNotification ;
CreateResource = Create ;
UpdateResource = Update ;
DeleteResource = DeleteNotification ;
}
private NotificationResource GetNotification ( int id )
{
return _notificationService . Get ( id ) . InjectTo < NotificationResource > ( ) ;
}
private List < NotificationResource > GetAll ( )
{
var notifications = _notificationService . All ( ) ;
@ -44,13 +50,13 @@ namespace NzbDrone.Api.Notifications
private int Create ( NotificationResource notificationResource )
{
var notification = Get Notification( notificationResource ) ;
var notification = ConvertTo Notification( notificationResource ) ;
return _notificationService . Create ( notification ) . Id ;
}
private void Update ( NotificationResource notificationResource )
{
var notification = Get Notification( notificationResource ) ;
var notification = ConvertTo Notification( notificationResource ) ;
notification . Id = notificationResource . Id ;
_notificationService . Update ( notification ) ;
}
@ -60,7 +66,7 @@ namespace NzbDrone.Api.Notifications
_notificationService . Delete ( id ) ;
}
private Notification Get Notification( NotificationResource notificationResource )
private Notification ConvertTo Notification( NotificationResource notificationResource )
{
var notification = _notificationService . Schema ( )
. SingleOrDefault ( i = >
@ -137,6 +137,7 @@ namespace NzbDrone.Api.REST
private get { return _createResource ; }
set
{
EnsureGetByIdRoute ( ) ;
_createResource = value ;
Post [ ROOT_ROUTE ] = options = >
{
@ -147,6 +148,15 @@ namespace NzbDrone.Api.REST
}
}
private void EnsureGetByIdRoute ( )
{
if ( GetResourceById = = null )
{
throw new InvalidOperationException (
"GetResourceById route must be defined before defining Create/Update routes." ) ;
}
}
protected Action < TResource > UpdateResource
{
private get { return _updateResource ; }