mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-22 02:13:59 +00:00
chore: refactoring toast
This commit is contained in:
@@ -3,6 +3,7 @@ import { registerEvent } from "../register-event";
|
||||
import type { UserPreferences } from "@types";
|
||||
import i18next from "i18next";
|
||||
import { db, levelKeys } from "@main/level";
|
||||
import { Crypto } from "@main/services";
|
||||
|
||||
const updateUserPreferences = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
@@ -21,6 +22,12 @@ const updateUserPreferences = async (
|
||||
i18next.changeLanguage(preferences.language);
|
||||
}
|
||||
|
||||
if (preferences.realDebridApiToken) {
|
||||
preferences.realDebridApiToken = Crypto.encrypt(
|
||||
preferences.realDebridApiToken
|
||||
);
|
||||
}
|
||||
|
||||
await db.put<string, UserPreferences>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
|
||||
@@ -25,17 +25,20 @@ export class DownloadManager {
|
||||
) {
|
||||
PythonRPC.spawn(
|
||||
download?.status === "active"
|
||||
? await this.getDownloadPayload(download).catch(() => undefined)
|
||||
? await this.getDownloadPayload(download).catch((err) => {
|
||||
logger.error("Error getting download payload", err);
|
||||
return undefined;
|
||||
})
|
||||
: undefined,
|
||||
downloadsToSeed?.map((download) => ({
|
||||
game_id: `${download.shop}-${download.objectId}`,
|
||||
game_id: levelKeys.game(download.shop, download.objectId),
|
||||
url: download.uri,
|
||||
save_path: download.downloadPath,
|
||||
}))
|
||||
);
|
||||
|
||||
if (download) {
|
||||
this.downloadingGameId = `${download.shop}-${download.objectId}`;
|
||||
this.downloadingGameId = levelKeys.game(download.shop, download.objectId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user