feat: updating real-debrid translations

This commit is contained in:
Chubby Granny Chaser
2024-05-29 16:22:30 +01:00
parent 183b85d66a
commit 08a336b392
38 changed files with 284 additions and 228 deletions

View File

@@ -29,7 +29,7 @@ const resumeGameDownload = async (
.getRepository(Game)
.update({ status: "active", progress: Not(1) }, { status: "paused" });
await DownloadManager.resumeDownload(gameId);
await DownloadManager.resumeDownload(game);
await transactionalEntityManager
.getRepository(Game)

View File

@@ -19,6 +19,7 @@ const startGameDownload = async (
where: {
objectID,
},
relations: { repack: true },
}),
repackRepository.findOne({
where: {
@@ -50,9 +51,7 @@ const startGameDownload = async (
}
);
await DownloadManager.startDownload(game.id);
return { ...game, stauts: "active" };
return DownloadManager.startDownload(game);
} else {
const steamGame = stateManager
.getValue("steamGames")
@@ -62,8 +61,8 @@ const startGameDownload = async (
? getSteamAppAsset("icon", objectID, steamGame.clientIcon)
: null;
const createdGame = await gameRepository
.save({
await gameRepository
.insert({
title,
iconUrl,
objectID,
@@ -83,9 +82,14 @@ const startGameDownload = async (
return result;
});
await DownloadManager.startDownload(createdGame.id);
const createdGame = await gameRepository.findOne({
where: {
objectID,
},
relations: { repack: true },
});
return createdGame;
return DownloadManager.startDownload(createdGame!);
}
};

View File

@@ -2,23 +2,17 @@ import { userPreferencesRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import type { UserPreferences } from "@types";
import { RealDebridClient } from "@main/services/real-debrid";
const updateUserPreferences = async (
_event: Electron.IpcMainInvokeEvent,
preferences: Partial<UserPreferences>
) => {
if (preferences.realDebridApiToken) {
RealDebridClient.authorize(preferences.realDebridApiToken);
}
await userPreferencesRepository.upsert(
) =>
userPreferencesRepository.upsert(
{
id: 1,
...preferences,
},
["id"]
);
};
registerEvent("updateUserPreferences", updateUserPreferences);