mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-22 20:42:24 +00:00
Code cleanup
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using static MudBlazor.CategoryTypes;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Dialogs
|
||||
{
|
||||
|
@@ -1,10 +1,6 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using System.Data.Common;
|
||||
using static MudBlazor.CategoryTypes;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MudBlazor;
|
||||
using MudBlazor.Utilities;
|
||||
@@ -32,7 +31,6 @@ namespace Lantean.QBTMudBlade.Components
|
||||
[Parameter]
|
||||
public Color IconColor { get; set; } = Color.Default;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public string? Target { get; set; }
|
||||
|
||||
|
@@ -192,7 +192,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
files = await ApiClient.GetTorrentContents(Hash);
|
||||
}
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden || exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
_timerCancellationToken.CancelIfNotDisposed();
|
||||
return;
|
||||
|
@@ -1,8 +1,6 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using static MudBlazor.Colors;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
@@ -68,7 +66,6 @@ namespace Lantean.QBTMudBlade.Components
|
||||
await CategoryChanged.InvokeAsync(category);
|
||||
}
|
||||
|
||||
|
||||
var tag = await LocalStorage.GetItemAsStringAsync(_tagSelectionStorageKey);
|
||||
if (tag is not null)
|
||||
{
|
||||
|
@@ -70,7 +70,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
Pieces = await ApiClient.GetTorrentPieceStates(Hash);
|
||||
Properties = await ApiClient.GetTorrentProperties(Hash);
|
||||
}
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden || exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
_timerCancellationToken.CancelIfNotDisposed();
|
||||
return;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
|
@@ -1,6 +1,4 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class ConnectionOptions : Options
|
||||
{
|
||||
|
@@ -1,6 +1,4 @@
|
||||
using ByteSizeLib;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public partial class SpeedOptions : Options
|
||||
{
|
||||
|
@@ -71,7 +71,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
peers = await ApiClient.GetTorrentPeersData(Hash, _requestId);
|
||||
}
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden || exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
_timerCancellationToken.CancelIfNotDisposed();
|
||||
return;
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using Lantean.QBTMudBlade.Interop;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MudBlazor.Services;
|
||||
using MudBlazor;
|
||||
using MudBlazor.Services;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using MudBlazor.Utilities;
|
||||
using static MudBlazor.CategoryTypes;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
@@ -54,7 +53,6 @@ namespace Lantean.QBTMudBlade.Components
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SortDirection sortDirection;
|
||||
switch (SortDirection)
|
||||
{
|
||||
|
@@ -4,7 +4,6 @@ using Lantean.QBTMudBlade.Interop;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.JSInterop;
|
||||
using MudBlazor;
|
||||
|
||||
@@ -327,22 +326,27 @@ namespace Lantean.QBTMudBlade.Components
|
||||
/// Renders toolbar contents without the <see cref="MudToolBar"/> wrapper.
|
||||
/// </summary>
|
||||
ToolbarContents,
|
||||
|
||||
/// <summary>
|
||||
/// Renders a <see cref="MudToolBar"/>.
|
||||
/// </summary>
|
||||
Toolbar,
|
||||
|
||||
/// <summary>
|
||||
/// Renders a <see cref="MudMenu"/>.
|
||||
/// </summary>
|
||||
Menu,
|
||||
|
||||
/// <summary>
|
||||
/// Renders a <see cref="MudToolBar"/> with <see cref="MudIconButton"/> for basic actions and a <see cref="MudMenu"/> for actions with children.
|
||||
/// </summary>
|
||||
MixedToolbarContents,
|
||||
|
||||
/// <summary>
|
||||
/// Renders toolbar contents without the <see cref="MudToolBar"/> wrapper with <see cref="MudIconButton"/> for basic actions and a <see cref="MudMenu"/> for actions with children.
|
||||
/// </summary>
|
||||
MixedToolbar,
|
||||
|
||||
InitialIconsOnly,
|
||||
Children,
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
Trackers = await ApiClient.GetTorrentTrackers(Hash);
|
||||
}
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden || exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
_timerCancellationToken.CancelIfNotDisposed();
|
||||
return;
|
||||
|
@@ -65,7 +65,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
WebSeeds = await ApiClient.GetTorrentWebSeeds(Hash);
|
||||
}
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden || exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
_timerCancellationToken.CancelIfNotDisposed();
|
||||
return;
|
||||
|
@@ -4,7 +4,6 @@ using Lantean.QBTMudBlade.Components.Dialogs;
|
||||
using Lantean.QBTMudBlade.Filter;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using MudBlazor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
{
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using MudBlazor;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
@@ -341,32 +340,43 @@ namespace Lantean.QBTMudBlade
|
||||
case "forcedMetaDL":
|
||||
case "downloading":
|
||||
return (Icons.Material.Filled.Downloading, Color.Success);
|
||||
|
||||
case "forcedUP":
|
||||
case "uploading":
|
||||
return (Icons.Material.Filled.Upload, Color.Info);
|
||||
|
||||
case "stalledUP":
|
||||
return (Icons.Material.Filled.KeyboardDoubleArrowUp, Color.Info);
|
||||
|
||||
case "stalledDL":
|
||||
return (Icons.Material.Filled.KeyboardDoubleArrowDown, Color.Success);
|
||||
|
||||
case "pausedDL":
|
||||
return (Icons.Material.Filled.Pause, Color.Success);
|
||||
|
||||
case "pausedUP":
|
||||
return (Icons.Material.Filled.Pause, Color.Info);
|
||||
|
||||
case "queuedDL":
|
||||
case "queuedUP":
|
||||
return (Icons.Material.Filled.Queue, Color.Default);
|
||||
|
||||
case "checkingDL":
|
||||
case "checkingUP":
|
||||
return (Icons.Material.Filled.Loop, Color.Info);
|
||||
|
||||
case "queuedForChecking":
|
||||
case "checkingResumeData":
|
||||
return (Icons.Material.Filled.Loop, Color.Warning);
|
||||
|
||||
case "moving":
|
||||
return (Icons.Material.Filled.Moving, Color.Info);
|
||||
|
||||
case "error":
|
||||
case "unknown":
|
||||
case "missingFiles":
|
||||
return (Icons.Material.Filled.Error, Color.Error);
|
||||
|
||||
default:
|
||||
return (Icons.Material.Filled.QuestionMark, Color.Warning);
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using Lantean.QBTMudBlade;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
{
|
||||
|
@@ -171,7 +171,6 @@ namespace Lantean.QBTMudBlade
|
||||
|
||||
public static bool FilterStatus(string state, long uploadSpeed, Status status)
|
||||
{
|
||||
|
||||
bool inactive = false;
|
||||
switch (status)
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@ namespace Lantean.QBTMudBlade.Layout
|
||||
[CascadingParameter(Name = "SortDirection")]
|
||||
public SortDirection SortDirection { get; set; }
|
||||
|
||||
|
||||
protected string? SelectedTorrent { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
|
@@ -21,7 +21,7 @@ namespace Lantean.QBTMudBlade.Models
|
||||
Index = index;
|
||||
Priority = priority;
|
||||
Progress = progress;
|
||||
Size = size;
|
||||
Size = priority == Priority.DoNotDownload ? 0 : size;
|
||||
Availability = availability;
|
||||
IsFolder = isFolder;
|
||||
Level = level;
|
||||
|
@@ -32,11 +32,11 @@ namespace Lantean.QBTMudBlade.Pages
|
||||
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.BadRequest)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
ApiError = "Invalid username or password.";
|
||||
}
|
||||
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
||||
catch (HttpRequestException exception) when (exception.StatusCode == HttpStatusCode.Forbidden)
|
||||
{
|
||||
ApiError = "Requests from this client are currently unavailable.";
|
||||
}
|
||||
@@ -47,10 +47,12 @@ namespace Lantean.QBTMudBlade.Pages
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await DoLogin("admin", "23mIDZhvT");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -130,5 +130,3 @@ namespace Lantean.QBTMudBlade.Pages
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using MudBlazor.Services;
|
||||
using Blazored;
|
||||
using Blazored.LocalStorage;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
{
|
||||
|
@@ -616,7 +616,6 @@ namespace Lantean.QBTMudBlade.Services
|
||||
progress = (float)downloaded / size;
|
||||
}
|
||||
|
||||
|
||||
if (!contents.TryGetValue(key, out var dir))
|
||||
{
|
||||
continue;
|
||||
|
@@ -109,7 +109,6 @@ td.no-wrap {
|
||||
}
|
||||
|
||||
.field-switch {
|
||||
|
||||
}
|
||||
|
||||
.piecesbarWrapper {
|
||||
|
@@ -44,7 +44,6 @@ class PiecesBar {
|
||||
MAX_CANVAS_WIDTH = 4096;
|
||||
|
||||
constructor(pieces, parameters) {
|
||||
|
||||
this.id = 'piecesbar_' + (window.qbt.piecesBarUniqueId++);
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
|
@@ -121,7 +121,6 @@ namespace Lantean.QBitTorrentClient
|
||||
return apiClient.AddTorrentTags([tag], null, hashes.ToArray());
|
||||
}
|
||||
|
||||
|
||||
public static Task RecheckTorrent(this IApiClient apiClient, string hash)
|
||||
{
|
||||
return apiClient.RecheckTorrents(null, hash);
|
||||
|
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Lantean.QBitTorrentClient.Models
|
||||
namespace Lantean.QBitTorrentClient.Models
|
||||
{
|
||||
public class SaveLocation
|
||||
{
|
||||
|
Reference in New Issue
Block a user