feat: adding level generic interface

This commit is contained in:
Chubby Granny Chaser
2025-11-29 02:19:41 +00:00
parent f41128c4c8
commit 140718764d
18 changed files with 36 additions and 24 deletions

View File

@@ -1,4 +1,3 @@
import "./get-session-hash";
import "./open-auth-window";
import "./sign-out";

View File

@@ -1,3 +1,2 @@
import "./check-for-updates";
import "./restart-and-install-update";

View File

@@ -2,4 +2,3 @@ import "./get-game-assets";
import "./get-game-shop-details";
import "./get-game-stats";
import "./get-random-game";

View File

@@ -2,4 +2,3 @@ import "./download-game-artifact";
import "./get-game-backup-preview";
import "./select-game-backup-path";
import "./upload-save-game";

View File

@@ -4,4 +4,3 @@ import "./get-download-sources-since-value";
import "./get-download-sources";
import "./remove-download-source";
import "./sync-download-sources";

View File

@@ -1,3 +1,2 @@
import "./check-folder-write-permission";
import "./get-disk-free-space";

View File

@@ -30,4 +30,3 @@ import "./update-executable-path";
import "./update-game-custom-assets";
import "./update-launch-options";
import "./verify-executable-path";

View File

@@ -10,4 +10,3 @@ import "./open-external";
import "./save-temp-file";
import "./show-item-in-folder";
import "./show-open-dialog";

View File

@@ -1,4 +1,3 @@
import "./publish-new-repacks-notification";
import "./show-achievement-test-notification";
import "./update-achievement-notification-window";

View File

@@ -2,4 +2,3 @@ import "./get-me";
import "./process-profile-image";
import "./sync-friend-requests";
import "./update-profile";

View File

@@ -13,4 +13,3 @@ import "./open-editor-window";
import "./remove-theme-achievement-sound";
import "./toggle-custom-theme";
import "./update-custom-theme";

View File

@@ -5,4 +5,3 @@ import "./pause-game-seed";
import "./resume-game-download";
import "./resume-game-seed";
import "./start-game-download";

View File

@@ -3,4 +3,3 @@ import "./authenticate-torbox";
import "./auto-launch";
import "./get-user-preferences";
import "./update-user-preferences";

View File

@@ -1,4 +1,3 @@
import "./get-auth";
import "./get-compared-unlocked-achievements";
import "./get-unlocked-achievements";

View File

@@ -13,7 +13,9 @@ export class SystemPath {
};
static checkIfPathsAreAvailable() {
const paths = Object.keys(SystemPath.paths) as (keyof typeof SystemPath.paths)[];
const paths = Object.keys(
SystemPath.paths
) as (keyof typeof SystemPath.paths)[];
paths.forEach((pathName) => {
try {

View File

@@ -1,4 +1,8 @@
import { TorrentDownloader, TorrentSession, TorrentStatus } from "./hydra-native";
import {
TorrentDownloader,
TorrentSession,
TorrentStatus,
} from "./hydra-native";
import { logger } from "./logger";
// Global torrent session - matches Python's torrent_session
@@ -44,7 +48,10 @@ export class TorrentDownloadService {
torrentDownloaders.set(downloadId, downloader);
return downloader;
} catch (error) {
logger.error(`Failed to create torrent downloader for ${downloadId}`, error);
logger.error(
`Failed to create torrent downloader for ${downloadId}`,
error
);
return null;
}
}
@@ -95,7 +102,10 @@ export class TorrentDownloadService {
logger.log(`Cancelled torrent download for ${downloadId}`);
}
} catch (error) {
logger.error(`Failed to cancel torrent download for ${downloadId}`, error);
logger.error(
`Failed to cancel torrent download for ${downloadId}`,
error
);
throw error;
}
}
@@ -110,9 +120,11 @@ export class TorrentDownloadService {
const status = downloader.getDownloadStatus();
return status || null;
} catch (error) {
logger.error(`Failed to get torrent download status for ${downloadId}`, error);
logger.error(
`Failed to get torrent download status for ${downloadId}`,
error
);
return null;
}
}
}

View File

@@ -79,7 +79,10 @@ export function GameOptionsModal({
const debounceUpdateLaunchOptions = useRef(
debounce(async (value: string) => {
const gameKey = getGameKey(game.shop, game.objectId);
const gameData = (await levelDBService.get(gameKey, "games")) as Game | null;
const gameData = (await levelDBService.get(
gameKey,
"games"
)) as Game | null;
if (gameData) {
const updated = {
...gameData,
@@ -221,7 +224,10 @@ export function GameOptionsModal({
setLaunchOptions("");
const gameKey = getGameKey(game.shop, game.objectId);
const gameData = (await levelDBService.get(gameKey, "games")) as Game | null;
const gameData = (await levelDBService.get(
gameKey,
"games"
)) as Game | null;
if (gameData) {
const updated = { ...gameData, launchOptions: null };
await levelDBService.put(gameKey, updated, "games");
@@ -268,7 +274,10 @@ export function GameOptionsModal({
setAutomaticCloudSync(event.target.checked);
const gameKey = getGameKey(game.shop, game.objectId);
const gameData = (await levelDBService.get(gameKey, "games")) as Game | null;
const gameData = (await levelDBService.get(
gameKey,
"games"
)) as Game | null;
if (gameData) {
const updated = { ...gameData, automaticCloudSync: event.target.checked };
await levelDBService.put(gameKey, updated, "games");

View File

@@ -146,7 +146,10 @@ export function RepacksModal({
.get(gameKey, "games")
.then((gameData) => {
if (gameData) {
const updated = { ...(gameData as Game), newDownloadOptionsCount: undefined };
const updated = {
...(gameData as Game),
newDownloadOptionsCount: undefined,
};
return levelDBService.put(gameKey, updated, "games");
}
})