mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
feat: few adjustments
This commit is contained in:
parent
db2e31b8cc
commit
b1dde446b2
@ -10,19 +10,19 @@ import type {
|
||||
export class TorBoxClient {
|
||||
private static instance: AxiosInstance;
|
||||
private static readonly baseURL = "https://api.torbox.app/v1/api";
|
||||
public static apiToken: string;
|
||||
private static apiToken: string;
|
||||
|
||||
static authorize(apiToken: string) {
|
||||
this.apiToken = apiToken;
|
||||
this.instance = axios.create({
|
||||
baseURL: this.baseURL,
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiToken}`,
|
||||
},
|
||||
});
|
||||
this.apiToken = apiToken;
|
||||
}
|
||||
|
||||
static async addMagnet(magnet: string) {
|
||||
private static async addMagnet(magnet: string) {
|
||||
const form = new FormData();
|
||||
form.append("magnet", magnet);
|
||||
|
||||
@ -31,6 +31,10 @@ export class TorBoxClient {
|
||||
form
|
||||
);
|
||||
|
||||
if (!response.data.success) {
|
||||
throw new Error(response.data.detail);
|
||||
}
|
||||
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
@ -74,7 +78,7 @@ export class TorBoxClient {
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
static async getTorrentIdAndName(magnetUri: string) {
|
||||
private static async getTorrentIdAndName(magnetUri: string) {
|
||||
const userTorrents = await this.getAllTorrentsFromUser();
|
||||
|
||||
const { infoHash } = await parseTorrent(magnetUri);
|
||||
|
@ -163,7 +163,7 @@ export interface UserPreferences {
|
||||
repackUpdatesNotificationsEnabled: boolean;
|
||||
achievementNotificationsEnabled: boolean;
|
||||
realDebridApiToken: string | null;
|
||||
torboxApiToken: string | null;
|
||||
torBoxApiToken: string | null;
|
||||
preferQuitInsteadOfHiding: boolean;
|
||||
runAtStartup: boolean;
|
||||
startMinimized: boolean;
|
||||
|
@ -54,14 +54,14 @@ export interface TorBoxTorrentInfo {
|
||||
export interface TorBoxTorrentInfoRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
error: string | null;
|
||||
data: TorBoxTorrentInfo[];
|
||||
}
|
||||
|
||||
export interface TorBoxAddTorrentRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
error: string | null;
|
||||
data: {
|
||||
torrent_id: number;
|
||||
name: string;
|
||||
|
Loading…
Reference in New Issue
Block a user