chore: refactoring toast

This commit is contained in:
Chubby Granny Chaser
2025-01-23 14:03:28 +00:00
parent f81e4ac5b5
commit b86746287f
15 changed files with 1602 additions and 98 deletions

View File

@@ -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,
{

View File

@@ -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);
}
}