mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-11-01 20:43:36 +00:00
Add project files.
This commit is contained in:
14
Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor
Normal file
14
Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor
Normal file
@@ -0,0 +1,14 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6"></MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class AdvancedOptions : Options
|
||||
{
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Language</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="string" Label="User Interface Language" Value="@("en-US")">
|
||||
<MudSelectItem Value="@("en-US")">English</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Log File</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Log file" Value="FileLogEnabled" ValueChanged="FileLogEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="Save Path" Value="FileLogPath" ValueChanged="FileLogPathChanged" Disabled="@(!FileLogEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="3">
|
||||
<MudCheckBox T="bool" Label="Backup the log after" Value="FileLogBackupEnabled" ValueChanged="FileLogBackupEnabledChanged" Disabled="@(!FileLogEnabled)" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="9">
|
||||
<MudNumericField T="int" Label="KiB" Value="FileLogMaxSize" ValueChanged="FileLogMaxSizeChanged" Disabled="@(!FileLogEnabled)" ShrinkLabel Min="1" />
|
||||
</MudItem>
|
||||
<MudItem xs="3">
|
||||
<MudCheckBox T="bool" Label="Delete backups older than" Value="FileLogDeleteOld" ValueChanged="FileLogDeleteOldChanged" Disabled="@(!FileLogEnabled)" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="9">
|
||||
<MudGrid>
|
||||
<MudItem xs="9">
|
||||
<MudNumericField T="int" Value="FileLogAge" ValueChanged="FileLogAgeChanged" Disabled="@(!FileLogEnabled)" ShrinkLabel Min="1" />
|
||||
</MudItem>
|
||||
<MudItem xs="3">
|
||||
<MudSelect T="int" Value="FileLogAgeType" ValueChanged="FileLogAgeTypeChanged" Disabled="@(!FileLogEnabled)" ShrinkLabel>
|
||||
<MudSelectItem Value="0">days</MudSelectItem>
|
||||
<MudSelectItem Value="1">months</MudSelectItem>
|
||||
<MudSelectItem Value="2">years</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardContent>
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Log performance warnings" Value="PerformanceWarning" ValueChanged="PerformanceWarningChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
@@ -0,0 +1,99 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class BehaviourOptions : Options
|
||||
{
|
||||
protected bool FileLogEnabled { get; set; }
|
||||
|
||||
protected string? FileLogPath { get; set; }
|
||||
|
||||
protected bool FileLogBackupEnabled { get; set; }
|
||||
|
||||
protected int FileLogMaxSize { get; set; }
|
||||
|
||||
protected bool FileLogDeleteOld { get; set; }
|
||||
|
||||
protected int FileLogAge { get; set; }
|
||||
|
||||
protected int FileLogAgeType { get; set; }
|
||||
|
||||
protected bool PerformanceWarning { get; set; }
|
||||
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
if (Preferences is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
FileLogEnabled = Preferences.FileLogEnabled;
|
||||
FileLogPath = Preferences.FileLogPath;
|
||||
FileLogBackupEnabled = Preferences.FileLogBackupEnabled;
|
||||
FileLogMaxSize = Preferences.FileLogMaxSize;
|
||||
FileLogDeleteOld = Preferences.FileLogDeleteOld;
|
||||
FileLogAge = Preferences.FileLogAge;
|
||||
FileLogAgeType = Preferences.FileLogAgeType;
|
||||
PerformanceWarning = Preferences.PerformanceWarning;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async Task FileLogEnabledChanged(bool value)
|
||||
{
|
||||
FileLogEnabled = value;
|
||||
UpdatePreferences.FileLogEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task FileLogPathChanged(string value)
|
||||
{
|
||||
FileLogPath = value;
|
||||
UpdatePreferences.FileLogPath = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task FileLogBackupEnabledChanged(bool value)
|
||||
{
|
||||
FileLogBackupEnabled = value;
|
||||
UpdatePreferences.FileLogBackupEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task FileLogMaxSizeChanged(int value)
|
||||
{
|
||||
FileLogMaxSize = value;
|
||||
UpdatePreferences.FileLogMaxSize = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task FileLogDeleteOldChanged(bool value)
|
||||
{
|
||||
FileLogDeleteOld = value;
|
||||
UpdatePreferences.FileLogDeleteOld = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task FileLogAgeChanged(int value)
|
||||
{
|
||||
FileLogAge = value;
|
||||
UpdatePreferences.FileLogAge = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task FileLogAgeTypeChanged(int value)
|
||||
{
|
||||
FileLogAgeType = value;
|
||||
UpdatePreferences.FileLogAgeType = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task PerformanceWarningChanged(bool value)
|
||||
{
|
||||
PerformanceWarning = value;
|
||||
UpdatePreferences.PerformanceWarning = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6"></MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class BitTorrentOptions : Options
|
||||
{
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardContent>
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="int" Label="Peer connection protocol" Value="BittorrentProtocol" ValueChanged="BittorrentProtocolChanged">
|
||||
<MudSelectItem T="int" Value="0">TCP and μTP</MudSelectItem>
|
||||
<MudSelectItem T="int" Value="1">TCP</MudSelectItem>
|
||||
<MudSelectItem T="int" Value="2">μTP</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Listening Port</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="11">
|
||||
<MudNumericField T="int" Label="Port used for incoming connections" Value="ListenPort" ValueChanged="ListenPortChanged" Min="@MinPortValue" Max="@MaxPortValue" />
|
||||
</MudItem>
|
||||
<MudItem xs="1">
|
||||
<MudButton OnClick="GenerateRandomPort">Random</MudButton>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Use UPnp / NAT-PMP port forwarding from my router" Value="Upnp" ValueChanged="UpnpChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Connections Limits</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudCheckBox T="bool" Label="Global maximum number of connections" Value="MaxConnecEnabled" ValueChanged="MaxConnecEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudNumericField T="int" Label="Connections" Value="MaxConnec" ValueChanged="MaxConnecChanged" ShrinkLabel Min="1" Disabled="@(!MaxConnecEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudCheckBox T="bool" Label="Maximum number of connections per torrent" Value="MaxConnecPerTorrentEnabled" ValueChanged="MaxConnecPerTorrentEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudNumericField T="int" Label="Connections" Value="MaxConnecPerTorrent" ValueChanged="MaxConnecPerTorrentChanged" ShrinkLabel Min="1" Disabled="@(!MaxConnecPerTorrentEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudCheckBox T="bool" Label="Global maximum number of upload slots" Value="MaxUploadsEnabled" ValueChanged="MaxUploadsEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudNumericField T="int" Label="Slots" Value="MaxUploads" ValueChanged="MaxUploadsChanged" ShrinkLabel Min="1" Disabled="@(!MaxUploadsEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudCheckBox T="bool" Label="Maximum number of upload slots per torrent" Value="MaxUploadsPerTorrentEnabled" ValueChanged="MaxUploadsPerTorrentEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudNumericField T="int" Label="Slots" Value="MaxUploadsPerTorrent" ValueChanged="MaxUploadsPerTorrentChanged" ShrinkLabel Min="1" Disabled="@(!MaxUploadsPerTorrentEnabled)" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
@@ -0,0 +1,330 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class ConnectionOptions : Options
|
||||
{
|
||||
protected int BittorrentProtocol { get; private set; }
|
||||
protected int ListenPort { get; private set; }
|
||||
protected bool Upnp { get; private set; }
|
||||
protected bool MaxConnecEnabled { get; private set; }
|
||||
protected int MaxConnec { get; private set; }
|
||||
protected bool MaxConnecPerTorrentEnabled { get; private set; }
|
||||
protected int MaxConnecPerTorrent { get; private set; }
|
||||
protected bool MaxUploadsEnabled { get; private set; }
|
||||
protected int MaxUploads { get; private set; }
|
||||
protected bool MaxUploadsPerTorrentEnabled { get; private set; }
|
||||
protected int MaxUploadsPerTorrent { get; private set; }
|
||||
protected bool I2pEnabled { get; private set; }
|
||||
protected string? I2pAddress { get; private set; }
|
||||
protected int I2pPort { get; private set; }
|
||||
protected bool I2pMixedMode { get; private set; }
|
||||
protected string? ProxyType { get; private set; }
|
||||
protected string? ProxyIp { get; private set; }
|
||||
protected int ProxyPort { get; private set; }
|
||||
protected bool ProxyAuthEnabled { get; private set; }
|
||||
protected string? ProxyUsername { get; private set; }
|
||||
protected string? ProxyPassword { get; private set; }
|
||||
protected bool ProxyHostnameLookup { get; private set; }
|
||||
protected bool ProxyBittorrent { get; private set; }
|
||||
protected bool ProxyPeerConnections { get; private set; }
|
||||
protected bool ProxyRss { get; private set; }
|
||||
protected bool ProxyMisc { get; private set; }
|
||||
protected bool IpFilterEnabled { get; private set; }
|
||||
protected string? IpFilterPath { get; private set; }
|
||||
protected bool IpFilterTrackers { get; private set; }
|
||||
protected string? BannedIPs { get; private set; }
|
||||
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
if (Preferences is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BittorrentProtocol = Preferences.BittorrentProtocol;
|
||||
ListenPort = Preferences.ListenPort;
|
||||
Upnp = Preferences.Upnp;
|
||||
if (Preferences.MaxConnec > 0)
|
||||
{
|
||||
MaxConnecEnabled = true;
|
||||
MaxConnec = Preferences.MaxConnec;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxConnecEnabled = false;
|
||||
MaxConnec = 500;
|
||||
}
|
||||
|
||||
if (Preferences.MaxConnecPerTorrent > 0)
|
||||
{
|
||||
MaxConnecPerTorrentEnabled = true;
|
||||
MaxConnecPerTorrent = Preferences.MaxConnecPerTorrent;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxConnecPerTorrentEnabled = false;
|
||||
MaxConnecPerTorrent = 100;
|
||||
}
|
||||
|
||||
if (Preferences.MaxUploads > 0)
|
||||
{
|
||||
MaxUploadsEnabled = true;
|
||||
MaxUploads = Preferences.MaxUploads;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxUploadsEnabled = false;
|
||||
MaxUploads = 20;
|
||||
}
|
||||
|
||||
if (Preferences.MaxUploadsPerTorrent > 0)
|
||||
{
|
||||
MaxUploadsPerTorrentEnabled = true;
|
||||
MaxUploadsPerTorrent = Preferences.MaxUploadsPerTorrent;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxUploadsPerTorrentEnabled = false;
|
||||
MaxUploadsPerTorrent = 4;
|
||||
}
|
||||
|
||||
I2pEnabled = Preferences.I2pEnabled;
|
||||
I2pAddress = Preferences.I2pAddress;
|
||||
I2pPort = Preferences.I2pPort;
|
||||
I2pMixedMode = Preferences.I2pMixedMode;
|
||||
|
||||
ProxyType = Preferences.ProxyType;
|
||||
ProxyIp = Preferences.ProxyIp;
|
||||
ProxyPort = Preferences.ProxyPort;
|
||||
ProxyAuthEnabled = Preferences.ProxyAuthEnabled;
|
||||
ProxyUsername = Preferences.ProxyUsername;
|
||||
ProxyPassword = Preferences.ProxyPassword;
|
||||
ProxyHostnameLookup = Preferences.ProxyHostnameLookup;
|
||||
ProxyBittorrent = Preferences.ProxyBittorrent;
|
||||
ProxyPeerConnections = Preferences.ProxyPeerConnections;
|
||||
ProxyRss = Preferences.ProxyRss;
|
||||
ProxyMisc = Preferences.ProxyMisc;
|
||||
|
||||
IpFilterEnabled = Preferences.IpFilterEnabled;
|
||||
IpFilterPath = Preferences.IpFilterPath;
|
||||
IpFilterTrackers = Preferences.IpFilterTrackers;
|
||||
BannedIPs = Preferences.BannedIPs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async Task BittorrentProtocolChanged(int value)
|
||||
{
|
||||
BittorrentProtocol = value;
|
||||
UpdatePreferences.BittorrentProtocol = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ListenPortChanged(int value)
|
||||
{
|
||||
ListenPort = value;
|
||||
UpdatePreferences.ListenPort = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task UpnpChanged(bool value)
|
||||
{
|
||||
Upnp = value;
|
||||
UpdatePreferences.Upnp = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void MaxConnecEnabledChanged(bool value)
|
||||
{
|
||||
MaxConnecEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task MaxConnecChanged(int value)
|
||||
{
|
||||
MaxConnec = value;
|
||||
UpdatePreferences.MaxConnec = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void MaxConnecPerTorrentEnabledChanged(bool value)
|
||||
{
|
||||
MaxConnecPerTorrentEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task MaxConnecPerTorrentChanged(int value)
|
||||
{
|
||||
MaxConnecPerTorrent = value;
|
||||
UpdatePreferences.MaxConnecPerTorrent = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void MaxUploadsEnabledChanged(bool value)
|
||||
{
|
||||
MaxUploadsEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task MaxUploadsChanged(int value)
|
||||
{
|
||||
MaxUploads = value;
|
||||
UpdatePreferences.MaxUploads = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void MaxUploadsPerTorrentEnabledChanged(bool value)
|
||||
{
|
||||
MaxUploadsPerTorrentEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task MaxUploadsPerTorrentChanged(int value)
|
||||
{
|
||||
MaxUploadsPerTorrent = value;
|
||||
UpdatePreferences.MaxUploadsPerTorrent = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task I2pEnabledChanged(bool value)
|
||||
{
|
||||
I2pEnabled = value;
|
||||
UpdatePreferences.I2pEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task I2pAddressChanged(string value)
|
||||
{
|
||||
I2pAddress = value;
|
||||
UpdatePreferences.I2pAddress = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task I2pPortChanged(int value)
|
||||
{
|
||||
I2pPort = value;
|
||||
UpdatePreferences.I2pPort = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task I2pMixedModeChanged(bool value)
|
||||
{
|
||||
I2pMixedMode = value;
|
||||
UpdatePreferences.I2pMixedMode = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyTypeChanged(string value)
|
||||
{
|
||||
ProxyType = value;
|
||||
UpdatePreferences.ProxyType = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyIpChanged(string value)
|
||||
{
|
||||
ProxyIp = value;
|
||||
UpdatePreferences.ProxyIp = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyPortChanged(int value)
|
||||
{
|
||||
ProxyPort = value;
|
||||
UpdatePreferences.ProxyPort = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyAuthEnabledChanged(bool value)
|
||||
{
|
||||
ProxyAuthEnabled = value;
|
||||
UpdatePreferences.ProxyAuthEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyUsernameChanged(string value)
|
||||
{
|
||||
ProxyUsername = value;
|
||||
UpdatePreferences.ProxyUsername = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyPasswordChanged(string value)
|
||||
{
|
||||
ProxyPassword = value;
|
||||
UpdatePreferences.ProxyPassword = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyHostnameLookupChanged(bool value)
|
||||
{
|
||||
ProxyHostnameLookup = value;
|
||||
UpdatePreferences.ProxyHostnameLookup = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyBittorrentChanged(bool value)
|
||||
{
|
||||
ProxyBittorrent = value;
|
||||
UpdatePreferences.ProxyBittorrent = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyPeerConnectionsChanged(bool value)
|
||||
{
|
||||
ProxyPeerConnections = value;
|
||||
UpdatePreferences.ProxyPeerConnections = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyRssChanged(bool value)
|
||||
{
|
||||
ProxyRss = value;
|
||||
UpdatePreferences.ProxyRss = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ProxyMiscChanged(bool value)
|
||||
{
|
||||
ProxyMisc = value;
|
||||
UpdatePreferences.ProxyMisc = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task IpFilterEnabledChanged(bool value)
|
||||
{
|
||||
IpFilterEnabled = value;
|
||||
UpdatePreferences.IpFilterEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task IpFilterPathChanged(string value)
|
||||
{
|
||||
IpFilterPath = value;
|
||||
UpdatePreferences.IpFilterPath = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task IpFilterTrackersChanged(bool value)
|
||||
{
|
||||
IpFilterTrackers = value;
|
||||
UpdatePreferences.IpFilterTrackers = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task BannedIPsChanged(string value)
|
||||
{
|
||||
BannedIPs = value;
|
||||
UpdatePreferences.BannedIPs = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected const int MinPortValue = 1024;
|
||||
protected const int MaxPortValue = 65535;
|
||||
|
||||
protected async Task GenerateRandomPort()
|
||||
{
|
||||
var random = new Random();
|
||||
var port = random.Next(MinPortValue, MaxPortValue);
|
||||
|
||||
await ListenPortChanged(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
287
Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor
Normal file
287
Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor
Normal file
@@ -0,0 +1,287 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">When adding a torrent</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="string" Label="Torrent content layout" Value="TorrentContentLayout" ValueChanged="TorrentContentLayoutChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="@("Original")">Original</MudSelectItem>
|
||||
<MudSelectItem Value="@("Subfolder")">Create subfolder</MudSelectItem>
|
||||
<MudSelectItem Value="@("NoSubfolder")">Don't create subfolder</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Add to top of queue" Value="AddToTopOfQueue" ValueChanged="AddToTopOfQueueChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Do not start the download automatically" Value="StartPausedEnabled" ValueChanged="StartPausedEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="string" Label="Torrent stop condition" Value="TorrentStopCondition" ValueChanged="TorrentStopConditionChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="@("None")">None</MudSelectItem>
|
||||
<MudSelectItem Value="@("MetadataReceived")">Metadata received</MudSelectItem>
|
||||
<MudSelectItem Value="@("FilesChecked")">Files Checked</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Delete .torrent files afterwards" Value="AutoDeleteMode" ValueChanged="AutoDeleteModeChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardContent>
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Pre-allocate disk space for all files" Value="PreallocateAll" ValueChanged="PreallocateAllChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Append .!qB extension to incomplete files" Value="IncompleteFilesExt" ValueChanged="IncompleteFilesExtChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Saving Management</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="bool" Label="Default Torrent Management Mode" Value="AutoTmmEnabled" ValueChanged="AutoDeleteModeChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="false">Manual</MudSelectItem>
|
||||
<MudSelectItem Value="true">Automatic</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="bool" Label="When Torrent Category changed" Value="TorrentChangedTmmEnabled" ValueChanged="TorrentChangedTmmEnabledChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="true">Relocate torrent</MudSelectItem>
|
||||
<MudSelectItem Value="false">Switch torrent to Manual Mode</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="bool" Label="When Default Save Path changed" Value="SavePathChangedTmmEnabled" ValueChanged="SavePathChangedTmmEnabledChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="true">Relocate affected torrents</MudSelectItem>
|
||||
<MudSelectItem Value="false">Switch affected torrents to Manual Mode</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSelect T="bool" Label="When Category Save Path changed" Value="CategoryChangedTmmEnabled" ValueChanged="CategoryChangedTmmEnabledChanged" ShrinkLabel>
|
||||
<MudSelectItem Value="true">Relocate affected torrents</MudSelectItem>
|
||||
<MudSelectItem Value="false">Switch affected torrents to Manual Mode</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Use Subcategories" Value="UseSubcategories" ValueChanged="UseSubcategoriesChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="Default Save Path" Value="SavePath" ValueChanged="SavePathChanged" ShrinkLabel />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudCheckBox T="bool" Label="Keep incomplete torrents in" Value="TempPathEnabled" ValueChanged="TempPathEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" md="9">
|
||||
<MudTextField T="string" Label="Path" Value="TempPath" ValueChanged="TempPathChanged" ShrinkLabel Disabled="@(!TempPathEnabled)" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudCheckBox T="bool" Label="Copy .torrent files to" Value="ExportDirEnabled" ValueChanged="ExportDirEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" md="9">
|
||||
<MudTextField T="string" Label="Path" Value="ExportDir" ValueChanged="ExportDirChanged" ShrinkLabel Disabled="@(!TempPathEnabled)" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudCheckBox T="bool" Label="Copy .torrent files for finished downloads to" Value="ExportDirFinEnabled" ValueChanged="ExportDirFinEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" md="9">
|
||||
<MudTextField T="string" Label="Path" Value="ExportDirFin" ValueChanged="ExportDirFinChanged" ShrinkLabel Disabled="@(!TempPathEnabled)" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Automatically add torrents from</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudSimpleTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Monitored Folder</th>
|
||||
<th>Override Save Location</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ScanDirs)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<MudTextField T="string" Label="Path" Value="@item.Key" ValueChanged="@(v => ScanDirsKeyChanged(item.Key, v))" />
|
||||
</td>
|
||||
<td>
|
||||
<MudGrid>
|
||||
<MudItem xs="@(item.Value.SavePath is null ? 12 : 3)">
|
||||
<MudSelect T="string" Value="@item.Value.ToString()" ValueChanged="@(v => ScanDirsValueChanged(item.Key, v))">
|
||||
<MudSelectItem T="string" Value="@("0")">Monitored folder</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@("1")">Default save location</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@(item.Value.SavePath is not null ? item.Value.SavePath : "")">Other...</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
@if (item.Value.SavePath is not null)
|
||||
{
|
||||
<MudItem xs="9">
|
||||
<MudTextField T="string" Label="Path" Value="@item.Value.SavePath" ValueChanged="@(v => ScanDirsValueChanged(item.Key, v))" />
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@for (int i = 0; i < AddedScanDirs.Count; i++)
|
||||
{
|
||||
var item = AddedScanDirs[i];
|
||||
var index = i;
|
||||
var isLast = i == AddedScanDirs.Count - 1;
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<MudTextField T="string" Label="Path" Value="@item.Key" ValueChanged="@(v => AddedScanDirsKeyChanged(index, v))" VaMudListItemdation="IsVaMudListItemdNewKey" />
|
||||
</td>
|
||||
<td>
|
||||
<MudGrid>
|
||||
<MudItem xs="@(item.Value.SavePath is null ? (isLast ? 11 : 12) : 3)">
|
||||
<MudSelect T="string" Value="@item.Value.ToString()" ValueChanged="@(v => AddedScanDirsValueChanged(index, v))">
|
||||
<MudSelectItem T="string" Value="@("0")">Monitored folder</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@("1")">Default save location</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@(item.Value.SavePath is not null ? item.Value.SavePath : "")">Other...</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
@if (item.Value.SavePath is not null)
|
||||
{
|
||||
<MudItem xs="@(isLast ? 8 : 9)">
|
||||
<MudTextField T="string" Label="Path" Value="@item.Value.SavePath" ValueChanged="@(v => AddedScanDirsValueChanged(index, v))" />
|
||||
</MudItem>
|
||||
}
|
||||
@if (isLast)
|
||||
{
|
||||
<MudItem xs="1">
|
||||
<MudIconButton Icon="@Icons.Material.Outlined.Add" OnCMudListItemck="AddNewScanDir" />
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</MudSimpleTable>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardContent>
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Excluded file names" Value="ExcludedFileNamesEnabled" ValueChanged="ExcludedFileNamesEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="Excluded files names" Value="ExcludedFileNames" ValueChanged="ExcludedFileNamesChanged" MudListItemnes="5" ShrinkLabel Disabled="@(!ExcludedFileNamesEnabled)" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardContent>
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Email notification upon download completion" Value="MailNotificationEnabled" ValueChanged="MailNotificationEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="From" Value="MailNotificationSender" ValueChanged="MailNotificationSenderChanged" ShrinkLabel Disabled="@(!MailNotificationEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="To" Value="MailNotificationEmail" ValueChanged="MailNotificationEmailChanged" ShrinkLabel Disabled="@(!MailNotificationEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="SMTP server" Value="MailNotificationSmtp" ValueChanged="MailNotificationSmtpChanged" ShrinkLabel Disabled="@(!MailNotificationEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="This server requires a secure connection (SSL)" Value="MailNotificationSslEnabled" ValueChanged="MailNotificationSslEnabledChanged" LabelPosition="LabelPosition.End" Disabled="@(!MailNotificationEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Authentication" Value="MailNotificationAuthEnabled" ValueChanged="MailNotificationAuthEnabledChanged" LabelPosition="LabelPosition.End" Disabled="@(!MailNotificationEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="Username" Value="MailNotificationUsername" ValueChanged="MailNotificationUsernameChanged" ShrinkLabel Disabled="@(!(MailNotificationEnabled && MailNotificationAuthEnabled))" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="Password" Value="MailNotificationPassword" ValueChanged="MailNotificationPasswordChanged" ShrinkLabel Disabled="@(!(MailNotificationEnabled && MailNotificationAuthEnabled))" InputType="InputType.Password" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6">Run exernal program</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Run external program on torrent added" Value="AutorunOnTorrentAddedEnabled" ValueChanged="AutorunOnTorrentAddedEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="External program" Value="AutorunOnTorrentAddedProgram" ValueChanged="AutorunOnTorrentAddedProgramChanged" ShrinkLabel Disabled="@(!AutorunOnTorrentAddedEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudCheckBox T="bool" Label="Run external program on torrent finished" Value="AutorunEnabled" ValueChanged="AutorunEnabledChanged" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" Label="External program" Value="AutorunProgram" ValueChanged="AutorunProgramChanged" ShrinkLabel Disabled="@(!AutorunEnabled)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudText>Supported parameters (case sensitive):</MudText>
|
||||
<MudList>
|
||||
<MudListItem>%N: Torrent name</MudListItem>
|
||||
<MudListItem>%L: Category</MudListItem>
|
||||
<MudListItem>%G: Tags (separated by comma)</MudListItem>
|
||||
<MudListItem>%F: Content path (same as root path for multifile torrent)</MudListItem>
|
||||
<MudListItem>%R: Root path (first torrent subdirectory path)</MudListItem>
|
||||
<MudListItem>%D: Save path</MudListItem>
|
||||
<MudListItem>%C: Number of files</MudListItem>
|
||||
<MudListItem>%Z: Torrent size (bytes)</MudListItem>
|
||||
<MudListItem>%T: Current tracker</MudListItem>
|
||||
<MudListItem>%I: Info hash v1</MudListItem>
|
||||
<MudListItem>%J: Info hash v2</MudListItem>
|
||||
<MudListItem>%K: Torrent ID</MudListItem>
|
||||
</MudList>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
399
Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor.cs
Normal file
399
Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor.cs
Normal file
@@ -0,0 +1,399 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class DownloadsOptions : Options
|
||||
{
|
||||
protected string? TorrentContentLayout { get; set; }
|
||||
protected bool AddToTopOfQueue { get; set; }
|
||||
protected bool StartPausedEnabled { get; set; }
|
||||
protected string? TorrentStopCondition { get; set; }
|
||||
protected bool AutoDeleteMode { get; set; }
|
||||
protected bool PreallocateAll { get; set; }
|
||||
protected bool IncompleteFilesExt { get; set; }
|
||||
protected bool AutoTmmEnabled { get; set; }
|
||||
protected bool TorrentChangedTmmEnabled { get; set; }
|
||||
protected bool SavePathChangedTmmEnabled { get; set; }
|
||||
protected bool CategoryChangedTmmEnabled { get; set; }
|
||||
protected bool UseSubcategories { get; set; }
|
||||
protected string? SavePath { get; set; }
|
||||
protected bool TempPathEnabled { get; set; }
|
||||
protected string? TempPath { get; set; }
|
||||
protected bool ExportDirEnabled { get; set; }
|
||||
protected string? ExportDir { get; set; }
|
||||
protected bool ExportDirFinEnabled { get; set; }
|
||||
protected string? ExportDirFin { get; set; }
|
||||
protected Dictionary<string, SaveLocation> ScanDirs { get; set; } = [];
|
||||
protected bool ExcludedFileNamesEnabled { get; set; }
|
||||
protected string? ExcludedFileNames { get; set; }
|
||||
protected bool MailNotificationEnabled { get; set; }
|
||||
protected string? MailNotificationSender { get; set; }
|
||||
protected string? MailNotificationEmail { get; set; }
|
||||
protected string? MailNotificationSmtp { get; set; }
|
||||
protected bool MailNotificationSslEnabled { get; set; }
|
||||
protected bool MailNotificationAuthEnabled { get; set; }
|
||||
protected string? MailNotificationUsername { get; set; }
|
||||
protected string? MailNotificationPassword { get; set; }
|
||||
protected bool AutorunOnTorrentAddedEnabled { get; set; }
|
||||
protected string? AutorunOnTorrentAddedProgram { get; set; }
|
||||
protected bool AutorunEnabled { get; set; }
|
||||
protected string? AutorunProgram { get; set; }
|
||||
|
||||
protected List<KeyValuePair<string, SaveLocation>> AddedScanDirs { get; set; } = [];
|
||||
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
if (Preferences is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// when adding a torrent
|
||||
TorrentContentLayout = Preferences.TorrentContentLayout;
|
||||
AddToTopOfQueue = Preferences.AddToTopOfQueue;
|
||||
StartPausedEnabled = Preferences.StartPausedEnabled;
|
||||
TorrentStopCondition = Preferences.TorrentStopCondition;
|
||||
AutoDeleteMode = Preferences.AutoDeleteMode == 1;
|
||||
PreallocateAll = Preferences.PreallocateAll;
|
||||
IncompleteFilesExt = Preferences.IncompleteFilesExt;
|
||||
|
||||
// saving management
|
||||
AutoTmmEnabled = Preferences.AutoTmmEnabled;
|
||||
TorrentChangedTmmEnabled = Preferences.TorrentChangedTmmEnabled;
|
||||
SavePathChangedTmmEnabled = Preferences.SavePathChangedTmmEnabled;
|
||||
CategoryChangedTmmEnabled = Preferences.CategoryChangedTmmEnabled;
|
||||
UseSubcategories = Preferences.UseSubcategories;
|
||||
SavePath = Preferences.SavePath;
|
||||
TempPathEnabled = Preferences.TempPathEnabled;
|
||||
TempPath = Preferences.TempPath;
|
||||
ExportDir = Preferences.ExportDir;
|
||||
ExportDirEnabled = !string.IsNullOrEmpty(Preferences.ExportDir);
|
||||
ExportDirFin = Preferences.ExportDirFin;
|
||||
ExportDirFinEnabled = !string.IsNullOrEmpty(Preferences.ExportDirFin);
|
||||
|
||||
ScanDirs.Clear();
|
||||
foreach (var dir in Preferences.ScanDirs)
|
||||
{
|
||||
ScanDirs.Add(dir.Key, dir.Value);
|
||||
}
|
||||
|
||||
ExcludedFileNamesEnabled = Preferences.ExcludedFileNamesEnabled;
|
||||
ExcludedFileNames = Preferences.ExcludedFileNames;
|
||||
|
||||
// email notification
|
||||
MailNotificationEnabled = Preferences.MailNotificationEnabled;
|
||||
MailNotificationSender = Preferences.MailNotificationSender;
|
||||
MailNotificationEmail = Preferences.MailNotificationEmail;
|
||||
MailNotificationSmtp = Preferences.MailNotificationSmtp;
|
||||
MailNotificationSslEnabled = Preferences.MailNotificationSslEnabled;
|
||||
MailNotificationAuthEnabled = Preferences.MailNotificationAuthEnabled;
|
||||
MailNotificationUsername = Preferences.MailNotificationUsername;
|
||||
MailNotificationPassword = Preferences.MailNotificationPassword;
|
||||
|
||||
// autorun
|
||||
AutorunOnTorrentAddedEnabled = Preferences.AutorunOnTorrentAddedEnabled;
|
||||
AutorunOnTorrentAddedProgram = Preferences.AutorunOnTorrentAddedProgram;
|
||||
AutorunEnabled = Preferences.AutorunEnabled;
|
||||
AutorunProgram = Preferences.AutorunProgram;
|
||||
|
||||
AddedScanDirs.Clear();
|
||||
AddDefaultScanDir();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async Task TorrentContentLayoutChanged(string value)
|
||||
{
|
||||
TorrentContentLayout = value;
|
||||
UpdatePreferences.TorrentContentLayout = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AddToTopOfQueueChanged(bool value)
|
||||
{
|
||||
AddToTopOfQueue = value;
|
||||
UpdatePreferences.AddToTopOfQueue = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task StartPausedEnabledChanged(bool value)
|
||||
{
|
||||
StartPausedEnabled = value;
|
||||
UpdatePreferences.StartPausedEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task TorrentStopConditionChanged(string value)
|
||||
{
|
||||
TorrentStopCondition = value;
|
||||
UpdatePreferences.TorrentStopCondition = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutoDeleteModeChanged(bool value)
|
||||
{
|
||||
AutoDeleteMode = value;
|
||||
UpdatePreferences.AutoDeleteMode = value ? 1 : 0;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task PreallocateAllChanged(bool value)
|
||||
{
|
||||
PreallocateAll = value;
|
||||
UpdatePreferences.PreallocateAll = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task IncompleteFilesExtChanged(bool value)
|
||||
{
|
||||
IncompleteFilesExt = value;
|
||||
UpdatePreferences.IncompleteFilesExt = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutoTmmEnabledChanged(bool value)
|
||||
{
|
||||
AutoTmmEnabled = value;
|
||||
UpdatePreferences.AutoTmmEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task TorrentChangedTmmEnabledChanged(bool value)
|
||||
{
|
||||
TorrentChangedTmmEnabled = value;
|
||||
UpdatePreferences.TorrentChangedTmmEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task SavePathChangedTmmEnabledChanged(bool value)
|
||||
{
|
||||
SavePathChangedTmmEnabled = value;
|
||||
UpdatePreferences.SavePathChangedTmmEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task CategoryChangedTmmEnabledChanged(bool value)
|
||||
{
|
||||
CategoryChangedTmmEnabled = value;
|
||||
UpdatePreferences.CategoryChangedTmmEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task UseSubcategoriesChanged(bool value)
|
||||
{
|
||||
UseSubcategories = value;
|
||||
UpdatePreferences.UseSubcategories = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task SavePathChanged(string value)
|
||||
{
|
||||
SavePath = value;
|
||||
UpdatePreferences.SavePath = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task TempPathEnabledChanged(bool value)
|
||||
{
|
||||
TempPathEnabled = value;
|
||||
UpdatePreferences.TempPathEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task TempPathChanged(string value)
|
||||
{
|
||||
TempPath = value;
|
||||
UpdatePreferences.TempPath = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void ExportDirEnabledChanged(bool value)
|
||||
{
|
||||
ExportDirEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task ExportDirChanged(string value)
|
||||
{
|
||||
ExportDir = value;
|
||||
UpdatePreferences.ExportDir = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected void ExportDirFinEnabledChanged(bool value)
|
||||
{
|
||||
ExportDirFinEnabled = value;
|
||||
}
|
||||
|
||||
protected async Task ExportDirFinChanged(string value)
|
||||
{
|
||||
ExportDirFin = value;
|
||||
UpdatePreferences.ExportDirFin = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ScanDirsKeyChanged(string key, string value)
|
||||
{
|
||||
if (ScanDirs.Remove(key, out var location))
|
||||
{
|
||||
ScanDirs[value] = location;
|
||||
}
|
||||
UpdatePreferences.ScanDirs = ScanDirs;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ScanDirsValueChanged(string key, string value)
|
||||
{
|
||||
ScanDirs[key] = SaveLocation.Create(value);
|
||||
UpdatePreferences.ScanDirs = ScanDirs;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AddedScanDirsKeyChanged(int index, string key)
|
||||
{
|
||||
if (key == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScanDirs.Add(key, AddedScanDirs[index].Value);
|
||||
AddedScanDirs.RemoveAt(index);
|
||||
UpdatePreferences.ScanDirs = ScanDirs;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
|
||||
if (AddedScanDirs.Count == 0)
|
||||
{
|
||||
AddDefaultScanDir();
|
||||
}
|
||||
}
|
||||
|
||||
protected void AddedScanDirsValueChanged(int index, string value)
|
||||
{
|
||||
var existing = AddedScanDirs[index];
|
||||
AddedScanDirs[index] = new KeyValuePair<string, SaveLocation>(existing.Key, SaveLocation.Create(value));
|
||||
}
|
||||
|
||||
protected void AddNewScanDir()
|
||||
{
|
||||
AddDefaultScanDir();
|
||||
}
|
||||
|
||||
protected async Task ExcludedFileNamesEnabledChanged(bool value)
|
||||
{
|
||||
ExcludedFileNamesEnabled = value;
|
||||
UpdatePreferences.ExcludedFileNamesEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task ExcludedFileNamesChanged(string value)
|
||||
{
|
||||
ExcludedFileNames = value;
|
||||
UpdatePreferences.ExcludedFileNames = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationEnabledChanged(bool value)
|
||||
{
|
||||
MailNotificationEnabled = value;
|
||||
UpdatePreferences.MailNotificationEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationSenderChanged(string value)
|
||||
{
|
||||
MailNotificationSender = value;
|
||||
UpdatePreferences.MailNotificationSender = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationEmailChanged(string value)
|
||||
{
|
||||
MailNotificationEmail = value;
|
||||
UpdatePreferences.MailNotificationEmail = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationSmtpChanged(string value)
|
||||
{
|
||||
MailNotificationSmtp = value;
|
||||
UpdatePreferences.MailNotificationSmtp = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationSslEnabledChanged(bool value)
|
||||
{
|
||||
MailNotificationSslEnabled = value;
|
||||
UpdatePreferences.MailNotificationSslEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationAuthEnabledChanged(bool value)
|
||||
{
|
||||
MailNotificationAuthEnabled = value;
|
||||
UpdatePreferences.MailNotificationAuthEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationUsernameChanged(string value)
|
||||
{
|
||||
MailNotificationUsername = value;
|
||||
UpdatePreferences.MailNotificationUsername = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task MailNotificationPasswordChanged(string value)
|
||||
{
|
||||
MailNotificationPassword = value;
|
||||
UpdatePreferences.MailNotificationPassword = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutorunOnTorrentAddedEnabledChanged(bool value)
|
||||
{
|
||||
AutorunOnTorrentAddedEnabled = value;
|
||||
UpdatePreferences.AutorunOnTorrentAddedEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutorunOnTorrentAddedProgramChanged(string value)
|
||||
{
|
||||
AutorunOnTorrentAddedProgram = value;
|
||||
UpdatePreferences.AutorunOnTorrentAddedProgram = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutorunEnabledChanged(bool value)
|
||||
{
|
||||
AutorunEnabled = value;
|
||||
UpdatePreferences.AutorunEnabled = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
protected async Task AutorunProgramChanged(string value)
|
||||
{
|
||||
AutorunProgram = value;
|
||||
UpdatePreferences.AutorunProgram = value;
|
||||
await PreferencesChanged.InvokeAsync(UpdatePreferences);
|
||||
}
|
||||
|
||||
private void AddDefaultScanDir()
|
||||
{
|
||||
AddedScanDirs.Add(new KeyValuePair<string, SaveLocation>("", SaveLocation.Create(1)));
|
||||
}
|
||||
|
||||
protected Func<string, string?> IsValidNewKey => IsValidNewKeyFunc;
|
||||
|
||||
private string? IsValidNewKeyFunc(string? key)
|
||||
{
|
||||
if (key is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (ScanDirs.ContainsKey(key))
|
||||
{
|
||||
return "A folder with this path already exists";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Lantean.QBTMudBlade/Components/Options/Options.cs
Normal file
38
Lantean.QBTMudBlade/Components/Options/Options.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public abstract class Options : ComponentBase
|
||||
{
|
||||
private bool _preferencesRead;
|
||||
protected UpdatePreferences UpdatePreferences { get; set; } = new UpdatePreferences();
|
||||
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public Preferences? Preferences { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public EventCallback<UpdatePreferences> PreferencesChanged { get; set; }
|
||||
|
||||
public async Task ResetAsync()
|
||||
{
|
||||
SetOptions();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (_preferencesRead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_preferencesRead = SetOptions();
|
||||
}
|
||||
|
||||
protected abstract bool SetOptions();
|
||||
}
|
||||
}
|
||||
14
Lantean.QBTMudBlade/Components/Options/RSSOptions.razor
Normal file
14
Lantean.QBTMudBlade/Components/Options/RSSOptions.razor
Normal file
@@ -0,0 +1,14 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6"></MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
10
Lantean.QBTMudBlade/Components/Options/RSSOptions.razor.cs
Normal file
10
Lantean.QBTMudBlade/Components/Options/RSSOptions.razor.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class RSSOptions : Options
|
||||
{
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor
Normal file
14
Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor
Normal file
@@ -0,0 +1,14 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6"></MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
10
Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor.cs
Normal file
10
Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class SpeedOptions : Options
|
||||
{
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor
Normal file
14
Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor
Normal file
@@ -0,0 +1,14 @@
|
||||
@inherits Options
|
||||
|
||||
<MudCard Elevation="1" Class="ml-4 mr-4 mb-4 mt-4">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6"></MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent Class="pt-0">
|
||||
<MudGrid>
|
||||
|
||||
</MudGrid>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
10
Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor.cs
Normal file
10
Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class WebUIOptions : Options
|
||||
{
|
||||
protected override bool SetOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user