mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: add torbox migration
This commit is contained in:
parent
abb16e7736
commit
db2e31b8cc
@ -20,6 +20,9 @@ export class UserPreferences {
|
|||||||
@Column("text", { nullable: true })
|
@Column("text", { nullable: true })
|
||||||
realDebridApiToken: string | null;
|
realDebridApiToken: string | null;
|
||||||
|
|
||||||
|
@Column("text", { nullable: true })
|
||||||
|
torBoxApiToken: string | null;
|
||||||
|
|
||||||
@Column("boolean", { default: false })
|
@Column("boolean", { default: false })
|
||||||
downloadNotificationsEnabled: boolean;
|
downloadNotificationsEnabled: boolean;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import { AddShouldSeedColumn } from "./migrations/20241108200154_add_should_seed
|
|||||||
import { AddSeedAfterDownloadColumn } from "./migrations/20241108201806_add_seed_after_download";
|
import { AddSeedAfterDownloadColumn } from "./migrations/20241108201806_add_seed_after_download";
|
||||||
import { AddHiddenAchievementDescriptionColumn } from "./migrations/20241216140633_add_hidden_achievement_description_column ";
|
import { AddHiddenAchievementDescriptionColumn } from "./migrations/20241216140633_add_hidden_achievement_description_column ";
|
||||||
import { AddLaunchOptionsColumnToGame } from "./migrations/20241226044022_add_launch_options_column_to_game";
|
import { AddLaunchOptionsColumnToGame } from "./migrations/20241226044022_add_launch_options_column_to_game";
|
||||||
|
import { AddTorBoxApiToken } from "./migrations/20250111182229_add_torbox_api_token_column";
|
||||||
|
|
||||||
export type HydraMigration = Knex.Migration & { name: string };
|
export type HydraMigration = Knex.Migration & { name: string };
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
|||||||
AddSeedAfterDownloadColumn,
|
AddSeedAfterDownloadColumn,
|
||||||
AddHiddenAchievementDescriptionColumn,
|
AddHiddenAchievementDescriptionColumn,
|
||||||
AddLaunchOptionsColumnToGame,
|
AddLaunchOptionsColumnToGame,
|
||||||
|
AddTorBoxApiToken,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
getMigrationName(migration: HydraMigration): string {
|
getMigrationName(migration: HydraMigration): string {
|
||||||
|
@ -19,10 +19,12 @@ const loadState = async (userPreferences: UserPreferences | null) => {
|
|||||||
Aria2.spawn();
|
Aria2.spawn();
|
||||||
|
|
||||||
if (userPreferences?.realDebridApiToken) {
|
if (userPreferences?.realDebridApiToken) {
|
||||||
RealDebridClient.authorize(userPreferences?.realDebridApiToken);
|
RealDebridClient.authorize(userPreferences.realDebridApiToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
TorBoxClient.authorize("7371d5ec-52fa-4b87-9052-0c8c96d947cc");
|
if (userPreferences?.torBoxApiToken) {
|
||||||
|
TorBoxClient.authorize(userPreferences?.torBoxApiToken);
|
||||||
|
}
|
||||||
|
|
||||||
Ludusavi.addManifestToLudusaviConfig();
|
Ludusavi.addManifestToLudusaviConfig();
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
import type { HydraMigration } from "@main/knex-client";
|
||||||
|
import type { Knex } from "knex";
|
||||||
|
|
||||||
|
export const AddTorBoxApiToken: HydraMigration = {
|
||||||
|
name: "AddTorBoxApiToken",
|
||||||
|
up: (knex: Knex) => {
|
||||||
|
return knex.schema.alterTable("user_preferences", (table) => {
|
||||||
|
return table.string("torBoxApiToken").nullable();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: async (knex: Knex) => {
|
||||||
|
return knex.schema.alterTable("user_preferences", (table) => {
|
||||||
|
return table.dropColumn("torBoxApiToken");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
@ -19,7 +19,7 @@ export class TorBoxClient {
|
|||||||
Authorization: `Bearer ${apiToken}`,
|
Authorization: `Bearer ${apiToken}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.apiToken = "7371d5ec-52fa-4b87-9052-0c8c96d947cc";
|
this.apiToken = apiToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async addMagnet(magnet: string) {
|
static async addMagnet(magnet: string) {
|
||||||
|
@ -163,6 +163,7 @@ export interface UserPreferences {
|
|||||||
repackUpdatesNotificationsEnabled: boolean;
|
repackUpdatesNotificationsEnabled: boolean;
|
||||||
achievementNotificationsEnabled: boolean;
|
achievementNotificationsEnabled: boolean;
|
||||||
realDebridApiToken: string | null;
|
realDebridApiToken: string | null;
|
||||||
|
torboxApiToken: string | null;
|
||||||
preferQuitInsteadOfHiding: boolean;
|
preferQuitInsteadOfHiding: boolean;
|
||||||
runAtStartup: boolean;
|
runAtStartup: boolean;
|
||||||
startMinimized: boolean;
|
startMinimized: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user