Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Readarr/commit/6c414929c3700c5b059470434ac939a52513ac5d
You should set ROOT_URL correctly, otherwise the web may not work correctly.
4 changed files with
35 additions and
21 deletions
@ -3,26 +3,30 @@ using System.Collections.Generic;
using System.IO ;
using System.Linq ;
using System.Text ;
using NzbDrone.Common ;
namespace NzbDrone.Api.DiskSpace
{
public class DiskSpaceModule : NzbDroneRestModule < DiskSpaceResource >
{
public DiskSpaceModule ( ) : base ( "diskspace" )
private readonly IDiskProvider _diskProvider ;
public DiskSpaceModule ( IDiskProvider diskProvider ) : base ( "diskspace" )
{
_diskProvider = diskProvider ;
GetResourceAll = GetFreeSpace ;
}
public List < DiskSpaceResource > GetFreeSpace ( )
{
return ( DriveInfo . GetDrives ( )
. Where ( driveInfo = > driveInfo . DriveType = = DriveType . Fixed )
return ( _diskProvider . GetFixedDrives ( )
. Select (
driveInfo = >
x = >
new DiskSpaceResource ( )
{
DriveLetter = driveInfo. Name ,
FreeSpace = SizeSuffix( driveInfo . TotalFreeSpace ) ,
TotalSpace = SizeSuffix( driveInfo . TotalSize )
DriveLetter = x ,
FreeSpace = _diskProvider. GetAvailableSpace ( x ) . Value ,
TotalSpace = _diskProvider. GetTotalSize ( x ) . Value
} ) ) . ToList ( ) ;
}
@ -9,7 +9,7 @@ namespace NzbDrone.Api.DiskSpace
public class DiskSpaceResource : RestResource
{
public string DriveLetter { get ; set ; }
public string FreeSpace { get ; set ; }
public string TotalSpace { get ; set ; }
public Int64 FreeSpace { get ; set ; }
public Int64 TotalSpace { get ; set ; }
}
}
@ -42,6 +42,8 @@ namespace NzbDrone.Common
void SetFolderWriteTime ( string path , DateTime time ) ;
FileAttributes GetFileAttributes ( string path ) ;
void EmptyFolder ( string path ) ;
string [ ] GetFixedDrives ( ) ;
long? GetTotalSize ( string path ) ;
}
public class DiskProvider : IDiskProvider
@ -475,5 +477,15 @@ namespace NzbDrone.Common
DeleteFolder ( directory , true ) ;
}
}
public string [ ] GetFixedDrives ( )
{
return ( DriveInfo . GetDrives ( ) . Where ( x = > x . DriveType = = DriveType . Fixed ) . Select ( x = > x . Name ) ) . ToArray ( ) ;
}
public long? GetTotalSize ( string path )
{
return ( DriveInfo . GetDrives ( ) . Single ( x = > x . Name = = path ) ) . TotalSize ;
}
}
}
@ -4,8 +4,9 @@ define([
'marionette' ,
'backgrid' ,
'System/DiskSpace/DiskSpaceCollection' ,
'Shared/LoadingView'
] , function ( vent , Marionette , Backgrid , DiskSpaceCollection , LoadingView ) {
'Shared/LoadingView' ,
'Cells/FileSizeCell'
] , function ( vent , Marionette , Backgrid , DiskSpaceCollection , LoadingView , FileSizeCell ) {
return Marionette . Layout . extend ( {
template : 'System/DiskSpace/DiskSpaceTemplate' ,
@ -17,35 +18,32 @@ define([
{
name : 'driveLetter' ,
label : 'Drive' ,
cell : Backgrid . StringCell
cell : 'string'
} ,
{
name : 'freeSpace' ,
label : 'Free Space' ,
cell : Backgrid . StringCell
cell : FileSizeCell ,
sortable : true
} ,
{
name : 'totalSpace' ,
label : 'Total Space' ,
cell : Backgrid . StringCell
cell : FileSizeCell ,
sortable : true
}
] ,
initialize : function ( ) {
this . collection = new DiskSpaceCollection ( ) ;
this . collectionPromise = this . collection . fetch ( ) ;
vent . on ( vent . Events . CommandComplete , this . _commandComplete , this ) ;
this . listenTo ( this . collection , 'sync' , this . _showTable ) ;
} ,
onRender : function ( ) {
this . grid . show ( new LoadingView ( ) ) ;
} ,
onShow : function ( ) {
var self = this ;
this . collectionPromise . done ( function ( ) {
self . _showTable ( ) ;
} ) ;
this . collection . fetch ( ) ;
} ,
_showTable : function ( ) {
this . grid . show ( new Backgrid . Grid ( {