mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-16 08:52:59 -03:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5aabe0ad7 | ||
|
|
276c098fbc | ||
|
|
3455812a43 | ||
|
|
87a994f0f0 | ||
|
|
15ddc71445 | ||
|
|
ee916b998a | ||
|
|
914942d328 | ||
|
|
5ae67a3dc7 | ||
|
|
5475708b36 | ||
|
|
c85f46844e | ||
|
|
1247a105a0 | ||
|
|
3cc4ee3ee4 | ||
|
|
7fca31338c | ||
|
|
0d747d03ab | ||
|
|
6a59036e21 | ||
|
|
baddd4a99b | ||
|
|
c40d26ef0a | ||
|
|
e4f7747200 | ||
|
|
bc06ae5c03 | ||
|
|
39c073634c | ||
|
|
c5beeb861e | ||
|
|
0a4bdf160c | ||
|
|
6f43da8d28 | ||
|
|
42e8a68c08 | ||
|
|
f960bb4f6f | ||
|
|
7f988c0bba | ||
|
|
dcf05d3386 | ||
|
|
96385d90d8 | ||
|
|
96cfa8c015 | ||
|
|
ae067efd5e | ||
|
|
8c16779052 | ||
|
|
5c7a289299 | ||
|
|
e8e524182a | ||
|
|
521d9faa0c | ||
|
|
ca7ac73836 | ||
|
|
ed42935e7b | ||
|
|
f0c5ec6f1a | ||
|
|
66ced3c779 | ||
|
|
4f8212f8e3 | ||
|
|
86de5aa89e | ||
|
|
00065ab0c9 | ||
|
|
e89202f750 | ||
|
|
1df2353f06 | ||
|
|
475ab4119b | ||
|
|
1346ff49a5 | ||
|
|
4ff0132d53 | ||
|
|
749a88b2b6 | ||
|
|
427b77c597 | ||
|
|
e901df9ac7 | ||
|
|
43e565bcc9 | ||
|
|
f4e710c7d1 | ||
|
|
592ac45740 |
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -99,3 +99,4 @@ jobs:
|
||||
dist/*.yml
|
||||
dist/*.blockmap
|
||||
dist/*.pacman
|
||||
dist/*.AppImage
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,7 +7,8 @@ out
|
||||
*.log*
|
||||
.env
|
||||
.vite
|
||||
ludusavi/
|
||||
ludusavi/**
|
||||
!ludusavi/config.yaml
|
||||
hydra-python-rpc/
|
||||
.python-version
|
||||
|
||||
|
||||
BIN
binaries/aria2c
Executable file
BIN
binaries/aria2c
Executable file
Binary file not shown.
BIN
binaries/aria2c.exe
Executable file
BIN
binaries/aria2c.exe
Executable file
Binary file not shown.
@@ -3,7 +3,6 @@ productName: Hydra
|
||||
directories:
|
||||
buildResources: build
|
||||
extraResources:
|
||||
- aria2
|
||||
- ludusavi
|
||||
- hydra-python-rpc
|
||||
- seeds
|
||||
@@ -21,6 +20,7 @@ asarUnpack:
|
||||
win:
|
||||
executableName: Hydra
|
||||
extraResources:
|
||||
- from: binaries/aria2c.exe
|
||||
- from: binaries/7z.exe
|
||||
- from: binaries/7z.dll
|
||||
target:
|
||||
@@ -51,6 +51,7 @@ dmg:
|
||||
linux:
|
||||
extraResources:
|
||||
- from: binaries/7zzs
|
||||
- from: binaries/aria2c
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
|
||||
6
ludusavi/config.yaml
Normal file
6
ludusavi/config.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
manifest:
|
||||
enable: false
|
||||
secondary:
|
||||
- url: https://cdn.losbroxas.org/manifest.yaml
|
||||
enable: true
|
||||
customGames: []
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydralauncher",
|
||||
"version": "3.4.10",
|
||||
"version": "3.5.0",
|
||||
"description": "Hydra",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "Los Broxas",
|
||||
@@ -49,6 +49,7 @@
|
||||
"classnames": "^2.5.1",
|
||||
"color": "^4.2.3",
|
||||
"color.js": "^1.2.0",
|
||||
"crc": "^4.3.2",
|
||||
"create-desktop-shortcuts": "^1.11.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"dexie": "^4.0.10",
|
||||
@@ -62,7 +63,6 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lodash-es": "^4.17.21",
|
||||
"parse-torrent": "^11.0.17",
|
||||
"piscina": "^4.7.0",
|
||||
"rc-virtual-list": "^3.16.1",
|
||||
"react-hook-form": "^7.53.0",
|
||||
"react-i18next": "^14.1.0",
|
||||
@@ -71,10 +71,12 @@
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-tooltip": "^5.28.0",
|
||||
"sound-play": "^1.1.0",
|
||||
"steam-shortcut-editor": "https://github.com/hydralauncher/steam-shortcut-editor",
|
||||
"sudo-prompt": "^9.2.1",
|
||||
"tar": "^7.4.3",
|
||||
"tough-cookie": "^5.1.1",
|
||||
"user-agents": "^1.1.387",
|
||||
"winreg": "^1.2.5",
|
||||
"ws": "^8.18.1",
|
||||
"yaml": "^2.6.1",
|
||||
"yup": "^1.5.0",
|
||||
@@ -100,6 +102,7 @@
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/sound-play": "^1.1.3",
|
||||
"@types/user-agents": "^1.0.4",
|
||||
"@types/winreg": "^1.2.36",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"electron": "^31.7.7",
|
||||
|
||||
@@ -3,7 +3,6 @@ const tar = require("tar");
|
||||
const util = require("node:util");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
|
||||
const exec = util.promisify(require("node:child_process").exec);
|
||||
|
||||
@@ -15,8 +14,18 @@ const fileName = {
|
||||
darwin: `ludusavi-v${ludusaviVersion}-mac.tar.gz`,
|
||||
};
|
||||
|
||||
const ludusaviBinaryName = {
|
||||
win32: "ludusavi.exe",
|
||||
linux: "ludusavi",
|
||||
darwin: "ludusavi",
|
||||
};
|
||||
|
||||
const downloadLudusavi = async () => {
|
||||
if (fs.existsSync("ludusavi")) {
|
||||
if (
|
||||
fs.existsSync(
|
||||
path.join(process.cwd(), "ludusavi", ludusaviBinaryName[process.platform])
|
||||
)
|
||||
) {
|
||||
console.log("Ludusavi already exists, skipping download...");
|
||||
return;
|
||||
}
|
||||
@@ -58,79 +67,4 @@ const downloadLudusavi = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
const downloadAria2WindowsAndLinux = async () => {
|
||||
const file =
|
||||
process.platform === "win32"
|
||||
? "aria2-1.37.0-win-64bit-build1.zip"
|
||||
: "aria2-1.37.0-1-x86_64.pkg.tar.zst";
|
||||
|
||||
const downloadUrl =
|
||||
process.platform === "win32"
|
||||
? `https://github.com/aria2/aria2/releases/download/release-1.37.0/${file}`
|
||||
: "https://archlinux.org/packages/extra/x86_64/aria2/download/";
|
||||
|
||||
console.log(`Downloading ${file}...`);
|
||||
|
||||
const response = await axios.get(downloadUrl, { responseType: "stream" });
|
||||
|
||||
const stream = response.data.pipe(fs.createWriteStream(file));
|
||||
|
||||
stream.on("finish", async () => {
|
||||
console.log(`Downloaded ${file}, extracting...`);
|
||||
|
||||
if (process.platform === "win32") {
|
||||
await exec(`npx extract-zip ${file}`);
|
||||
console.log("Extracted. Renaming folder...");
|
||||
|
||||
fs.mkdirSync("aria2");
|
||||
fs.copyFileSync(
|
||||
path.join(file.replace(".zip", ""), "aria2c.exe"),
|
||||
"aria2/aria2c.exe"
|
||||
);
|
||||
fs.rmSync(file.replace(".zip", ""), { recursive: true });
|
||||
} else {
|
||||
await exec(`tar --zstd -xvf ${file} usr/bin/aria2c`);
|
||||
console.log("Extracted. Copying binary file...");
|
||||
fs.mkdirSync("aria2");
|
||||
fs.copyFileSync("usr/bin/aria2c", "aria2/aria2c");
|
||||
fs.rmSync("usr", { recursive: true });
|
||||
}
|
||||
|
||||
console.log(`Extracted ${file}, removing compressed downloaded file...`);
|
||||
fs.rmSync(file);
|
||||
});
|
||||
};
|
||||
|
||||
const copyAria2Macos = async () => {
|
||||
console.log("Checking if aria2 is installed...");
|
||||
|
||||
const isAria2Installed = spawnSync("which", ["aria2c"]).status;
|
||||
|
||||
if (isAria2Installed != 0) {
|
||||
console.log("Please install aria2");
|
||||
console.log("brew install aria2");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Copying aria2 binary...");
|
||||
fs.mkdirSync("aria2");
|
||||
await exec(`cp $(which aria2c) aria2/aria2c`);
|
||||
};
|
||||
|
||||
const copyAria2 = () => {
|
||||
const aria2Path =
|
||||
process.platform === "win32" ? "aria2/aria2c.exe" : "aria2/aria2c";
|
||||
|
||||
if (fs.existsSync(aria2Path)) {
|
||||
console.log("Aria2 already exists, skipping download...");
|
||||
return;
|
||||
}
|
||||
if (process.platform == "darwin") {
|
||||
copyAria2Macos();
|
||||
} else {
|
||||
downloadAria2WindowsAndLinux();
|
||||
}
|
||||
};
|
||||
|
||||
copyAria2();
|
||||
downloadLudusavi();
|
||||
|
||||
@@ -20,7 +20,7 @@ const s3 = new S3Client({
|
||||
|
||||
const dist = path.resolve(__dirname, "..", "dist");
|
||||
|
||||
const extensionsToUpload = [".deb", ".exe", ".pacman"];
|
||||
const extensionsToUpload = [".deb", ".exe", ".pacman", ".AppImage"];
|
||||
|
||||
fs.readdir(dist, async (err, files) => {
|
||||
if (err) throw err;
|
||||
|
||||
@@ -130,9 +130,11 @@
|
||||
"download_in_progress": "Download in progress",
|
||||
"download_paused": "Download paused",
|
||||
"last_downloaded_option": "Last downloaded option",
|
||||
"create_steam_shortcut": "Create Steam shortcut",
|
||||
"create_shortcut_success": "Shortcut created successfully",
|
||||
"you_might_need_to_restart_steam": "You might need to restart Steam to see the changes",
|
||||
"create_shortcut_error": "Error creating shortcut",
|
||||
"nsfw_content_title": "This game contains innapropriate content",
|
||||
"nsfw_content_title": "This game contains inappropriate content",
|
||||
"nsfw_content_description": "{{title}} contains content that may not be suitable for all ages. Are you sure you want to continue?",
|
||||
"allow_nsfw_content": "Continue",
|
||||
"refuse_nsfw_content": "Go back",
|
||||
@@ -199,7 +201,10 @@
|
||||
"game_removed_from_favorites": "Game removed from favorites",
|
||||
"game_added_to_favorites": "Game added to favorites",
|
||||
"automatically_extract_downloaded_files": "Automatically extract downloaded files",
|
||||
"create_start_menu_shortcut": "Create Start Menu shortcut"
|
||||
"create_start_menu_shortcut": "Create Start Menu shortcut",
|
||||
"invalid_wine_prefix_path": "Invalid Wine prefix path",
|
||||
"invalid_wine_prefix_path_description": "The path to the Wine prefix is invalid. Please check the path and try again.",
|
||||
"missing_wine_prefix": "Wine prefix is required to create a backup on Linux"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Activate Hydra",
|
||||
@@ -358,7 +363,23 @@
|
||||
"install_common_redist": "Install",
|
||||
"installing_common_redist": "Installing…",
|
||||
"show_download_speed_in_megabytes": "Show download speed in megabytes per second",
|
||||
"extract_files_by_default": "Extract files by default after download"
|
||||
"extract_files_by_default": "Extract files by default after download",
|
||||
"achievement_custom_notification_position": "Achievement custom notification position",
|
||||
"top-left": "Top left",
|
||||
"top-center": "Top center",
|
||||
"top-right": "Top right",
|
||||
"bottom-left": "Bottom left",
|
||||
"bottom-center": "Bottom center",
|
||||
"bottom-right": "Bottom right",
|
||||
"enable_achievement_custom_notifications": "Enable achievement custom notifications",
|
||||
"alignment": "Alignment",
|
||||
"variation": "Variation",
|
||||
"default": "Default",
|
||||
"rare": "Rare",
|
||||
"platinum": "Platinum",
|
||||
"hidden": "Hidden",
|
||||
"test_notification": "Test notification",
|
||||
"notification_preview": "Achievement Notification Preview"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "Download complete",
|
||||
@@ -374,7 +395,9 @@
|
||||
"new_friend_request_title": "New friend request",
|
||||
"extraction_complete": "Extraction complete",
|
||||
"game_extracted": "{{title}} extracted successfully",
|
||||
"friend_started_playing_game": "{{displayName}} started playing a game"
|
||||
"friend_started_playing_game": "{{displayName}} started playing a game",
|
||||
"test_achievement_notification_title": "This is a test notification",
|
||||
"test_achievement_notification_description": "Pretty cool, huh?"
|
||||
},
|
||||
"system_tray": {
|
||||
"open": "Open Hydra",
|
||||
|
||||
@@ -130,8 +130,10 @@
|
||||
"danger_zone_section_description": "Eliminar este juego de tu librería o los archivos descargados por Hydra (Esto solo eliminará los archivos de instalación y no el juego instalado)",
|
||||
"download_in_progress": "Descarga en progreso",
|
||||
"download_paused": "Descarga pausada",
|
||||
"create_steam_shortcut": "Crear atajo de Steam",
|
||||
"last_downloaded_option": "Última opción descargada",
|
||||
"create_shortcut_success": "Atajo creado con éxito",
|
||||
"you_might_need_to_restart_steam": "Es posible que necesites reiniciar Steam para ver los cambios",
|
||||
"create_shortcut_error": "Error al crear un atajo",
|
||||
"nsfw_content_title": "Este juego contiene contenido inapropiado.",
|
||||
"nsfw_content_description": "{{title}} puede ser no adecuado para todas las edades por su contenido. \n¿Deseas continuar de igual forma?",
|
||||
@@ -198,7 +200,10 @@
|
||||
"download_error_not_cached_on_real_debrid": "Esta descarga no está disponible en Real-Debrid y el estado de descarga del sondeo de Real-Debrid aún no está disponible.",
|
||||
"download_error_not_cached_on_torbox": "Esta descarga no está disponible en TorBox y el estado de descarga del sondeo aún no está disponible.",
|
||||
"game_added_to_favorites": "Juego añadido a favoritos",
|
||||
"game_removed_from_favorites": "Juego removido de favoritos"
|
||||
"game_removed_from_favorites": "Juego removido de favoritos",
|
||||
"invalid_wine_prefix_path": "Ruta de prefixo Wine inválida",
|
||||
"invalid_wine_prefix_path_description": "La ruta al prefixo Wine es inválida. Por favor, verifica la ruta y vuelve a intentarlo.",
|
||||
"missing_wine_prefix": ""
|
||||
},
|
||||
"activation": {
|
||||
"title": "Activar Hydra",
|
||||
|
||||
@@ -118,7 +118,9 @@
|
||||
"download_in_progress": "Download em andamento",
|
||||
"download_paused": "Download pausado",
|
||||
"last_downloaded_option": "Última opção baixada",
|
||||
"create_steam_shortcut": "Criar atalho na Steam",
|
||||
"create_shortcut_success": "Atalho criado com sucesso",
|
||||
"you_might_need_to_restart_steam": "Você pode precisar reiniciar a Steam para ver as alterações",
|
||||
"create_shortcut_error": "Erro ao criar atalho",
|
||||
"nsfw_content_title": "Este jogo contém conteúdo inapropriado",
|
||||
"nsfw_content_description": "{{title}} contém conteúdo que pode não ser apropriado para todas as idades. Você deseja continuar?",
|
||||
@@ -188,7 +190,9 @@
|
||||
"game_removed_from_favorites": "Jogo removido dos favoritos",
|
||||
"game_added_to_favorites": "Jogo adicionado aos favoritos",
|
||||
"automatically_extract_downloaded_files": "Extrair automaticamente os arquivos baixados",
|
||||
"create_start_menu_shortcut": "Criar atalho no Menu Iniciar"
|
||||
"create_start_menu_shortcut": "Criar atalho no Menu Iniciar",
|
||||
"invalid_wine_prefix_path": "Caminho do prefixo Wine inválido",
|
||||
"invalid_wine_prefix_path_description": "O caminho para o prefixo Wine é inválido. Por favor, verifique o caminho e tente novamente."
|
||||
},
|
||||
"activation": {
|
||||
"title": "Ativação",
|
||||
@@ -345,7 +349,23 @@
|
||||
"install_common_redist": "Instalar",
|
||||
"installing_common_redist": "Instalando…",
|
||||
"show_download_speed_in_megabytes": "Exibir taxas de download em megabytes por segundo",
|
||||
"extract_files_by_default": "Extrair arquivos automaticamente após o download"
|
||||
"extract_files_by_default": "Extrair arquivos automaticamente após o download",
|
||||
"enable_achievement_custom_notifications": "Habilitar notificações customizadas de conquistas",
|
||||
"top-left": "Superior esquerdo",
|
||||
"top-center": "Superior central",
|
||||
"top-right": "Superior direito",
|
||||
"bottom-left": "Inferior esquerdo",
|
||||
"bottom-right": "Inferior direito",
|
||||
"bottom-center": "Inferior central",
|
||||
"achievement_custom_notification_position": "Posição das notificações customizadas de conquista",
|
||||
"alignment": "Alinhamento",
|
||||
"variation": "Variação",
|
||||
"default": "Padrão",
|
||||
"rare": "Rara",
|
||||
"platinum": "Platina",
|
||||
"hidden": "Oculta",
|
||||
"test_notification": "Testar notificação",
|
||||
"notification_preview": "Prévia da Notificação de Conquistas"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "Download concluído",
|
||||
@@ -359,7 +379,9 @@
|
||||
"new_friend_request_description": "{{displayName}} te enviou um pedido de amizade",
|
||||
"extraction_complete": "Extração concluída",
|
||||
"game_extracted": "{{title}} extraído com sucesso",
|
||||
"friend_started_playing_game": "{{displayName}} começou a jogar"
|
||||
"friend_started_playing_game": "{{displayName}} começou a jogar",
|
||||
"test_achievement_notification_title": "Esta é uma notificação de teste",
|
||||
"test_achievement_notification_description": "Bem legal, né?"
|
||||
},
|
||||
"system_tray": {
|
||||
"open": "Abrir Hydra",
|
||||
|
||||
@@ -2,8 +2,6 @@ import { app } from "electron";
|
||||
import path from "node:path";
|
||||
import { SystemPath } from "./services/system-path";
|
||||
|
||||
export const LUDUSAVI_MANIFEST_URL = "https://cdn.losbroxas.org/manifest.yaml";
|
||||
|
||||
export const defaultDownloadsPath = SystemPath.getPath("downloads");
|
||||
|
||||
export const isStaging = import.meta.env.MAIN_VITE_API_URL.includes("staging");
|
||||
@@ -16,6 +14,8 @@ export const windowsStartMenuPath = path.join(
|
||||
"Programs"
|
||||
);
|
||||
|
||||
export const publicProfilePath = "C:/Users/Public";
|
||||
|
||||
export const levelDatabasePath = path.join(
|
||||
SystemPath.getPath("userData"),
|
||||
`hydra-db${isStaging ? "-staging" : ""}`
|
||||
@@ -40,4 +40,6 @@ export const backupsPath = path.join(SystemPath.getPath("userData"), "Backups");
|
||||
|
||||
export const appVersion = app.getVersion() + (isStaging ? "-staging" : "");
|
||||
|
||||
export const ASSETS_PATH = path.join(SystemPath.getPath("userData"), "Assets");
|
||||
|
||||
export const MAIN_LOOP_INTERVAL = 1500;
|
||||
|
||||
@@ -1,74 +1,93 @@
|
||||
import { HydraApi, logger, Ludusavi, WindowManager } from "@main/services";
|
||||
import { CloudSync, HydraApi, logger, WindowManager } from "@main/services";
|
||||
import fs from "node:fs";
|
||||
import * as tar from "tar";
|
||||
import { registerEvent } from "../register-event";
|
||||
import axios from "axios";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { backupsPath } from "@main/constants";
|
||||
import type { GameShop } from "@types";
|
||||
import { backupsPath, publicProfilePath } from "@main/constants";
|
||||
import type { GameShop, LudusaviBackupMapping } from "@types";
|
||||
|
||||
import YAML from "yaml";
|
||||
import { normalizePath } from "@main/helpers";
|
||||
import { addTrailingSlash, normalizePath } from "@main/helpers";
|
||||
import { SystemPath } from "@main/services/system-path";
|
||||
import { gamesSublevel, levelKeys } from "@main/level";
|
||||
|
||||
export interface LudusaviBackup {
|
||||
files: {
|
||||
[key: string]: {
|
||||
hash: string;
|
||||
size: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
export const transformLudusaviBackupPathIntoWindowsPath = (
|
||||
backupPath: string,
|
||||
winePrefixPath?: string | null
|
||||
) => {
|
||||
return backupPath
|
||||
.replace(winePrefixPath ? addTrailingSlash(winePrefixPath) : "", "")
|
||||
.replace("drive_c", "C:");
|
||||
};
|
||||
|
||||
const replaceLudusaviBackupWithCurrentUser = (
|
||||
export const addWinePrefixToWindowsPath = (
|
||||
windowsPath: string,
|
||||
winePrefixPath?: string | null
|
||||
) => {
|
||||
if (!winePrefixPath) {
|
||||
return windowsPath;
|
||||
}
|
||||
|
||||
return path.join(winePrefixPath, windowsPath.replace("C:", "drive_c"));
|
||||
};
|
||||
|
||||
const restoreLudusaviBackup = (
|
||||
backupPath: string,
|
||||
title: string,
|
||||
homeDir: string
|
||||
homeDir: string,
|
||||
winePrefixPath?: string | null,
|
||||
artifactWinePrefixPath?: string | null
|
||||
) => {
|
||||
const gameBackupPath = path.join(backupPath, title);
|
||||
const mappingYamlPath = path.join(gameBackupPath, "mapping.yaml");
|
||||
|
||||
const data = fs.readFileSync(mappingYamlPath, "utf8");
|
||||
const manifest = YAML.parse(data) as {
|
||||
backups: LudusaviBackup[];
|
||||
backups: LudusaviBackupMapping[];
|
||||
drives: Record<string, string>;
|
||||
};
|
||||
|
||||
const currentHomeDir = normalizePath(SystemPath.getPath("home"));
|
||||
const userProfilePath =
|
||||
CloudSync.getWindowsLikeUserProfilePath(winePrefixPath);
|
||||
|
||||
/* Renaming logic */
|
||||
if (os.platform() === "win32") {
|
||||
const mappedHomeDir = path.join(
|
||||
gameBackupPath,
|
||||
path.join("drive-C", homeDir.replace("C:", ""))
|
||||
);
|
||||
|
||||
if (fs.existsSync(mappedHomeDir)) {
|
||||
fs.renameSync(
|
||||
mappedHomeDir,
|
||||
path.join(gameBackupPath, "drive-C", currentHomeDir.replace("C:", ""))
|
||||
manifest.backups.forEach((backup) => {
|
||||
Object.keys(backup.files).forEach((key) => {
|
||||
const sourcePathWithDrives = Object.entries(manifest.drives).reduce(
|
||||
(prev, [driveKey, driveValue]) => {
|
||||
return prev.replace(driveValue, driveKey);
|
||||
},
|
||||
key
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const backups = manifest.backups.map((backup: LudusaviBackup) => {
|
||||
const files = Object.entries(backup.files).reduce((prev, [key, value]) => {
|
||||
const updatedKey = key.replace(homeDir, currentHomeDir);
|
||||
const sourcePath = path.join(gameBackupPath, sourcePathWithDrives);
|
||||
|
||||
return {
|
||||
...prev,
|
||||
[updatedKey]: value,
|
||||
};
|
||||
}, {});
|
||||
logger.info(`Source path: ${sourcePath}`);
|
||||
|
||||
return {
|
||||
...backup,
|
||||
files,
|
||||
};
|
||||
const destinationPath = transformLudusaviBackupPathIntoWindowsPath(
|
||||
key,
|
||||
artifactWinePrefixPath
|
||||
)
|
||||
.replace(
|
||||
homeDir,
|
||||
addWinePrefixToWindowsPath(userProfilePath, winePrefixPath)
|
||||
)
|
||||
.replace(
|
||||
publicProfilePath,
|
||||
addWinePrefixToWindowsPath(publicProfilePath, winePrefixPath)
|
||||
);
|
||||
|
||||
logger.info(`Moving ${sourcePath} to ${destinationPath}`);
|
||||
|
||||
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
||||
|
||||
if (fs.existsSync(destinationPath)) {
|
||||
fs.unlinkSync(destinationPath);
|
||||
}
|
||||
|
||||
fs.renameSync(sourcePath, destinationPath);
|
||||
});
|
||||
});
|
||||
|
||||
fs.writeFileSync(mappingYamlPath, YAML.stringify({ ...manifest, backups }));
|
||||
};
|
||||
|
||||
const downloadGameArtifact = async (
|
||||
@@ -78,10 +97,18 @@ const downloadGameArtifact = async (
|
||||
gameArtifactId: string
|
||||
) => {
|
||||
try {
|
||||
const { downloadUrl, objectKey, homeDir } = await HydraApi.post<{
|
||||
const game = await gamesSublevel.get(levelKeys.game(shop, objectId));
|
||||
|
||||
const {
|
||||
downloadUrl,
|
||||
objectKey,
|
||||
homeDir,
|
||||
winePrefixPath: artifactWinePrefixPath,
|
||||
} = await HydraApi.post<{
|
||||
downloadUrl: string;
|
||||
objectKey: string;
|
||||
homeDir: string;
|
||||
winePrefixPath: string | null;
|
||||
}>(`/profile/games/artifacts/${gameArtifactId}/download`);
|
||||
|
||||
const zipLocation = path.join(SystemPath.getPath("userData"), objectKey);
|
||||
@@ -109,34 +136,34 @@ const downloadGameArtifact = async (
|
||||
response.data.pipe(writer);
|
||||
|
||||
writer.on("error", (err) => {
|
||||
logger.error("Failed to write zip", err);
|
||||
logger.error("Failed to write tar file", err);
|
||||
throw err;
|
||||
});
|
||||
|
||||
fs.mkdirSync(backupPath, { recursive: true });
|
||||
|
||||
writer.on("close", () => {
|
||||
tar
|
||||
.x({
|
||||
file: zipLocation,
|
||||
cwd: backupPath,
|
||||
})
|
||||
.then(async () => {
|
||||
replaceLudusaviBackupWithCurrentUser(
|
||||
backupPath,
|
||||
objectId,
|
||||
normalizePath(homeDir)
|
||||
);
|
||||
writer.on("close", async () => {
|
||||
await tar.x({
|
||||
file: zipLocation,
|
||||
cwd: backupPath,
|
||||
});
|
||||
|
||||
Ludusavi.restoreBackup(backupPath).then(() => {
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-backup-download-complete-${objectId}-${shop}`,
|
||||
true
|
||||
);
|
||||
});
|
||||
});
|
||||
restoreLudusaviBackup(
|
||||
backupPath,
|
||||
objectId,
|
||||
normalizePath(homeDir),
|
||||
game?.winePrefixPath,
|
||||
artifactWinePrefixPath
|
||||
);
|
||||
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-backup-download-complete-${objectId}-${shop}`,
|
||||
true
|
||||
);
|
||||
});
|
||||
} catch (err) {
|
||||
logger.error("Failed to download game artifact", err);
|
||||
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-backup-download-complete-${objectId}-${shop}`,
|
||||
false
|
||||
|
||||
@@ -34,6 +34,8 @@ import "./library/remove-game-from-library";
|
||||
import "./library/select-game-wine-prefix";
|
||||
import "./library/reset-game-achievements";
|
||||
import "./library/toggle-automatic-cloud-sync";
|
||||
import "./library/get-default-wine-prefix-selection-path";
|
||||
import "./library/create-steam-shortcut";
|
||||
import "./misc/open-checkout";
|
||||
import "./misc/open-external";
|
||||
import "./misc/show-open-dialog";
|
||||
@@ -85,6 +87,8 @@ import "./cloud-save/upload-save-game";
|
||||
import "./cloud-save/delete-game-artifact";
|
||||
import "./cloud-save/select-game-backup-path";
|
||||
import "./notifications/publish-new-repacks-notification";
|
||||
import "./notifications/update-achievement-notification-window";
|
||||
import "./notifications/show-achievement-test-notification";
|
||||
import "./themes/add-custom-theme";
|
||||
import "./themes/delete-custom-theme";
|
||||
import "./themes/get-all-custom-themes";
|
||||
|
||||
181
src/main/events/library/create-steam-shortcut.ts
Normal file
181
src/main/events/library/create-steam-shortcut.ts
Normal file
@@ -0,0 +1,181 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import type { GameShop, GameStats } from "@types";
|
||||
import { gamesSublevel, levelKeys } from "@main/level";
|
||||
import {
|
||||
composeSteamShortcut,
|
||||
getSteamLocation,
|
||||
getSteamShortcuts,
|
||||
getSteamUsersIds,
|
||||
HydraApi,
|
||||
logger,
|
||||
SystemPath,
|
||||
writeSteamShortcuts,
|
||||
} from "@main/services";
|
||||
import fs from "node:fs";
|
||||
import axios from "axios";
|
||||
import path from "node:path";
|
||||
import { ASSETS_PATH } from "@main/constants";
|
||||
|
||||
const downloadAsset = async (downloadPath: string, url?: string | null) => {
|
||||
try {
|
||||
if (fs.existsSync(downloadPath)) {
|
||||
return downloadPath;
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
fs.mkdirSync(path.dirname(downloadPath), { recursive: true });
|
||||
|
||||
const response = await axios.get(url, { responseType: "arraybuffer" });
|
||||
fs.writeFileSync(downloadPath, response.data);
|
||||
|
||||
return downloadPath;
|
||||
} catch (error) {
|
||||
logger.error("Failed to download asset", error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const downloadAssetsFromSteam = async (
|
||||
shop: GameShop,
|
||||
objectId: string,
|
||||
assets: GameStats["assets"]
|
||||
) => {
|
||||
const gameAssetsPath = path.join(ASSETS_PATH, `${shop}-${objectId}`);
|
||||
|
||||
return await Promise.all([
|
||||
downloadAsset(path.join(gameAssetsPath, "icon.ico"), assets?.iconUrl),
|
||||
downloadAsset(
|
||||
path.join(gameAssetsPath, "hero.jpg"),
|
||||
assets?.libraryHeroImageUrl
|
||||
),
|
||||
downloadAsset(path.join(gameAssetsPath, "logo.png"), assets?.logoImageUrl),
|
||||
downloadAsset(
|
||||
path.join(gameAssetsPath, "cover.jpg"),
|
||||
assets?.coverImageUrl
|
||||
),
|
||||
downloadAsset(
|
||||
path.join(gameAssetsPath, "library.jpg"),
|
||||
assets?.libraryImageUrl
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
||||
const copyAssetIfExists = async (
|
||||
sourcePath: string | null,
|
||||
destinationPath: string
|
||||
) => {
|
||||
if (sourcePath && fs.existsSync(sourcePath)) {
|
||||
logger.info("Copying Steam asset", sourcePath, destinationPath);
|
||||
await fs.promises.cp(sourcePath, destinationPath);
|
||||
}
|
||||
};
|
||||
|
||||
const createSteamShortcut = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
shop: GameShop,
|
||||
objectId: string
|
||||
) => {
|
||||
const gameKey = levelKeys.game(shop, objectId);
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
|
||||
if (game) {
|
||||
if (!game.executablePath) {
|
||||
throw new Error("No executable path found for game");
|
||||
}
|
||||
|
||||
const { assets } = await HydraApi.get<GameStats>(
|
||||
`/games/stats?objectId=${objectId}&shop=${shop}`
|
||||
);
|
||||
|
||||
const steamUserIds = await getSteamUsersIds();
|
||||
|
||||
if (!steamUserIds.length) {
|
||||
logger.error("No Steam user ID found");
|
||||
return;
|
||||
}
|
||||
|
||||
const [iconImage, heroImage, logoImage, coverImage, libraryImage] =
|
||||
await downloadAssetsFromSteam(game.shop, game.objectId, assets);
|
||||
|
||||
const newShortcut = composeSteamShortcut(
|
||||
game.title,
|
||||
game.executablePath,
|
||||
iconImage
|
||||
);
|
||||
|
||||
for (const steamUserId of steamUserIds) {
|
||||
logger.info("Adding shortcut for Steam user", steamUserId);
|
||||
|
||||
const steamShortcuts = await getSteamShortcuts(steamUserId);
|
||||
|
||||
if (steamShortcuts.some((shortcut) => shortcut.appname === game.title)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const gridPath = path.join(
|
||||
await getSteamLocation(),
|
||||
"userdata",
|
||||
steamUserId.toString(),
|
||||
"config",
|
||||
"grid"
|
||||
);
|
||||
|
||||
await fs.promises.mkdir(gridPath, { recursive: true });
|
||||
|
||||
await Promise.all([
|
||||
copyAssetIfExists(
|
||||
heroImage,
|
||||
path.join(gridPath, `${newShortcut.appid}_hero.jpg`)
|
||||
),
|
||||
copyAssetIfExists(
|
||||
logoImage,
|
||||
path.join(gridPath, `${newShortcut.appid}_logo.png`)
|
||||
),
|
||||
copyAssetIfExists(
|
||||
coverImage,
|
||||
path.join(gridPath, `${newShortcut.appid}p.jpg`)
|
||||
),
|
||||
copyAssetIfExists(
|
||||
libraryImage,
|
||||
path.join(gridPath, `${newShortcut.appid}.jpg`)
|
||||
),
|
||||
]);
|
||||
|
||||
steamShortcuts.push(newShortcut);
|
||||
|
||||
logger.info(newShortcut);
|
||||
logger.info("Writing Steam shortcuts", steamShortcuts);
|
||||
|
||||
await writeSteamShortcuts(steamUserId, steamShortcuts);
|
||||
}
|
||||
|
||||
if (process.platform === "linux" && !game.winePrefixPath) {
|
||||
const steamWinePrefixes = path.join(
|
||||
SystemPath.getPath("home"),
|
||||
".local",
|
||||
"share",
|
||||
"Steam",
|
||||
"steamapps",
|
||||
"compatdata"
|
||||
);
|
||||
|
||||
const winePrefixPath = path.join(
|
||||
steamWinePrefixes,
|
||||
newShortcut.appid.toString(),
|
||||
"pfx"
|
||||
);
|
||||
|
||||
await fs.promises.mkdir(winePrefixPath, { recursive: true });
|
||||
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
winePrefixPath,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
registerEvent("createSteamShortcut", createSteamShortcut);
|
||||
@@ -0,0 +1,30 @@
|
||||
import { logger, SystemPath } from "@main/services";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
const getDefaultWinePrefixSelectionPath = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
try {
|
||||
const steamWinePrefixes = path.join(
|
||||
SystemPath.getPath("home"),
|
||||
".local",
|
||||
"share",
|
||||
"Steam",
|
||||
"steamapps",
|
||||
"compatdata"
|
||||
);
|
||||
|
||||
return await fs.promises.realpath(steamWinePrefixes);
|
||||
} catch (err) {
|
||||
logger.error("Failed to get default wine prefix selection path", err);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
"getDefaultWinePrefixSelectionPath",
|
||||
getDefaultWinePrefixSelectionPath
|
||||
);
|
||||
@@ -1,5 +1,7 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import fs from "node:fs";
|
||||
import { levelKeys, gamesSublevel } from "@main/level";
|
||||
import { Wine } from "@main/services";
|
||||
import type { GameShop } from "@types";
|
||||
|
||||
const selectGameWinePrefix = async (
|
||||
@@ -14,9 +16,24 @@ const selectGameWinePrefix = async (
|
||||
|
||||
if (!game) return;
|
||||
|
||||
if (!winePrefixPath) {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
winePrefixPath: null,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const realWinePrefixPath = await fs.promises.realpath(winePrefixPath);
|
||||
|
||||
if (!Wine.validatePrefix(realWinePrefixPath)) {
|
||||
throw new Error("Invalid wine prefix path");
|
||||
}
|
||||
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
winePrefixPath: winePrefixPath,
|
||||
winePrefixPath: realWinePrefixPath,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ const verifyExecutablePathInUse = async (
|
||||
) => {
|
||||
for await (const game of gamesSublevel.values()) {
|
||||
if (game.executablePath === executablePath) {
|
||||
return true;
|
||||
return game;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
};
|
||||
|
||||
registerEvent("verifyExecutablePathInUse", verifyExecutablePathInUse);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import { WindowManager } from "@main/services";
|
||||
|
||||
const showAchievementTestNotification = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
setTimeout(() => {
|
||||
WindowManager.showAchievementTestNotification();
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
"showAchievementTestNotification",
|
||||
showAchievementTestNotification
|
||||
);
|
||||
@@ -0,0 +1,29 @@
|
||||
import { db, levelKeys } from "@main/level";
|
||||
import { registerEvent } from "../register-event";
|
||||
import { WindowManager } from "@main/services";
|
||||
import { UserPreferences } from "@types";
|
||||
|
||||
const updateAchievementCustomNotificationWindow = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
const userPreferences = await db.get<string, UserPreferences>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
|
||||
WindowManager.closeNotificationWindow();
|
||||
|
||||
if (
|
||||
userPreferences.achievementNotificationsEnabled !== false &&
|
||||
userPreferences.achievementCustomNotificationsEnabled !== false
|
||||
) {
|
||||
WindowManager.createNotificationWindow();
|
||||
}
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
"updateAchievementCustomNotificationWindow",
|
||||
updateAchievementCustomNotificationWindow
|
||||
);
|
||||
@@ -21,6 +21,7 @@ const updateCustomTheme = async (
|
||||
|
||||
if (theme.isActive) {
|
||||
WindowManager.mainWindow?.webContents.send("css-injected", code);
|
||||
WindowManager.notificationWindow?.webContents.send("css-injected", code);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,3 +32,8 @@ export const isPortableVersion = () => {
|
||||
|
||||
export const normalizePath = (str: string) =>
|
||||
path.posix.normalize(str).replace(/\\/g, "/");
|
||||
|
||||
export const addTrailingSlash = (str: string) =>
|
||||
str.endsWith("/") ? str : `${str}/`;
|
||||
|
||||
export * from "./reg-parser";
|
||||
|
||||
58
src/main/helpers/reg-parser.ts
Normal file
58
src/main/helpers/reg-parser.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
type RegValue = string | number | null;
|
||||
|
||||
interface RegEntry {
|
||||
path: string;
|
||||
timestamp?: string;
|
||||
values: Record<string, RegValue>;
|
||||
}
|
||||
|
||||
export function parseRegFile(content: string): RegEntry[] {
|
||||
const lines = content.split(/\r?\n/);
|
||||
const entries: RegEntry[] = [];
|
||||
|
||||
let currentPath: string | null = null;
|
||||
let currentEntry: RegEntry | null = null;
|
||||
|
||||
for (const rawLine of lines) {
|
||||
const line = rawLine.trim();
|
||||
if (!line || line.startsWith(";") || line.startsWith(";;")) continue;
|
||||
|
||||
if (line.startsWith("#")) {
|
||||
const match = line.match(/^#time=(\w+)/);
|
||||
if (match && currentEntry) {
|
||||
currentEntry.timestamp = match[1];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.startsWith("[")) {
|
||||
const match = line.match(/^\[(.+?)\](?:\s+\d+)?/);
|
||||
if (match) {
|
||||
if (currentEntry) entries.push(currentEntry);
|
||||
currentPath = match[1];
|
||||
currentEntry = { path: currentPath, values: {} };
|
||||
}
|
||||
} else if (currentEntry) {
|
||||
const kvMatch = line.match(/^"?(.*?)"?=(.*)$/);
|
||||
if (kvMatch) {
|
||||
const [, key, rawValue] = kvMatch;
|
||||
let value: RegValue;
|
||||
|
||||
if (rawValue === '""') {
|
||||
value = "";
|
||||
} else if (rawValue.startsWith("dword:")) {
|
||||
value = parseInt(rawValue.slice(6), 16);
|
||||
} else if (rawValue.startsWith('"') && rawValue.endsWith('"')) {
|
||||
value = rawValue.slice(1, -1);
|
||||
} else {
|
||||
value = rawValue;
|
||||
}
|
||||
|
||||
currentEntry.values[key || "@"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentEntry) entries.push(currentEntry);
|
||||
return entries;
|
||||
}
|
||||
@@ -23,7 +23,9 @@ autoUpdater.logger = logger;
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) app.quit();
|
||||
|
||||
app.commandLine.appendSwitch("--no-sandbox");
|
||||
if (process.platform !== "linux") {
|
||||
app.commandLine.appendSwitch("--no-sandbox");
|
||||
}
|
||||
|
||||
i18n.init({
|
||||
resources,
|
||||
@@ -71,6 +73,7 @@ app.whenReady().then(async () => {
|
||||
WindowManager.createMainWindow();
|
||||
}
|
||||
|
||||
WindowManager.createNotificationWindow();
|
||||
WindowManager.createSystemTray(language || "en");
|
||||
});
|
||||
|
||||
|
||||
@@ -11,15 +11,13 @@ import {
|
||||
RealDebridClient,
|
||||
Aria2,
|
||||
DownloadManager,
|
||||
Ludusavi,
|
||||
HydraApi,
|
||||
uploadGamesBatch,
|
||||
startMainLoop,
|
||||
Ludusavi,
|
||||
} from "@main/services";
|
||||
|
||||
export const loadState = async () => {
|
||||
SystemPath.checkIfPathsAreAvailable();
|
||||
|
||||
const userPreferences = await db.get<string, UserPreferences | null>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
@@ -29,7 +27,9 @@ export const loadState = async () => {
|
||||
|
||||
await import("./events");
|
||||
|
||||
Aria2.spawn();
|
||||
if (process.platform !== "darwin") {
|
||||
Aria2.spawn();
|
||||
}
|
||||
|
||||
if (userPreferences?.realDebridApiToken) {
|
||||
RealDebridClient.authorize(userPreferences.realDebridApiToken);
|
||||
@@ -39,7 +39,7 @@ export const loadState = async () => {
|
||||
TorBoxClient.authorize(userPreferences.torBoxApiToken);
|
||||
}
|
||||
|
||||
Ludusavi.addManifestToLudusaviConfig();
|
||||
Ludusavi.copyConfigFileToUserData();
|
||||
|
||||
await HydraApi.setupApi().then(() => {
|
||||
uploadGamesBatch();
|
||||
@@ -77,4 +77,6 @@ export const loadState = async () => {
|
||||
startMainLoop();
|
||||
|
||||
CommonRedistManager.downloadCommonRedist();
|
||||
|
||||
SystemPath.checkIfPathsAreAvailable();
|
||||
};
|
||||
|
||||
@@ -7,11 +7,18 @@ import {
|
||||
findAllAchievementFiles,
|
||||
getAlternativeObjectIds,
|
||||
} from "./find-achivement-files";
|
||||
import type { AchievementFile, Game, UnlockedAchievement } from "@types";
|
||||
import type {
|
||||
AchievementFile,
|
||||
Game,
|
||||
UnlockedAchievement,
|
||||
UserPreferences,
|
||||
} from "@types";
|
||||
import { achievementsLogger } from "../logger";
|
||||
import { Cracker } from "@shared";
|
||||
import { publishCombinedNewAchievementNotification } from "../notifications";
|
||||
import { gamesSublevel } from "@main/level";
|
||||
import { db, gamesSublevel, levelKeys } from "@main/level";
|
||||
import { WindowManager } from "../window-manager";
|
||||
import { sleep } from "@main/helpers";
|
||||
|
||||
const fileStats: Map<string, number> = new Map();
|
||||
const fltFiles: Map<string, Set<string>> = new Map();
|
||||
@@ -184,7 +191,7 @@ export class AchievementWatcherManager {
|
||||
return mergeAchievements(game, unlockedAchievements, false);
|
||||
}
|
||||
|
||||
private static preSearchAchievementsWindows = async () => {
|
||||
private static async getGameAchievementFilesWindows() {
|
||||
const games = await gamesSublevel
|
||||
.values()
|
||||
.all()
|
||||
@@ -194,24 +201,24 @@ export class AchievementWatcherManager {
|
||||
|
||||
return Promise.all(
|
||||
games.map((game) => {
|
||||
const gameAchievementFiles: AchievementFile[] = [];
|
||||
const achievementFiles: AchievementFile[] = [];
|
||||
|
||||
for (const objectId of getAlternativeObjectIds(game.objectId)) {
|
||||
gameAchievementFiles.push(
|
||||
achievementFiles.push(
|
||||
...(gameAchievementFilesMap.get(objectId) || [])
|
||||
);
|
||||
|
||||
gameAchievementFiles.push(
|
||||
achievementFiles.push(
|
||||
...findAchievementFileInExecutableDirectory(game)
|
||||
);
|
||||
}
|
||||
|
||||
return this.preProcessGameAchievementFiles(game, gameAchievementFiles);
|
||||
return { game, achievementFiles };
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
private static preSearchAchievementsWithWine = async () => {
|
||||
private static async getGameAchievementFilesLinux() {
|
||||
const games = await gamesSublevel
|
||||
.values()
|
||||
.all()
|
||||
@@ -219,37 +226,70 @@ export class AchievementWatcherManager {
|
||||
|
||||
return Promise.all(
|
||||
games.map((game) => {
|
||||
const gameAchievementFiles = findAchievementFiles(game);
|
||||
const achievementFiles = findAchievementFiles(game);
|
||||
const achievementFileInsideDirectory =
|
||||
findAchievementFileInExecutableDirectory(game);
|
||||
|
||||
gameAchievementFiles.push(...achievementFileInsideDirectory);
|
||||
achievementFiles.push(...achievementFileInsideDirectory);
|
||||
|
||||
return this.preProcessGameAchievementFiles(game, gameAchievementFiles);
|
||||
return { game, achievementFiles };
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public static async preSearchAchievements() {
|
||||
await sleep(2000);
|
||||
|
||||
try {
|
||||
const newAchievementsCount =
|
||||
const gameAchievementFiles =
|
||||
process.platform === "win32"
|
||||
? await this.preSearchAchievementsWindows()
|
||||
: await this.preSearchAchievementsWithWine();
|
||||
? await this.getGameAchievementFilesWindows()
|
||||
: await this.getGameAchievementFilesLinux();
|
||||
|
||||
const newAchievementsCount: number[] = [];
|
||||
|
||||
for (const { game, achievementFiles } of gameAchievementFiles) {
|
||||
const result = await this.preProcessGameAchievementFiles(
|
||||
game,
|
||||
achievementFiles
|
||||
);
|
||||
|
||||
newAchievementsCount.push(result);
|
||||
}
|
||||
|
||||
const totalNewGamesWithAchievements = newAchievementsCount.filter(
|
||||
(achievements) => achievements
|
||||
).length;
|
||||
|
||||
const totalNewAchievements = newAchievementsCount.reduce(
|
||||
(acc, val) => acc + val,
|
||||
0
|
||||
);
|
||||
|
||||
if (totalNewAchievements > 0) {
|
||||
publishCombinedNewAchievementNotification(
|
||||
totalNewAchievements,
|
||||
totalNewGamesWithAchievements
|
||||
const userPreferences = await db.get<string, UserPreferences>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
|
||||
if (userPreferences.achievementNotificationsEnabled !== false) {
|
||||
if (userPreferences.achievementCustomNotificationsEnabled !== false) {
|
||||
WindowManager.notificationWindow?.webContents.send(
|
||||
"on-combined-achievements-unlocked",
|
||||
totalNewGamesWithAchievements,
|
||||
totalNewAchievements,
|
||||
userPreferences.achievementCustomNotificationPosition ??
|
||||
"top-left"
|
||||
);
|
||||
} else {
|
||||
publishCombinedNewAchievementNotification(
|
||||
totalNewAchievements,
|
||||
totalNewGamesWithAchievements
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
achievementsLogger.error("Error on preSearchAchievements", err);
|
||||
|
||||
@@ -38,7 +38,9 @@ export const getGameAchievementData = async (
|
||||
await gameAchievementsSublevel.put(levelKeys.game(shop, objectId), {
|
||||
unlockedAchievements: cachedAchievements?.unlockedAchievements ?? [],
|
||||
achievements,
|
||||
cacheExpiresTimestamp: Date.now() + 1000 * 60 * 30, // 30 minutes
|
||||
cacheExpiresTimestamp: achievements.length
|
||||
? Date.now() + 1000 * 60 * 30 // 30 minutes
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return achievements;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
AchievementNotificationInfo,
|
||||
Game,
|
||||
GameShop,
|
||||
UnlockedAchievement,
|
||||
@@ -12,6 +13,13 @@ import { publishNewAchievementNotification } from "../notifications";
|
||||
import { SubscriptionRequiredError } from "@shared";
|
||||
import { achievementsLogger } from "../logger";
|
||||
import { db, gameAchievementsSublevel, levelKeys } from "@main/level";
|
||||
import { getGameAchievementData } from "./get-game-achievement-data";
|
||||
|
||||
const isRareAchievement = (points: number) => {
|
||||
const rawPercentage = (50 - Math.sqrt(points)) * 2;
|
||||
|
||||
return rawPercentage < 10;
|
||||
};
|
||||
|
||||
const saveAchievementsOnLocal = async (
|
||||
objectId: string,
|
||||
@@ -48,12 +56,22 @@ export const mergeAchievements = async (
|
||||
achievements: UnlockedAchievement[],
|
||||
publishNotification: boolean
|
||||
) => {
|
||||
const [localGameAchievement, userPreferences] = await Promise.all([
|
||||
gameAchievementsSublevel.get(levelKeys.game(game.shop, game.objectId)),
|
||||
db.get<string, UserPreferences>(levelKeys.userPreferences, {
|
||||
let localGameAchievement = await gameAchievementsSublevel.get(
|
||||
levelKeys.game(game.shop, game.objectId)
|
||||
);
|
||||
const userPreferences = await db.get<string, UserPreferences>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}),
|
||||
]);
|
||||
}
|
||||
);
|
||||
|
||||
if (!localGameAchievement) {
|
||||
await getGameAchievementData(game.objectId, game.shop, true);
|
||||
localGameAchievement = await gameAchievementsSublevel.get(
|
||||
levelKeys.game(game.shop, game.objectId)
|
||||
);
|
||||
}
|
||||
|
||||
const achievementsData = localGameAchievement?.achievements ?? [];
|
||||
const unlockedAchievements = localGameAchievement?.unlockedAchievements ?? [];
|
||||
@@ -84,9 +102,9 @@ export const mergeAchievements = async (
|
||||
if (
|
||||
newAchievements.length &&
|
||||
publishNotification &&
|
||||
userPreferences?.achievementNotificationsEnabled
|
||||
userPreferences.achievementNotificationsEnabled !== false
|
||||
) {
|
||||
const achievementsInfo = newAchievements
|
||||
const filteredAchievements = newAchievements
|
||||
.toSorted((a, b) => {
|
||||
return a.unlockTime - b.unlockTime;
|
||||
})
|
||||
@@ -98,21 +116,41 @@ export const mergeAchievements = async (
|
||||
);
|
||||
});
|
||||
})
|
||||
.filter((achievement) => Boolean(achievement))
|
||||
.map((achievement) => {
|
||||
.filter((achievement) => !!achievement);
|
||||
|
||||
const achievementsInfo: AchievementNotificationInfo[] =
|
||||
filteredAchievements.map((achievement, index) => {
|
||||
return {
|
||||
displayName: achievement!.displayName,
|
||||
iconUrl: achievement!.icon,
|
||||
title: achievement.displayName,
|
||||
description: achievement.description,
|
||||
points: achievement.points,
|
||||
isHidden: achievement.hidden,
|
||||
isRare: achievement.points
|
||||
? isRareAchievement(achievement.points)
|
||||
: false,
|
||||
isPlatinum:
|
||||
index === filteredAchievements.length - 1 &&
|
||||
newAchievements.length + unlockedAchievements.length ===
|
||||
achievementsData.length,
|
||||
iconUrl: achievement.icon,
|
||||
};
|
||||
});
|
||||
|
||||
publishNewAchievementNotification({
|
||||
achievements: achievementsInfo,
|
||||
unlockedAchievementCount: mergedLocalAchievements.length,
|
||||
totalAchievementCount: achievementsData.length,
|
||||
gameTitle: game.title,
|
||||
gameIcon: game.iconUrl,
|
||||
});
|
||||
if (userPreferences.achievementCustomNotificationsEnabled !== false) {
|
||||
WindowManager.notificationWindow?.webContents.send(
|
||||
"on-achievement-unlocked",
|
||||
userPreferences.achievementCustomNotificationPosition ?? "top-left",
|
||||
achievementsInfo
|
||||
);
|
||||
} else {
|
||||
publishNewAchievementNotification({
|
||||
achievements: achievementsInfo,
|
||||
unlockedAchievementCount: mergedLocalAchievements.length,
|
||||
totalAchievementCount: achievementsData.length,
|
||||
gameTitle: game.title,
|
||||
gameIcon: game.iconUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (game.remoteId) {
|
||||
|
||||
@@ -7,8 +7,8 @@ export class Aria2 {
|
||||
|
||||
public static spawn() {
|
||||
const binaryPath = app.isPackaged
|
||||
? path.join(process.resourcesPath, "aria2", "aria2c")
|
||||
: path.join(__dirname, "..", "..", "aria2", "aria2c");
|
||||
? path.join(process.resourcesPath, "aria2c")
|
||||
: path.join(__dirname, "..", "..", "binaries", "aria2c");
|
||||
|
||||
this.process = cp.spawn(
|
||||
binaryPath,
|
||||
|
||||
@@ -7,7 +7,7 @@ import os from "node:os";
|
||||
import type { GameShop, User } from "@types";
|
||||
import { backupsPath } from "@main/constants";
|
||||
import { HydraApi } from "./hydra-api";
|
||||
import { normalizePath } from "@main/helpers";
|
||||
import { normalizePath, parseRegFile } from "@main/helpers";
|
||||
import { logger } from "./logger";
|
||||
import { WindowManager } from "./window-manager";
|
||||
import axios from "axios";
|
||||
@@ -17,6 +17,39 @@ import i18next, { t } from "i18next";
|
||||
import { SystemPath } from "./system-path";
|
||||
|
||||
export class CloudSync {
|
||||
public static getWindowsLikeUserProfilePath(winePrefixPath?: string | null) {
|
||||
if (process.platform === "linux") {
|
||||
if (!winePrefixPath) {
|
||||
throw new Error("Wine prefix path is required");
|
||||
}
|
||||
|
||||
const userReg = fs.readFileSync(
|
||||
path.join(winePrefixPath, "user.reg"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
const entries = parseRegFile(userReg);
|
||||
const volatileEnvironment = entries.find(
|
||||
(entry) => entry.path === "Volatile Environment"
|
||||
);
|
||||
|
||||
if (!volatileEnvironment) {
|
||||
throw new Error("Volatile environment not found in user.reg");
|
||||
}
|
||||
|
||||
const { values } = volatileEnvironment;
|
||||
const userProfile = String(values["USERPROFILE"]);
|
||||
|
||||
if (userProfile) {
|
||||
return normalizePath(userProfile);
|
||||
} else {
|
||||
throw new Error("User profile not found in user.reg");
|
||||
}
|
||||
}
|
||||
|
||||
return normalizePath(SystemPath.getPath("home"));
|
||||
}
|
||||
|
||||
public static getBackupLabel(automatic: boolean) {
|
||||
const language = i18next.language;
|
||||
|
||||
@@ -102,9 +135,12 @@ export class CloudSync {
|
||||
shop,
|
||||
objectId,
|
||||
hostname: os.hostname(),
|
||||
homeDir: normalizePath(SystemPath.getPath("home")),
|
||||
winePrefixPath: game?.winePrefixPath
|
||||
? fs.realpathSync(game.winePrefixPath)
|
||||
: null,
|
||||
homeDir: this.getWindowsLikeUserProfilePath(game?.winePrefixPath ?? null),
|
||||
downloadOptionTitle,
|
||||
platform: os.platform(),
|
||||
platform: process.platform,
|
||||
label,
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export class HydraApi {
|
||||
subscription: null,
|
||||
};
|
||||
|
||||
private static isLoggedIn() {
|
||||
public static isLoggedIn() {
|
||||
return this.userAuth.authToken !== "";
|
||||
}
|
||||
|
||||
|
||||
@@ -15,3 +15,4 @@ export * from "./aria2";
|
||||
export * from "./ws";
|
||||
export * from "./system-path";
|
||||
export * from "./library-sync";
|
||||
export * from "./wine";
|
||||
|
||||
@@ -15,7 +15,7 @@ export const uploadGamesBatch = async () => {
|
||||
);
|
||||
});
|
||||
|
||||
const gamesChunks = chunk(games, 50);
|
||||
const gamesChunks = chunk(games, 30);
|
||||
|
||||
for (const chunk of gamesChunks) {
|
||||
await HydraApi.post(
|
||||
@@ -33,7 +33,9 @@ export const uploadGamesBatch = async () => {
|
||||
|
||||
await mergeWithRemoteGames();
|
||||
|
||||
AchievementWatcherManager.preSearchAchievements();
|
||||
if (HydraApi.isLoggedIn()) {
|
||||
AchievementWatcherManager.preSearchAchievements();
|
||||
}
|
||||
|
||||
if (WindowManager.mainWindow)
|
||||
WindowManager.mainWindow.webContents.send("on-library-batch-complete");
|
||||
|
||||
@@ -1,70 +1,89 @@
|
||||
import type { GameShop, LudusaviBackup, LudusaviConfig } from "@types";
|
||||
import Piscina from "piscina";
|
||||
|
||||
import { app } from "electron";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import YAML from "yaml";
|
||||
|
||||
import ludusaviWorkerPath from "../workers/ludusavi.worker?modulePath";
|
||||
import { LUDUSAVI_MANIFEST_URL } from "@main/constants";
|
||||
import cp from "node:child_process";
|
||||
import { SystemPath } from "./system-path";
|
||||
|
||||
export class Ludusavi {
|
||||
private static ludusaviPath = path.join(
|
||||
SystemPath.getPath("appData"),
|
||||
private static ludusaviPath = app.isPackaged
|
||||
? path.join(process.resourcesPath, "ludusavi")
|
||||
: path.join(__dirname, "..", "..", "ludusavi");
|
||||
|
||||
private static binaryPath = path.join(this.ludusaviPath, "ludusavi");
|
||||
private static configPath = path.join(
|
||||
SystemPath.getPath("userData"),
|
||||
"ludusavi"
|
||||
);
|
||||
private static ludusaviConfigPath = path.join(
|
||||
this.ludusaviPath,
|
||||
"config.yaml"
|
||||
);
|
||||
private static binaryPath = app.isPackaged
|
||||
? path.join(process.resourcesPath, "ludusavi", "ludusavi")
|
||||
: path.join(__dirname, "..", "..", "ludusavi", "ludusavi");
|
||||
|
||||
private static worker = new Piscina({
|
||||
filename: ludusaviWorkerPath,
|
||||
workerData: {
|
||||
binaryPath: this.binaryPath,
|
||||
},
|
||||
maxThreads: 1,
|
||||
});
|
||||
|
||||
static async getConfig() {
|
||||
if (!fs.existsSync(this.ludusaviConfigPath)) {
|
||||
await this.worker.run(undefined, { name: "generateConfig" });
|
||||
}
|
||||
|
||||
public static async getConfig() {
|
||||
const config = YAML.parse(
|
||||
fs.readFileSync(this.ludusaviConfigPath, "utf-8")
|
||||
fs.readFileSync(path.join(this.ludusaviPath, "config.yaml"), "utf-8")
|
||||
) as LudusaviConfig;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static async backupGame(
|
||||
_shop: GameShop,
|
||||
objectId: string,
|
||||
backupPath: string,
|
||||
winePrefix?: string | null
|
||||
): Promise<LudusaviBackup> {
|
||||
return this.worker.run(
|
||||
{ title: objectId, backupPath, winePrefix },
|
||||
{ name: "backupGame" }
|
||||
);
|
||||
public static async copyConfigFileToUserData() {
|
||||
if (!fs.existsSync(this.configPath)) {
|
||||
fs.mkdirSync(this.configPath, { recursive: true });
|
||||
fs.cpSync(
|
||||
path.join(this.ludusaviPath, "config.yaml"),
|
||||
path.join(this.configPath, "config.yaml")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static async getBackupPreview(
|
||||
public static async backupGame(
|
||||
_shop: GameShop,
|
||||
objectId: string,
|
||||
backupPath?: string | null,
|
||||
winePrefix?: string | null,
|
||||
preview?: boolean
|
||||
): Promise<LudusaviBackup> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const args = [
|
||||
"--config",
|
||||
this.configPath,
|
||||
"backup",
|
||||
objectId,
|
||||
"--api",
|
||||
"--force",
|
||||
];
|
||||
|
||||
if (preview) args.push("--preview");
|
||||
if (backupPath) args.push("--path", backupPath);
|
||||
if (winePrefix) args.push("--wine-prefix", winePrefix);
|
||||
|
||||
cp.execFile(
|
||||
this.binaryPath,
|
||||
args,
|
||||
(err: cp.ExecFileException | null, stdout: string) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve(JSON.parse(stdout) as LudusaviBackup);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public static async getBackupPreview(
|
||||
_shop: GameShop,
|
||||
objectId: string,
|
||||
winePrefix?: string | null
|
||||
): Promise<LudusaviBackup | null> {
|
||||
const config = await this.getConfig();
|
||||
|
||||
const backupData = await this.worker.run(
|
||||
{ title: objectId, winePrefix, preview: true },
|
||||
{ name: "backupGame" }
|
||||
const backupData = await this.backupGame(
|
||||
_shop,
|
||||
objectId,
|
||||
null,
|
||||
winePrefix,
|
||||
true
|
||||
);
|
||||
|
||||
const customGame = config.customGames.find(
|
||||
@@ -77,19 +96,6 @@ export class Ludusavi {
|
||||
};
|
||||
}
|
||||
|
||||
static async restoreBackup(backupPath: string) {
|
||||
return this.worker.run(backupPath, { name: "restoreBackup" });
|
||||
}
|
||||
|
||||
static async addManifestToLudusaviConfig() {
|
||||
const config = await this.getConfig();
|
||||
|
||||
config.manifest.enable = false;
|
||||
config.manifest.secondary = [{ url: LUDUSAVI_MANIFEST_URL, enable: true }];
|
||||
|
||||
fs.writeFileSync(this.ludusaviConfigPath, YAML.stringify(config));
|
||||
}
|
||||
|
||||
static async addCustomGame(title: string, savePath: string | null) {
|
||||
const config = await this.getConfig();
|
||||
const filteredGames = config.customGames.filter(
|
||||
@@ -105,6 +111,10 @@ export class Ludusavi {
|
||||
}
|
||||
|
||||
config.customGames = filteredGames;
|
||||
fs.writeFileSync(this.ludusaviConfigPath, YAML.stringify(config));
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(this.configPath, "config.yaml"),
|
||||
YAML.stringify(config)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export const publishExtractionCompleteNotification = async (game: Game) => {
|
||||
};
|
||||
|
||||
export const publishNewAchievementNotification = async (info: {
|
||||
achievements: { displayName: string; iconUrl: string }[];
|
||||
achievements: { title: string; iconUrl: string }[];
|
||||
unlockedAchievementCount: number;
|
||||
totalAchievementCount: number;
|
||||
gameTitle: string;
|
||||
@@ -176,12 +176,12 @@ export const publishNewAchievementNotification = async (info: {
|
||||
gameTitle: info.gameTitle,
|
||||
achievementCount: info.achievements.length,
|
||||
}),
|
||||
body: info.achievements.map((a) => a.displayName).join(", "),
|
||||
body: info.achievements.map((a) => a.title).join(", "),
|
||||
icon: (await downloadImage(info.gameIcon)) ?? icon,
|
||||
}
|
||||
: {
|
||||
title: t("achievement_unlocked", { ns: "achievement" }),
|
||||
body: info.achievements[0].displayName,
|
||||
body: info.achievements[0].title,
|
||||
icon: (await downloadImage(info.achievements[0].iconUrl)) ?? icon,
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import crypto from "node:crypto";
|
||||
|
||||
import { pythonRpcLogger } from "./logger";
|
||||
import { Readable } from "node:stream";
|
||||
import { app, dialog, safeStorage } from "electron";
|
||||
import { app, dialog } from "electron";
|
||||
import { db, levelKeys } from "@main/level";
|
||||
|
||||
interface GamePayload {
|
||||
@@ -22,12 +22,6 @@ const binaryNameByPlatform: Partial<Record<NodeJS.Platform, string>> = {
|
||||
win32: "hydra-python-rpc.exe",
|
||||
};
|
||||
|
||||
const rustBinaryNameByPlatform: Partial<Record<NodeJS.Platform, string>> = {
|
||||
darwin: "hydra-httpdl",
|
||||
linux: "hydra-httpdl",
|
||||
win32: "hydra-httpdl.exe",
|
||||
};
|
||||
|
||||
export class PythonRPC {
|
||||
public static readonly BITTORRENT_PORT = "5881";
|
||||
public static readonly RPC_PORT = "8084";
|
||||
@@ -49,18 +43,13 @@ export class PythonRPC {
|
||||
valueEncoding: "utf8",
|
||||
});
|
||||
|
||||
if (existingPassword)
|
||||
return safeStorage.decryptString(Buffer.from(existingPassword, "hex"));
|
||||
if (existingPassword) return existingPassword;
|
||||
|
||||
const newPassword = crypto.randomBytes(32).toString("hex");
|
||||
|
||||
await db.put(
|
||||
levelKeys.rpcPassword,
|
||||
safeStorage.encryptString(newPassword).toString("hex"),
|
||||
{
|
||||
valueEncoding: "utf8",
|
||||
}
|
||||
);
|
||||
await db.put(levelKeys.rpcPassword, newPassword, {
|
||||
valueEncoding: "utf8",
|
||||
});
|
||||
|
||||
return newPassword;
|
||||
}
|
||||
@@ -77,20 +66,6 @@ export class PythonRPC {
|
||||
rpcPassword,
|
||||
initialDownload ? JSON.stringify(initialDownload) : "",
|
||||
initialSeeding ? JSON.stringify(initialSeeding) : "",
|
||||
app.isPackaged
|
||||
? path.join(
|
||||
process.resourcesPath,
|
||||
rustBinaryNameByPlatform[process.platform]!
|
||||
)
|
||||
: path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"rust_rpc",
|
||||
"target",
|
||||
"debug",
|
||||
rustBinaryNameByPlatform[process.platform]!
|
||||
),
|
||||
];
|
||||
|
||||
if (app.isPackaged) {
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import axios from "axios";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { crc32 } from "crc";
|
||||
import WinReg from "winreg";
|
||||
import { parseBuffer, writeBuffer } from "steam-shortcut-editor";
|
||||
|
||||
import type { SteamAppDetails } from "@types";
|
||||
import type { SteamAppDetails, SteamShortcut } from "@types";
|
||||
|
||||
import { logger } from "./logger";
|
||||
import { SystemPath } from "./system-path";
|
||||
|
||||
export interface SteamAppDetailsResponse {
|
||||
[key: string]: {
|
||||
@@ -11,6 +17,36 @@ export interface SteamAppDetailsResponse {
|
||||
};
|
||||
}
|
||||
|
||||
export const getSteamLocation = async () => {
|
||||
if (process.platform === "linux") {
|
||||
return path.join(SystemPath.getPath("home"), ".local", "share", "Steam");
|
||||
}
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
return path.join(
|
||||
SystemPath.getPath("home"),
|
||||
"Library",
|
||||
"Application Support",
|
||||
"Steam"
|
||||
);
|
||||
}
|
||||
|
||||
const regKey = new WinReg({
|
||||
hive: WinReg.HKCU,
|
||||
key: "\\Software\\Valve\\Steam",
|
||||
});
|
||||
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
regKey.get("SteamPath", (err, value) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
resolve(value.value);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const getSteamAppDetails = async (
|
||||
objectId: string,
|
||||
language: string
|
||||
@@ -40,3 +76,86 @@ export const getSteamAppDetails = async (
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
export const getSteamUsersIds = async () => {
|
||||
const userDataPath = await getSteamLocation();
|
||||
|
||||
const userIds = fs.readdirSync(path.join(userDataPath, "userdata"), {
|
||||
withFileTypes: true,
|
||||
});
|
||||
|
||||
return userIds
|
||||
.filter((dir) => dir.isDirectory())
|
||||
.map((dir) => Number(dir.name));
|
||||
};
|
||||
|
||||
export const getSteamShortcuts = async (steamUserId: number) => {
|
||||
const shortcutsPath = path.join(
|
||||
await getSteamLocation(),
|
||||
"userdata",
|
||||
steamUserId.toString(),
|
||||
"config",
|
||||
"shortcuts.vdf"
|
||||
);
|
||||
|
||||
if (!fs.existsSync(shortcutsPath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const shortcuts = parseBuffer(fs.readFileSync(shortcutsPath));
|
||||
|
||||
return shortcuts.shortcuts as SteamShortcut[];
|
||||
};
|
||||
|
||||
export const generateSteamShortcutAppId = (
|
||||
exePath: string,
|
||||
gameName: string
|
||||
) => {
|
||||
const input = exePath + gameName;
|
||||
const crcValue = crc32(input) >>> 0;
|
||||
const steamAppId = (crcValue | 0x80000000) >>> 0;
|
||||
return steamAppId;
|
||||
};
|
||||
|
||||
export const composeSteamShortcut = (
|
||||
title: string,
|
||||
executablePath: string,
|
||||
iconPath: string | null
|
||||
): SteamShortcut => {
|
||||
return {
|
||||
appid: generateSteamShortcutAppId(executablePath, title),
|
||||
appname: title,
|
||||
Exe: `"${executablePath}"`,
|
||||
StartDir: `"${path.dirname(executablePath)}"`,
|
||||
icon: iconPath ?? "",
|
||||
ShortcutPath: "",
|
||||
LaunchOptions: "",
|
||||
IsHidden: false,
|
||||
AllowDesktopConfig: true,
|
||||
AllowOverlay: true,
|
||||
OpenVR: false,
|
||||
Devkit: false,
|
||||
DevkitGameID: "",
|
||||
DevkitOverrideAppID: false,
|
||||
LastPlayTime: 0,
|
||||
FlatpakAppID: "",
|
||||
};
|
||||
};
|
||||
|
||||
export const writeSteamShortcuts = async (
|
||||
steamUserId: number,
|
||||
shortcuts: SteamShortcut[]
|
||||
) => {
|
||||
const buffer = writeBuffer({ shortcuts });
|
||||
|
||||
return fs.promises.writeFile(
|
||||
path.join(
|
||||
await getSteamLocation(),
|
||||
"userdata",
|
||||
steamUserId.toString(),
|
||||
"config",
|
||||
"shortcuts.vdf"
|
||||
),
|
||||
buffer
|
||||
);
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export class SystemPath {
|
||||
try {
|
||||
return app.getPath(pathName);
|
||||
} catch (error) {
|
||||
logger.error(`Error getting path: ${error}`);
|
||||
console.error(`Error getting path: ${error}`);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
Tray,
|
||||
app,
|
||||
nativeImage,
|
||||
screen,
|
||||
shell,
|
||||
} from "electron";
|
||||
import { is } from "@electron-toolkit/utils";
|
||||
@@ -17,12 +18,17 @@ import { HydraApi } from "./hydra-api";
|
||||
import UserAgent from "user-agents";
|
||||
import { db, gamesSublevel, levelKeys } from "@main/level";
|
||||
import { orderBy, slice } from "lodash-es";
|
||||
import type { ScreenState, UserPreferences } from "@types";
|
||||
import { AuthPage } from "@shared";
|
||||
import type {
|
||||
AchievementCustomNotificationPosition,
|
||||
ScreenState,
|
||||
UserPreferences,
|
||||
} from "@types";
|
||||
import { AuthPage, generateAchievementCustomNotificationTest } from "@shared";
|
||||
import { isStaging } from "@main/constants";
|
||||
|
||||
export class WindowManager {
|
||||
public static mainWindow: Electron.BrowserWindow | null = null;
|
||||
public static notificationWindow: Electron.BrowserWindow | null = null;
|
||||
|
||||
private static readonly editorWindows: Map<string, BrowserWindow> = new Map();
|
||||
|
||||
@@ -259,6 +265,141 @@ export class WindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static loadNotificationWindowURL() {
|
||||
if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
|
||||
this.notificationWindow?.loadURL(
|
||||
`${process.env["ELECTRON_RENDERER_URL"]}#/achievement-notification`
|
||||
);
|
||||
} else {
|
||||
this.notificationWindow?.loadFile(
|
||||
path.join(__dirname, "../renderer/index.html"),
|
||||
{
|
||||
hash: "achievement-notification",
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly NOTIFICATION_WINDOW_WIDTH = 360;
|
||||
private static readonly NOTIFICATION_WINDOW_HEIGHT = 140;
|
||||
|
||||
private static async getNotificationWindowPosition(
|
||||
position: AchievementCustomNotificationPosition | undefined
|
||||
) {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
const { width, height } = display.workAreaSize;
|
||||
|
||||
if (position === "bottom-center") {
|
||||
return {
|
||||
x: (width - this.NOTIFICATION_WINDOW_WIDTH) / 2,
|
||||
y: height - this.NOTIFICATION_WINDOW_HEIGHT,
|
||||
};
|
||||
}
|
||||
|
||||
if (position === "bottom-right") {
|
||||
return {
|
||||
x: width - this.NOTIFICATION_WINDOW_WIDTH,
|
||||
y: height - this.NOTIFICATION_WINDOW_HEIGHT,
|
||||
};
|
||||
}
|
||||
|
||||
if (position === "top-center") {
|
||||
return {
|
||||
x: (width - this.NOTIFICATION_WINDOW_WIDTH) / 2,
|
||||
y: 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (position === "bottom-left") {
|
||||
return {
|
||||
x: 0,
|
||||
y: height - this.NOTIFICATION_WINDOW_HEIGHT,
|
||||
};
|
||||
}
|
||||
|
||||
if (position === "top-right") {
|
||||
return {
|
||||
x: width - this.NOTIFICATION_WINDOW_WIDTH,
|
||||
y: 0,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
}
|
||||
|
||||
public static async createNotificationWindow() {
|
||||
if (this.notificationWindow) return;
|
||||
|
||||
const userPreferences = await db.get<string, UserPreferences | undefined>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
|
||||
if (
|
||||
userPreferences?.achievementNotificationsEnabled === false ||
|
||||
userPreferences?.achievementCustomNotificationsEnabled === false
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { x, y } = await this.getNotificationWindowPosition(
|
||||
userPreferences?.achievementCustomNotificationPosition
|
||||
);
|
||||
|
||||
this.notificationWindow = new BrowserWindow({
|
||||
transparent: true,
|
||||
maximizable: false,
|
||||
autoHideMenuBar: true,
|
||||
minimizable: false,
|
||||
focusable: false,
|
||||
skipTaskbar: true,
|
||||
frame: false,
|
||||
width: this.NOTIFICATION_WINDOW_WIDTH,
|
||||
height: this.NOTIFICATION_WINDOW_HEIGHT,
|
||||
x,
|
||||
y,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "../preload/index.mjs"),
|
||||
sandbox: false,
|
||||
},
|
||||
});
|
||||
this.notificationWindow.setIgnoreMouseEvents(true);
|
||||
// this.notificationWindow.setVisibleOnAllWorkspaces(true, {
|
||||
// visibleOnFullScreen: true,
|
||||
// });
|
||||
this.notificationWindow.setAlwaysOnTop(true, "screen-saver", 1);
|
||||
this.loadNotificationWindowURL();
|
||||
}
|
||||
|
||||
public static async showAchievementTestNotification() {
|
||||
const userPreferences = await db.get<string, UserPreferences>(
|
||||
levelKeys.userPreferences,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
|
||||
const language = userPreferences.language ?? "en";
|
||||
|
||||
this.notificationWindow?.webContents.send(
|
||||
"on-achievement-unlocked",
|
||||
userPreferences.achievementCustomNotificationPosition ?? "top-left",
|
||||
[generateAchievementCustomNotificationTest(t, language)]
|
||||
);
|
||||
}
|
||||
|
||||
public static async closeNotificationWindow() {
|
||||
if (this.notificationWindow) {
|
||||
this.notificationWindow.close();
|
||||
this.notificationWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static openEditorWindow(themeId: string) {
|
||||
if (this.mainWindow) {
|
||||
const existingWindow = this.editorWindows.get(themeId);
|
||||
@@ -271,13 +412,13 @@ export class WindowManager {
|
||||
}
|
||||
|
||||
const editorWindow = new BrowserWindow({
|
||||
width: 600,
|
||||
width: 720,
|
||||
height: 720,
|
||||
minWidth: 600,
|
||||
minHeight: 540,
|
||||
backgroundColor: "#1c1c1c",
|
||||
titleBarStyle: process.platform === "linux" ? "default" : "hidden",
|
||||
...(process.platform === "linux" ? { icon } : {}),
|
||||
icon,
|
||||
trafficLightPosition: { x: 16, y: 16 },
|
||||
titleBarOverlay: {
|
||||
symbolColor: "#DADBE1",
|
||||
|
||||
30
src/main/services/wine.ts
Normal file
30
src/main/services/wine.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
export class Wine {
|
||||
public static validatePrefix(winePrefixPath: string) {
|
||||
const requiredFiles = [
|
||||
{ name: "system.reg", type: "file" },
|
||||
{ name: "user.reg", type: "file" },
|
||||
{ name: "userdef.reg", type: "file" },
|
||||
{ name: "dosdevices", type: "dir" },
|
||||
{ name: "drive_c", type: "dir" },
|
||||
];
|
||||
|
||||
for (const file of requiredFiles) {
|
||||
const filePath = path.join(winePrefixPath, file.name);
|
||||
|
||||
if (file.type === "file" && !fs.existsSync(filePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.type === "dir") {
|
||||
if (!fs.existsSync(filePath) || !fs.lstatSync(filePath).isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
import type { LudusaviBackup } from "@types";
|
||||
import cp from "node:child_process";
|
||||
|
||||
import { workerData } from "node:worker_threads";
|
||||
|
||||
const { binaryPath } = workerData;
|
||||
|
||||
export const backupGame = ({
|
||||
title,
|
||||
backupPath,
|
||||
preview = false,
|
||||
winePrefix,
|
||||
}: {
|
||||
title: string;
|
||||
backupPath: string;
|
||||
preview?: boolean;
|
||||
winePrefix?: string;
|
||||
}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const args = ["backup", title, "--api", "--force"];
|
||||
|
||||
if (preview) args.push("--preview");
|
||||
if (backupPath) args.push("--path", backupPath);
|
||||
if (winePrefix) args.push("--wine-prefix", winePrefix);
|
||||
|
||||
cp.execFile(
|
||||
binaryPath,
|
||||
args,
|
||||
(err: cp.ExecFileException | null, stdout: string) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve(JSON.parse(stdout) as LudusaviBackup);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const restoreBackup = (backupPath: string) => {
|
||||
const result = cp.execFileSync(binaryPath, [
|
||||
"restore",
|
||||
"--path",
|
||||
backupPath,
|
||||
"--api",
|
||||
"--force",
|
||||
]);
|
||||
|
||||
return JSON.parse(result.toString("utf-8")) as LudusaviBackup;
|
||||
};
|
||||
|
||||
export const generateConfig = () => {
|
||||
const result = cp.execFileSync(binaryPath, ["schema", "config"]);
|
||||
|
||||
return JSON.parse(result.toString("utf-8")) as LudusaviBackup;
|
||||
};
|
||||
@@ -18,6 +18,8 @@ import type {
|
||||
FriendRequestSync,
|
||||
ShortcutLocation,
|
||||
ShopAssets,
|
||||
AchievementCustomNotificationPosition,
|
||||
AchievementNotificationInfo,
|
||||
} from "@types";
|
||||
import type { AuthPage, CatalogueCategory } from "@shared";
|
||||
import type { AxiosProgressEvent } from "axios";
|
||||
@@ -189,6 +191,10 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
ipcRenderer.invoke("resetGameAchievements", shop, objectId),
|
||||
extractGameDownload: (shop: GameShop, objectId: string) =>
|
||||
ipcRenderer.invoke("extractGameDownload", shop, objectId),
|
||||
getDefaultWinePrefixSelectionPath: () =>
|
||||
ipcRenderer.invoke("getDefaultWinePrefixSelectionPath"),
|
||||
createSteamShortcut: (shop: GameShop, objectId: string) =>
|
||||
ipcRenderer.invoke("createSteamShortcut", shop, objectId),
|
||||
onGamesRunning: (
|
||||
cb: (
|
||||
gamesRunning: Pick<GameRunning, "id" | "sessionDurationInMillis">[]
|
||||
@@ -205,12 +211,6 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-library-batch-complete", listener);
|
||||
},
|
||||
onAchievementUnlocked: (cb: () => void) => {
|
||||
const listener = (_event: Electron.IpcRendererEvent) => cb();
|
||||
ipcRenderer.on("on-achievement-unlocked", listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-achievement-unlocked", listener);
|
||||
},
|
||||
onExtractionComplete: (cb: (shop: GameShop, objectId: string) => void) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
@@ -408,6 +408,42 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
/* Notifications */
|
||||
publishNewRepacksNotification: (newRepacksCount: number) =>
|
||||
ipcRenderer.invoke("publishNewRepacksNotification", newRepacksCount),
|
||||
onAchievementUnlocked: (
|
||||
cb: (
|
||||
position?: AchievementCustomNotificationPosition,
|
||||
achievements?: AchievementNotificationInfo[]
|
||||
) => void
|
||||
) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
position?: AchievementCustomNotificationPosition,
|
||||
achievements?: AchievementNotificationInfo[]
|
||||
) => cb(position, achievements);
|
||||
ipcRenderer.on("on-achievement-unlocked", listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-achievement-unlocked", listener);
|
||||
},
|
||||
onCombinedAchievementsUnlocked: (
|
||||
cb: (
|
||||
gameCount: number,
|
||||
achievementsCount: number,
|
||||
position: AchievementCustomNotificationPosition
|
||||
) => void
|
||||
) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
gameCount: number,
|
||||
achievementCount: number,
|
||||
position: AchievementCustomNotificationPosition
|
||||
) => cb(gameCount, achievementCount, position);
|
||||
ipcRenderer.on("on-combined-achievements-unlocked", listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-combined-achievements-unlocked", listener);
|
||||
},
|
||||
updateAchievementCustomNotificationWindow: () =>
|
||||
ipcRenderer.invoke("updateAchievementCustomNotificationWindow"),
|
||||
showAchievementTestNotification: () =>
|
||||
ipcRenderer.invoke("showAchievementTestNotification"),
|
||||
|
||||
/* Themes */
|
||||
addCustomTheme: (theme: Theme) => ipcRenderer.invoke("addCustomTheme", theme),
|
||||
|
||||
BIN
src/renderer/src/assets/icons/ellipses.png
Normal file
BIN
src/renderer/src/assets/icons/ellipses.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
5
src/renderer/src/assets/icons/trophy.svg
Normal file
5
src/renderer/src/assets/icons/trophy.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Frame 933">
|
||||
<path id="Vector" d="M29.3333 10.5H26.8333V8.83333C26.8333 8.61232 26.7455 8.40036 26.5893 8.24408C26.433 8.0878 26.221 8 26 8H11C10.779 8 10.567 8.0878 10.4107 8.24408C10.2545 8.40036 10.1667 8.61232 10.1667 8.83333V10.5H7.66667C7.22464 10.5 6.80072 10.6756 6.48816 10.9882C6.17559 11.3007 6 11.7246 6 12.1667V13.8333C6 14.9384 6.43899 15.9982 7.22039 16.7796C7.6073 17.1665 8.06663 17.4734 8.57215 17.6828C9.07768 17.8922 9.61949 18 10.1667 18H10.5469C11.0378 19.5556 11.9737 20.9333 13.2391 21.9628C14.5044 22.9923 16.0437 23.6285 17.6667 23.7927V26.3333H15.1667C14.9457 26.3333 14.7337 26.4211 14.5774 26.5774C14.4211 26.7337 14.3333 26.9457 14.3333 27.1667C14.3333 27.3877 14.4211 27.5996 14.5774 27.7559C14.7337 27.9122 14.9457 28 15.1667 28H21.8333C22.0543 28 22.2663 27.9122 22.4226 27.7559C22.5789 27.5996 22.6667 27.3877 22.6667 27.1667C22.6667 26.9457 22.5789 26.7337 22.4226 26.5774C22.2663 26.4211 22.0543 26.3333 21.8333 26.3333H19.3333V23.7896C22.6604 23.4531 25.4208 21.1187 26.425 18H26.8333C27.9384 18 28.9982 17.561 29.7796 16.7796C30.561 15.9982 31 14.9384 31 13.8333V12.1667C31 11.7246 30.8244 11.3007 30.5118 10.9882C30.1993 10.6756 29.7754 10.5 29.3333 10.5ZM10.1667 16.3333C9.50363 16.3333 8.86774 16.0699 8.3989 15.6011C7.93006 15.1323 7.66667 14.4964 7.66667 13.8333V12.1667H10.1667V15.5C10.1667 15.7778 10.1802 16.0556 10.2073 16.3333H10.1667ZM29.3333 13.8333C29.3333 14.4964 29.0699 15.1323 28.6011 15.6011C28.1323 16.0699 27.4964 16.3333 26.8333 16.3333H26.7812C26.8154 16.0255 26.8328 15.716 26.8333 15.4062V12.1667H29.3333V13.8333Z" fill="white"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,519 @@
|
||||
@use "../../../scss/globals.scss";
|
||||
|
||||
$margin-horizontal: 40px;
|
||||
$margin-top: 52px;
|
||||
$margin-bottom: 28px;
|
||||
|
||||
@keyframes content-in {
|
||||
0% {
|
||||
width: 80px;
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
}
|
||||
100% {
|
||||
width: 80px;
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes content-wait {
|
||||
0% {
|
||||
width: 80px;
|
||||
}
|
||||
100% {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes trophy-out {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes ellipses-stand-by {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes ellipses-out {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
scale: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes content-expand {
|
||||
0% {
|
||||
width: 80px;
|
||||
}
|
||||
100% {
|
||||
width: calc(360px - $margin-horizontal);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes chip-stand-by {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes chip-in {
|
||||
0% {
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes title-in {
|
||||
0% {
|
||||
transform: translateY(10px);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes description-in {
|
||||
0% {
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dark-overlay {
|
||||
0% {
|
||||
opacity: 0.7;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.7;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes content-out {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-20px);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shine {
|
||||
from {
|
||||
transform: translateX(0px) rotate(36deg);
|
||||
}
|
||||
to {
|
||||
transform: translateX(420px) rotate(36deg);
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-notification {
|
||||
width: 360px;
|
||||
height: 192px;
|
||||
display: flex;
|
||||
|
||||
&--top-left {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
&--top-center {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
&--top-right {
|
||||
justify-content: end;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
&--bottom-left {
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
&--bottom-center {
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
&--bottom-right {
|
||||
justify-content: end;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
&__outer-container {
|
||||
position: relative;
|
||||
display: grid;
|
||||
width: calc(360px - $margin-horizontal);
|
||||
overflow: clip;
|
||||
border: 1px solid #ffffff1a;
|
||||
animation:
|
||||
content-in 450ms ease-in-out,
|
||||
content-wait 450ms ease-in-out 450ms,
|
||||
content-expand 450ms ease-in-out 900ms;
|
||||
box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
&--top-left &__outer-container {
|
||||
margin: $margin-top 0 0 $margin-horizontal;
|
||||
}
|
||||
|
||||
&--top-center &__outer-container {
|
||||
margin: $margin-top 0 0 $margin-horizontal;
|
||||
}
|
||||
|
||||
&--top-right &__outer-container {
|
||||
margin: $margin-top $margin-horizontal 0 0;
|
||||
}
|
||||
|
||||
&--bottom-left &__outer-container {
|
||||
margin: 0 0 $margin-bottom $margin-horizontal;
|
||||
}
|
||||
|
||||
&--bottom-center &__outer-container {
|
||||
margin: 0 0 $margin-bottom $margin-horizontal;
|
||||
}
|
||||
|
||||
&--bottom-right &__outer-container {
|
||||
margin: 0 $margin-horizontal $margin-bottom 0;
|
||||
}
|
||||
|
||||
&--closing .achievement-notification__outer-container {
|
||||
animation: content-out 450ms ease-in-out;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
&__container {
|
||||
width: calc(360px - $margin-horizontal);
|
||||
display: flex;
|
||||
padding: 8px 16px 8px 8px;
|
||||
background: globals.$background-color;
|
||||
}
|
||||
|
||||
&--platinum &__container {
|
||||
background: linear-gradient(94deg, #1c1c1c -25%, #044838 100%);
|
||||
}
|
||||
|
||||
&--rare &__container {
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -60px;
|
||||
width: 29px;
|
||||
height: 134px;
|
||||
transform: translateX(0px) rotate(36deg);
|
||||
opacity: 0.2;
|
||||
background: #d9d9d9;
|
||||
filter: blur(8px);
|
||||
animation: shine 450ms ease-in-out 1350ms;
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
box-sizing: border-box;
|
||||
min-width: 64px;
|
||||
min-height: 64px;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&--rare &__icon {
|
||||
outline: 1px solid #f4a510;
|
||||
box-shadow: 0px 0px 12px 0px rgba(244, 165, 16, 0.25);
|
||||
}
|
||||
|
||||
&--platinum &__icon {
|
||||
outline: 1px solid #0cf1ca;
|
||||
box-shadow: 0px 0px 12px 0px rgba(12, 241, 202, 0.25);
|
||||
}
|
||||
|
||||
&__additional-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
&__dark-overlay {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 8px;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: #000;
|
||||
opacity: 0;
|
||||
z-index: 1;
|
||||
animation: dark-overlay 900ms ease-in-out;
|
||||
}
|
||||
|
||||
&__trophy-overlay {
|
||||
position: absolute;
|
||||
mask-image: url("/src/assets/icons/trophy.svg");
|
||||
top: 22px;
|
||||
left: 22px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
opacity: 0;
|
||||
z-index: 1;
|
||||
animation: trophy-out 900ms ease-in-out;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
&--rare &__trophy-overlay {
|
||||
background: linear-gradient(
|
||||
118deg,
|
||||
#e8ad15 18.96%,
|
||||
#d5900f 26.41%,
|
||||
#e8ad15 29.99%,
|
||||
#e4aa15 38.89%,
|
||||
#ca890e 42.43%,
|
||||
#ca880e 46.59%,
|
||||
#ecbe1a 50.08%,
|
||||
#ecbd1a 53.48%,
|
||||
#b3790d 57.39%,
|
||||
#66470a 75.64%,
|
||||
#a37a13 78.2%,
|
||||
#987112 79.28%,
|
||||
#503808 83.6%,
|
||||
#3e2d08 85.77%
|
||||
),
|
||||
#fff;
|
||||
}
|
||||
|
||||
&--platinum &__trophy-overlay {
|
||||
background: linear-gradient(
|
||||
118deg,
|
||||
#15e8d6 18.96%,
|
||||
#0fd5a7 26.41%,
|
||||
#15e8b7 29.99%,
|
||||
#15e4b4 38.89%,
|
||||
#0eca7f 42.43%,
|
||||
#0eca9e 46.59%,
|
||||
#1aecbb 50.08%,
|
||||
#1aecb0 53.48%,
|
||||
#0db392 57.39%,
|
||||
#0a6648 75.64%,
|
||||
#13a38b 78.2%,
|
||||
#129862 79.28%,
|
||||
#085042 83.6%,
|
||||
#083e31 85.77%
|
||||
);
|
||||
}
|
||||
|
||||
&__ellipses-overlay {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 8px;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
animation: ellipses-out 900ms ease-in-out;
|
||||
}
|
||||
|
||||
&__text-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: globals.$muted-color;
|
||||
animation: title-in 450ms ease-in-out 900ms;
|
||||
}
|
||||
|
||||
&__hidden-icon {
|
||||
margin-right: 4px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&__description {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2; /* number of lines to show */
|
||||
line-clamp: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
color: globals.$body-color;
|
||||
animation: description-in 450ms ease-in-out 900ms;
|
||||
}
|
||||
|
||||
&--closing &__chip {
|
||||
animation: content-out 450ms ease-in-out;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
&__chip {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 300px;
|
||||
align-items: center;
|
||||
background: globals.$muted-color;
|
||||
height: 24px;
|
||||
animation:
|
||||
chip-stand-by 900ms ease-in-out,
|
||||
chip-in 450ms ease-in-out 900ms;
|
||||
z-index: 2;
|
||||
|
||||
&__icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
path {
|
||||
fill: globals.$background-color;
|
||||
}
|
||||
}
|
||||
|
||||
&__label {
|
||||
color: globals.$background-color;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
&--top-left &__chip {
|
||||
top: -12px;
|
||||
margin: $margin-top 0 0 $margin-horizontal;
|
||||
}
|
||||
|
||||
&--top-center &__chip {
|
||||
top: -12px;
|
||||
margin: $margin-top 0 0 $margin-horizontal;
|
||||
}
|
||||
|
||||
&--top-right &__chip {
|
||||
top: -12px;
|
||||
margin: $margin-top $margin-horizontal 0 0;
|
||||
}
|
||||
|
||||
&--bottom-left &__chip {
|
||||
bottom: 70px;
|
||||
margin: 0 0 $margin-bottom $margin-horizontal;
|
||||
}
|
||||
|
||||
&--bottom-center &__chip {
|
||||
bottom: 70px;
|
||||
margin: 0 0 $margin-bottom $margin-horizontal;
|
||||
}
|
||||
|
||||
&--bottom-right &__chip {
|
||||
bottom: 70px;
|
||||
margin: 0 $margin-horizontal $margin-bottom 0;
|
||||
}
|
||||
|
||||
&--rare &__chip {
|
||||
background: linear-gradient(
|
||||
160deg,
|
||||
#e8ad15 18.96%,
|
||||
#d5900f 26.41%,
|
||||
#e8ad15 29.99%,
|
||||
#e4aa15 38.89%,
|
||||
#ca890e 42.43%,
|
||||
#ca880e 46.59%,
|
||||
#ecbe1a 50.08%,
|
||||
#ecbd1a 53.48%,
|
||||
#b3790d 57.39%,
|
||||
#66470a 75.64%,
|
||||
#a37a13 78.2%,
|
||||
#987112 79.28%,
|
||||
#503808 83.6%,
|
||||
#3e2d08 85.77%
|
||||
);
|
||||
&__icon {
|
||||
path {
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
&__label {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&--platinum &__chip {
|
||||
background: linear-gradient(
|
||||
118deg,
|
||||
#15e8d6 18.96%,
|
||||
#0fd5a7 26.41%,
|
||||
#15e8b7 29.99%,
|
||||
#15e4b4 38.89%,
|
||||
#0eca7f 42.43%,
|
||||
#0eca9e 46.59%,
|
||||
#1aecbb 50.08%,
|
||||
#1aecb0 53.48%,
|
||||
#0db392 57.39%,
|
||||
#0a6648 75.64%,
|
||||
#13a38b 78.2%,
|
||||
#129862 79.28%,
|
||||
#085042 83.6%,
|
||||
#083e31 85.77%
|
||||
);
|
||||
&__icon {
|
||||
path {
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
&__label {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&--closing * {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
&--closing *::before,
|
||||
&--closing *::after {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import {
|
||||
AchievementCustomNotificationPosition,
|
||||
AchievementNotificationInfo,
|
||||
} from "@types";
|
||||
import cn from "classnames";
|
||||
import "./achievement-notification.scss";
|
||||
import HydraIcon from "@renderer/assets/icons/hydra.svg?react";
|
||||
import { EyeClosedIcon } from "@primer/octicons-react";
|
||||
import Ellipses from "@renderer/assets/icons/ellipses.png";
|
||||
|
||||
interface AchievementNotificationProps {
|
||||
position: AchievementCustomNotificationPosition;
|
||||
achievement: AchievementNotificationInfo;
|
||||
isClosing: boolean;
|
||||
}
|
||||
|
||||
export function AchievementNotificationItem({
|
||||
position,
|
||||
achievement,
|
||||
isClosing,
|
||||
}: Readonly<AchievementNotificationProps>) {
|
||||
const baseClassName = "achievement-notification";
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn("achievement-notification", {
|
||||
[`${baseClassName}--${position}`]: true,
|
||||
[`${baseClassName}--closing`]: isClosing,
|
||||
[`${baseClassName}--hidden`]: achievement.isHidden,
|
||||
[`${baseClassName}--rare`]: achievement.isRare,
|
||||
[`${baseClassName}--platinum`]: achievement.isPlatinum,
|
||||
})}
|
||||
>
|
||||
{achievement.points && (
|
||||
<div className="achievement-notification__chip">
|
||||
<HydraIcon className="achievement-notification__chip__icon" />
|
||||
<span className="achievement-notification__chip__label">
|
||||
+{achievement.points}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="achievement-notification__outer-container">
|
||||
<div className="achievement-notification__container">
|
||||
<div className="achievement-notification__content">
|
||||
<img
|
||||
src={achievement.iconUrl}
|
||||
alt={achievement.title}
|
||||
className="achievement-notification__icon"
|
||||
/>
|
||||
<div className="achievement-notification__text-container">
|
||||
<p className="achievement-notification__title">
|
||||
{achievement.isHidden && (
|
||||
<span className="achievement-notification__hidden-icon">
|
||||
<EyeClosedIcon size={16} />
|
||||
</span>
|
||||
)}
|
||||
{achievement.title}
|
||||
</p>
|
||||
<p className="achievement-notification__description">
|
||||
{achievement.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="achievement-notification__additional-overlay">
|
||||
<div className="achievement-notification__dark-overlay"></div>
|
||||
<img
|
||||
className="achievement-notification__ellipses-overlay"
|
||||
src={Ellipses}
|
||||
alt="Ellipses effect"
|
||||
/>
|
||||
<div className="achievement-notification__trophy-overlay"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
import cn from "classnames";
|
||||
import { PlacesType, Tooltip } from "react-tooltip";
|
||||
|
||||
import "./button.scss";
|
||||
import { useId } from "react";
|
||||
|
||||
export interface ButtonProps
|
||||
extends React.DetailedHTMLProps<
|
||||
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
HTMLButtonElement
|
||||
> {
|
||||
tooltip?: string;
|
||||
tooltipPlace?: PlacesType;
|
||||
theme?: "primary" | "outline" | "dark" | "danger";
|
||||
}
|
||||
|
||||
@@ -14,15 +18,32 @@ export function Button({
|
||||
children,
|
||||
theme = "primary",
|
||||
className,
|
||||
tooltip,
|
||||
tooltipPlace = "top",
|
||||
...props
|
||||
}: Readonly<ButtonProps>) {
|
||||
const id = useId();
|
||||
|
||||
const tooltipProps = tooltip
|
||||
? {
|
||||
"data-tooltip-id": id,
|
||||
"data-tooltip-place": tooltipPlace,
|
||||
"data-tooltip-content": tooltip,
|
||||
}
|
||||
: {};
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={cn("button", `button--${theme}`, className)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className={cn("button", `button--${theme}`, className)}
|
||||
{...props}
|
||||
{...tooltipProps}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
|
||||
{tooltip && <Tooltip id={id} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
@use "../../scss/globals.scss";
|
||||
|
||||
.collapsed-menu {
|
||||
&__button {
|
||||
height: 72px;
|
||||
padding: calc(globals.$spacing-unit * 2) calc(globals.$spacing-unit * 2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: globals.$background-color;
|
||||
color: globals.$muted-color;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
transition: all ease 0.2s;
|
||||
gap: globals.$spacing-unit;
|
||||
font-size: globals.$body-font-size;
|
||||
font-weight: bold;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: globals.$active-opacity;
|
||||
}
|
||||
}
|
||||
|
||||
&__chevron {
|
||||
transition: transform ease 0.2s;
|
||||
|
||||
&--open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
overflow: hidden;
|
||||
transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { ChevronDownIcon } from "@primer/octicons-react";
|
||||
import "./collapsed-menu.scss";
|
||||
|
||||
export interface CollapsedMenuProps {
|
||||
title: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function CollapsedMenu({
|
||||
title,
|
||||
children,
|
||||
}: Readonly<CollapsedMenuProps>) {
|
||||
const content = useRef<HTMLDivElement>(null);
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
const [height, setHeight] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (content.current && content.current.scrollHeight !== height) {
|
||||
setHeight(isOpen ? content.current.scrollHeight : 0);
|
||||
} else if (!isOpen) {
|
||||
setHeight(0);
|
||||
}
|
||||
}, [isOpen, children, height]);
|
||||
|
||||
return (
|
||||
<div className="collapsed-menu">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
className="collapsed-menu__button"
|
||||
>
|
||||
<ChevronDownIcon
|
||||
className={`collapsed-menu__chevron ${
|
||||
isOpen ? "collapsed-menu__chevron--open" : ""
|
||||
}`}
|
||||
/>
|
||||
<span>{title}</span>
|
||||
</button>
|
||||
|
||||
<div
|
||||
ref={content}
|
||||
className="collapsed-menu__content"
|
||||
style={{
|
||||
maxHeight: `${height}px`,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -18,12 +18,13 @@ export function SelectField({
|
||||
options = [{ key: "-", value: value?.toString() || "-", label: "-" }],
|
||||
theme = "primary",
|
||||
onChange,
|
||||
}: SelectProps) {
|
||||
className,
|
||||
}: Readonly<SelectProps>) {
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
const id = useId();
|
||||
|
||||
return (
|
||||
<div className="select-field__container">
|
||||
<div className={cn("select-field__container", className)}>
|
||||
{label && (
|
||||
<label htmlFor={id} className="select-field__label">
|
||||
{label}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Downloader } from "@shared";
|
||||
|
||||
export const VERSION_CODENAME = "Polychrome";
|
||||
export const VERSION_CODENAME = "Lumen";
|
||||
|
||||
export const DOWNLOADER_NAME = {
|
||||
[Downloader.RealDebrid]: "Real-Debrid",
|
||||
|
||||
@@ -160,7 +160,6 @@ export function GameDetailsContextProvider({
|
||||
|
||||
setShopDetails((prev) => {
|
||||
if (!prev) return null;
|
||||
console.log("assets", assets);
|
||||
return {
|
||||
...prev,
|
||||
assets,
|
||||
|
||||
20
src/renderer/src/declaration.d.ts
vendored
20
src/renderer/src/declaration.d.ts
vendored
@@ -35,6 +35,8 @@ import type {
|
||||
CatalogueSearchResult,
|
||||
ShopAssets,
|
||||
ShopDetailsWithAssets,
|
||||
AchievementCustomNotificationPosition,
|
||||
AchievementNotificationInfo,
|
||||
} from "@types";
|
||||
import type { AxiosProgressEvent } from "axios";
|
||||
import type disk from "diskusage";
|
||||
@@ -175,10 +177,11 @@ declare global {
|
||||
minimized: boolean;
|
||||
}) => Promise<void>;
|
||||
extractGameDownload: (shop: GameShop, objectId: string) => Promise<boolean>;
|
||||
onAchievementUnlocked: (cb: () => void) => () => Electron.IpcRenderer;
|
||||
onExtractionComplete: (
|
||||
cb: (shop: GameShop, objectId: string) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
getDefaultWinePrefixSelectionPath: () => Promise<string | null>;
|
||||
createSteamShortcut: (shop: GameShop, objectId: string) => Promise<void>;
|
||||
|
||||
/* Download sources */
|
||||
putDownloadSource: (
|
||||
@@ -321,6 +324,21 @@ declare global {
|
||||
|
||||
/* Notifications */
|
||||
publishNewRepacksNotification: (newRepacksCount: number) => Promise<void>;
|
||||
onAchievementUnlocked: (
|
||||
cb: (
|
||||
position?: AchievementCustomNotificationPosition,
|
||||
achievements?: AchievementNotificationInfo[]
|
||||
) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
onCombinedAchievementsUnlocked: (
|
||||
cb: (
|
||||
gameCount: number,
|
||||
achievementCount: number,
|
||||
position: AchievementCustomNotificationPosition
|
||||
) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
updateAchievementCustomNotificationWindow: () => Promise<void>;
|
||||
showAchievementTestNotification: () => Promise<void>;
|
||||
|
||||
/* Themes */
|
||||
addCustomTheme: (theme: Theme) => Promise<void>;
|
||||
|
||||
@@ -30,6 +30,7 @@ import Settings from "./pages/settings/settings";
|
||||
import Profile from "./pages/profile/profile";
|
||||
import Achievements from "./pages/achievements/achievements";
|
||||
import ThemeEditor from "./pages/theme-editor/theme-editor";
|
||||
import { AchievementNotification } from "./pages/achievements/notification/achievement-notification";
|
||||
|
||||
Sentry.init({
|
||||
dsn: import.meta.env.RENDERER_VITE_SENTRY_DSN,
|
||||
@@ -84,6 +85,10 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
</Route>
|
||||
|
||||
<Route path="/theme-editor" element={<ThemeEditor />} />
|
||||
<Route
|
||||
path="/achievement-notification"
|
||||
element={<AchievementNotification />}
|
||||
/>
|
||||
</Routes>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import achievementSound from "@renderer/assets/audio/achievement.wav";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
AchievementCustomNotificationPosition,
|
||||
AchievementNotificationInfo,
|
||||
} from "@types";
|
||||
import { injectCustomCss } from "@renderer/helpers";
|
||||
import { AchievementNotificationItem } from "@renderer/components/achievements/notification/achievement-notification";
|
||||
|
||||
const NOTIFICATION_TIMEOUT = 4000;
|
||||
|
||||
export function AchievementNotification() {
|
||||
const { t } = useTranslation("achievement");
|
||||
|
||||
const [isClosing, setIsClosing] = useState(false);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
const [position, setPosition] =
|
||||
useState<AchievementCustomNotificationPosition>("top-left");
|
||||
|
||||
const [achievements, setAchievements] = useState<
|
||||
AchievementNotificationInfo[]
|
||||
>([]);
|
||||
const [currentAchievement, setCurrentAchievement] =
|
||||
useState<AchievementNotificationInfo | null>(null);
|
||||
|
||||
const achievementAnimation = useRef(-1);
|
||||
const closingAnimation = useRef(-1);
|
||||
const visibleAnimation = useRef(-1);
|
||||
|
||||
const playAudio = useCallback(() => {
|
||||
const audio = new Audio(achievementSound);
|
||||
audio.volume = 0.1;
|
||||
audio.play();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onCombinedAchievementsUnlocked(
|
||||
(gameCount, achievementCount, position) => {
|
||||
if (gameCount === 0 || achievementCount === 0) return;
|
||||
|
||||
setPosition(position);
|
||||
|
||||
setAchievements([
|
||||
{
|
||||
title: t("new_achievements_unlocked", {
|
||||
gameCount,
|
||||
achievementCount,
|
||||
}),
|
||||
isHidden: false,
|
||||
isRare: false,
|
||||
isPlatinum: false,
|
||||
points: 0,
|
||||
iconUrl: "https://cdn.losbroxas.org/favicon.svg",
|
||||
},
|
||||
]);
|
||||
|
||||
playAudio();
|
||||
}
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [t, playAudio]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onAchievementUnlocked(
|
||||
(position, achievements) => {
|
||||
if (!achievements?.length) return;
|
||||
if (position) {
|
||||
setPosition(position);
|
||||
}
|
||||
|
||||
setAchievements((ach) => ach.concat(achievements));
|
||||
|
||||
playAudio();
|
||||
}
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [playAudio]);
|
||||
|
||||
const hasAchievementsPending = achievements.length > 0;
|
||||
|
||||
const startAnimateClosing = useCallback(() => {
|
||||
cancelAnimationFrame(closingAnimation.current);
|
||||
cancelAnimationFrame(visibleAnimation.current);
|
||||
cancelAnimationFrame(achievementAnimation.current);
|
||||
|
||||
setIsClosing(true);
|
||||
|
||||
const zero = performance.now();
|
||||
closingAnimation.current = requestAnimationFrame(
|
||||
function animateClosing(time) {
|
||||
if (time - zero <= 450) {
|
||||
closingAnimation.current = requestAnimationFrame(animateClosing);
|
||||
} else {
|
||||
setIsVisible(false);
|
||||
setAchievements((ach) => ach.slice(1));
|
||||
}
|
||||
}
|
||||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasAchievementsPending) {
|
||||
setIsClosing(false);
|
||||
setIsVisible(true);
|
||||
|
||||
let zero = performance.now();
|
||||
cancelAnimationFrame(closingAnimation.current);
|
||||
cancelAnimationFrame(visibleAnimation.current);
|
||||
cancelAnimationFrame(achievementAnimation.current);
|
||||
achievementAnimation.current = requestAnimationFrame(
|
||||
function animateLock(time) {
|
||||
if (time - zero > NOTIFICATION_TIMEOUT) {
|
||||
zero = performance.now();
|
||||
startAnimateClosing();
|
||||
}
|
||||
achievementAnimation.current = requestAnimationFrame(animateLock);
|
||||
}
|
||||
);
|
||||
}
|
||||
}, [hasAchievementsPending, startAnimateClosing, currentAchievement]);
|
||||
|
||||
useEffect(() => {
|
||||
if (achievements.length) {
|
||||
setCurrentAchievement(achievements[0]);
|
||||
}
|
||||
}, [achievements]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadAndApplyTheme = async () => {
|
||||
const activeTheme = await window.electron.getActiveCustomTheme();
|
||||
if (activeTheme?.code) {
|
||||
injectCustomCss(activeTheme.code);
|
||||
}
|
||||
};
|
||||
loadAndApplyTheme();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onCssInjected((cssString) => {
|
||||
injectCustomCss(cssString);
|
||||
});
|
||||
|
||||
return () => unsubscribe();
|
||||
}, []);
|
||||
|
||||
if (!isVisible || !currentAchievement) return null;
|
||||
|
||||
return (
|
||||
<AchievementNotificationItem
|
||||
achievement={currentAchievement}
|
||||
isClosing={isClosing}
|
||||
position={position}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
getGameBackupPreview,
|
||||
} = useContext(cloudSyncContext);
|
||||
|
||||
const { objectId, shop, gameTitle, lastDownloadedOption } =
|
||||
const { objectId, shop, gameTitle, game, lastDownloadedOption } =
|
||||
useContext(gameDetailsContext);
|
||||
|
||||
const { showSuccessToast, showErrorToast } = useToast();
|
||||
@@ -148,6 +148,8 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
]);
|
||||
|
||||
const disableActions = uploadingBackup || restoringBackup || deletingArtifact;
|
||||
const isMissingWinePrefix =
|
||||
window.electron.platform === "linux" && !game?.winePrefixPath;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@@ -175,10 +177,13 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => uploadSaveGame(lastDownloadedOption?.title ?? null)}
|
||||
tooltip={isMissingWinePrefix ? t("missing_wine_prefix") : undefined}
|
||||
tooltipPlace="left"
|
||||
disabled={
|
||||
disableActions ||
|
||||
!backupPreview?.overall.totalGames ||
|
||||
artifacts.length >= backupsPerGameLimit
|
||||
artifacts.length >= backupsPerGameLimit ||
|
||||
isMissingWinePrefix
|
||||
}
|
||||
>
|
||||
{uploadingBackup ? (
|
||||
|
||||
@@ -8,8 +8,10 @@ import { useDownload, useToast, useUserDetails } from "@renderer/hooks";
|
||||
import { RemoveGameFromLibraryModal } from "./remove-from-library-modal";
|
||||
import { ResetAchievementsModal } from "./reset-achievements-modal";
|
||||
import { FileDirectoryIcon, FileIcon } from "@primer/octicons-react";
|
||||
import SteamLogo from "@renderer/assets/steam-logo.svg?react";
|
||||
import { debounce } from "lodash-es";
|
||||
import "./game-options-modal.scss";
|
||||
import { logger } from "@renderer/logger";
|
||||
|
||||
export interface GameOptionsModalProps {
|
||||
visible: boolean;
|
||||
@@ -45,6 +47,7 @@ export function GameOptionsModal({
|
||||
const [automaticCloudSync, setAutomaticCloudSync] = useState(
|
||||
game.automaticCloudSync ?? false
|
||||
);
|
||||
const [creatingSteamShortcut, setCreatingSteamShortcut] = useState(false);
|
||||
|
||||
const {
|
||||
removeGameInstaller,
|
||||
@@ -107,6 +110,25 @@ export function GameOptionsModal({
|
||||
}
|
||||
};
|
||||
|
||||
const handleCreateSteamShortcut = async () => {
|
||||
try {
|
||||
setCreatingSteamShortcut(true);
|
||||
await window.electron.createSteamShortcut(game.shop, game.objectId);
|
||||
|
||||
showSuccessToast(
|
||||
t("create_shortcut_success"),
|
||||
t("you_might_need_to_restart_steam")
|
||||
);
|
||||
|
||||
updateGame();
|
||||
} catch (error: unknown) {
|
||||
logger.error("Failed to create Steam shortcut", error);
|
||||
showErrorToast(t("create_shortcut_error"));
|
||||
} finally {
|
||||
setCreatingSteamShortcut(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleCreateShortcut = async (location: ShortcutLocation) => {
|
||||
window.electron
|
||||
.createGameShortcut(game.shop, game.objectId, location)
|
||||
@@ -142,17 +164,28 @@ export function GameOptionsModal({
|
||||
};
|
||||
|
||||
const handleChangeWinePrefixPath = async () => {
|
||||
const defaultPath =
|
||||
await window.electron.getDefaultWinePrefixSelectionPath();
|
||||
|
||||
const { filePaths } = await window.electron.showOpenDialog({
|
||||
properties: ["openDirectory"],
|
||||
defaultPath: defaultPath ?? game?.winePrefixPath ?? "",
|
||||
});
|
||||
|
||||
if (filePaths && filePaths.length > 0) {
|
||||
await window.electron.selectGameWinePrefix(
|
||||
game.shop,
|
||||
game.objectId,
|
||||
filePaths[0]
|
||||
);
|
||||
await updateGame();
|
||||
try {
|
||||
await window.electron.selectGameWinePrefix(
|
||||
game.shop,
|
||||
game.objectId,
|
||||
filePaths[0]
|
||||
);
|
||||
await updateGame();
|
||||
} catch (error) {
|
||||
showErrorToast(
|
||||
t("invalid_wine_prefix_path"),
|
||||
t("invalid_wine_prefix_path_description")
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -290,6 +323,14 @@ export function GameOptionsModal({
|
||||
>
|
||||
{t("create_shortcut")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCreateSteamShortcut}
|
||||
theme="outline"
|
||||
disabled={creatingSteamShortcut}
|
||||
>
|
||||
<SteamLogo />
|
||||
{t("create_steam_shortcut")}
|
||||
</Button>
|
||||
{shouldShowCreateStartMenuShortcut && (
|
||||
<Button
|
||||
onClick={() => handleCreateShortcut("start_menu")}
|
||||
|
||||
@@ -22,36 +22,34 @@ interface FormValues {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const DEFAULT_THEME_CODE = `
|
||||
/*
|
||||
Here you can edit CSS for your theme and apply it on Hydra.
|
||||
There are a few classes already in place, you can use them to style the launcher.
|
||||
const DEFAULT_THEME_CODE = `/*
|
||||
Here you can edit CSS for your theme and apply it on Hydra.
|
||||
There are a few classes already in place, you can use them to style the launcher.
|
||||
|
||||
If you want to learn more about how to run Hydra in dev mode (which will allow you to inspect the DOM and view the classes)
|
||||
or how to publish your theme in the theme store, you can check the docs:
|
||||
https://docs.hydralauncher.gg/
|
||||
If you want to learn more about how to run Hydra in dev mode (which will allow you to inspect the DOM and view the classes)
|
||||
or how to publish your theme in the theme store, you can check the docs:
|
||||
https://docs.hydralauncher.gg/themes.html
|
||||
|
||||
Happy hacking!
|
||||
*/
|
||||
Happy hacking!
|
||||
*/
|
||||
|
||||
/* Header */
|
||||
.header {}
|
||||
/* Header */
|
||||
.header {}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {}
|
||||
/* Sidebar */
|
||||
.sidebar {}
|
||||
|
||||
/* Main content */
|
||||
.container__content {}
|
||||
/* Main content */
|
||||
.container__content {}
|
||||
|
||||
/* Bottom panel */
|
||||
.bottom-panel {}
|
||||
/* Bottom panel */
|
||||
.bottom-panel {}
|
||||
|
||||
/* Toast */
|
||||
.toast {}
|
||||
|
||||
/* Button */
|
||||
.button {}
|
||||
/* Toast */
|
||||
.toast {}
|
||||
|
||||
/* Button */
|
||||
.button {}
|
||||
`;
|
||||
|
||||
export function AddThemeModal({
|
||||
|
||||
@@ -13,4 +13,8 @@
|
||||
&__common-redist-button {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
&__test-achievement-notification-button {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
TextField,
|
||||
Button,
|
||||
@@ -14,6 +14,7 @@ import { settingsContext } from "@renderer/context";
|
||||
import "./settings-general.scss";
|
||||
import { DesktopDownloadIcon } from "@primer/octicons-react";
|
||||
import { logger } from "@renderer/logger";
|
||||
import { AchievementCustomNotificationPosition } from "@types";
|
||||
|
||||
interface LanguageOption {
|
||||
option: string;
|
||||
@@ -36,10 +37,12 @@ export function SettingsGeneral() {
|
||||
downloadsPath: "",
|
||||
downloadNotificationsEnabled: false,
|
||||
repackUpdatesNotificationsEnabled: false,
|
||||
achievementNotificationsEnabled: false,
|
||||
friendRequestNotificationsEnabled: false,
|
||||
achievementNotificationsEnabled: true,
|
||||
achievementCustomNotificationsEnabled: true,
|
||||
achievementCustomNotificationPosition:
|
||||
"top-left" as AchievementCustomNotificationPosition,
|
||||
language: "",
|
||||
|
||||
customStyles: window.localStorage.getItem("customStyles") || "",
|
||||
});
|
||||
|
||||
@@ -101,7 +104,11 @@ export function SettingsGeneral() {
|
||||
repackUpdatesNotificationsEnabled:
|
||||
userPreferences.repackUpdatesNotificationsEnabled ?? false,
|
||||
achievementNotificationsEnabled:
|
||||
userPreferences.achievementNotificationsEnabled ?? false,
|
||||
userPreferences.achievementNotificationsEnabled ?? true,
|
||||
achievementCustomNotificationsEnabled:
|
||||
userPreferences.achievementCustomNotificationsEnabled ?? true,
|
||||
achievementCustomNotificationPosition:
|
||||
userPreferences.achievementCustomNotificationPosition ?? "top-left",
|
||||
friendRequestNotificationsEnabled:
|
||||
userPreferences.friendRequestNotificationsEnabled ?? false,
|
||||
language: language ?? "en",
|
||||
@@ -109,6 +116,21 @@ export function SettingsGeneral() {
|
||||
}
|
||||
}, [userPreferences, defaultDownloadsPath]);
|
||||
|
||||
const achievementCustomNotificationPositionOptions = useMemo(() => {
|
||||
return [
|
||||
"top-left",
|
||||
"top-center",
|
||||
"top-right",
|
||||
"bottom-left",
|
||||
"bottom-center",
|
||||
"bottom-right",
|
||||
].map((position) => ({
|
||||
key: position,
|
||||
value: position,
|
||||
label: t(position),
|
||||
}));
|
||||
}, [t]);
|
||||
|
||||
const handleLanguageChange = (
|
||||
event: React.ChangeEvent<HTMLSelectElement>
|
||||
) => {
|
||||
@@ -118,9 +140,19 @@ export function SettingsGeneral() {
|
||||
changeLanguage(value);
|
||||
};
|
||||
|
||||
const handleChange = (values: Partial<typeof form>) => {
|
||||
const handleChange = async (values: Partial<typeof form>) => {
|
||||
setForm((prev) => ({ ...prev, ...values }));
|
||||
updateUserPreferences(values);
|
||||
await updateUserPreferences(values);
|
||||
};
|
||||
|
||||
const handleChangeAchievementCustomNotificationPosition = async (
|
||||
event: React.ChangeEvent<HTMLSelectElement>
|
||||
) => {
|
||||
const value = event.target.value as AchievementCustomNotificationPosition;
|
||||
|
||||
await handleChange({ achievementCustomNotificationPosition: value });
|
||||
|
||||
window.electron.updateAchievementCustomNotificationWindow();
|
||||
};
|
||||
|
||||
const handleChooseDownloadsPath = async () => {
|
||||
@@ -205,17 +237,6 @@ export function SettingsGeneral() {
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_achievement_notifications")}
|
||||
checked={form.achievementNotificationsEnabled}
|
||||
onChange={() =>
|
||||
handleChange({
|
||||
achievementNotificationsEnabled:
|
||||
!form.achievementNotificationsEnabled,
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_friend_request_notifications")}
|
||||
checked={form.friendRequestNotificationsEnabled}
|
||||
@@ -227,6 +248,53 @@ export function SettingsGeneral() {
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_achievement_notifications")}
|
||||
checked={form.achievementNotificationsEnabled}
|
||||
onChange={async () => {
|
||||
await handleChange({
|
||||
achievementNotificationsEnabled:
|
||||
!form.achievementNotificationsEnabled,
|
||||
});
|
||||
|
||||
window.electron.updateAchievementCustomNotificationWindow();
|
||||
}}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_achievement_custom_notifications")}
|
||||
checked={form.achievementCustomNotificationsEnabled}
|
||||
disabled={!form.achievementNotificationsEnabled}
|
||||
onChange={async () => {
|
||||
await handleChange({
|
||||
achievementCustomNotificationsEnabled:
|
||||
!form.achievementCustomNotificationsEnabled,
|
||||
});
|
||||
|
||||
window.electron.updateAchievementCustomNotificationWindow();
|
||||
}}
|
||||
/>
|
||||
|
||||
{form.achievementNotificationsEnabled &&
|
||||
form.achievementCustomNotificationsEnabled && (
|
||||
<>
|
||||
<SelectField
|
||||
className="settings-general__achievement-custom-notification-position__select-variation"
|
||||
label={t("achievement_custom_notification_position")}
|
||||
value={form.achievementCustomNotificationPosition}
|
||||
onChange={handleChangeAchievementCustomNotificationPosition}
|
||||
options={achievementCustomNotificationPositionOptions}
|
||||
/>
|
||||
|
||||
<Button
|
||||
className="settings-general__test-achievement-notification-button"
|
||||
onClick={() => window.electron.showAchievementTestNotification()}
|
||||
>
|
||||
{t("test_notification")}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
<h2 className="settings-general__section-title">{t("common_redist")}</h2>
|
||||
|
||||
<p className="settings-general__common-redist-description">
|
||||
|
||||
@@ -36,14 +36,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__editor {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__notification-preview-wrapper {
|
||||
position: relative;
|
||||
border: 1px solid globals.$muted-color;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
&__footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: globals.$dark-background-color;
|
||||
padding: globals.$spacing-unit globals.$spacing-unit * 2;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 50;
|
||||
gap: 24px;
|
||||
|
||||
&-actions {
|
||||
display: flex;
|
||||
@@ -78,4 +89,16 @@
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
&__notification-preview {
|
||||
padding-top: 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
|
||||
&__select-variation {
|
||||
flex: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import "./theme-editor.scss";
|
||||
import Editor from "@monaco-editor/react";
|
||||
import { Theme } from "@types";
|
||||
import { AchievementCustomNotificationPosition, Theme } from "@types";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { Button } from "@renderer/components";
|
||||
import { Button, SelectField } from "@renderer/components";
|
||||
import { CheckIcon } from "@primer/octicons-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import cn from "classnames";
|
||||
import { injectCustomCss } from "@renderer/helpers";
|
||||
import { AchievementNotificationItem } from "@renderer/components/achievements/notification/achievement-notification";
|
||||
import { generateAchievementCustomNotificationTest } from "@shared";
|
||||
import { CollapsedMenu } from "@renderer/components/collapsed-menu/collapsed-menu";
|
||||
|
||||
const notificationVariations = {
|
||||
default: "default",
|
||||
rare: "rare",
|
||||
platinum: "platinum",
|
||||
hidden: "hidden",
|
||||
};
|
||||
|
||||
export default function ThemeEditor() {
|
||||
const [searchParams] = useSearchParams();
|
||||
@@ -14,9 +25,32 @@ export default function ThemeEditor() {
|
||||
const [code, setCode] = useState("");
|
||||
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
|
||||
|
||||
const [isClosingNotifications, setIsClosingNotifications] = useState(false);
|
||||
|
||||
const themeId = searchParams.get("themeId");
|
||||
|
||||
const { t } = useTranslation("settings");
|
||||
const { t, i18n } = useTranslation("settings");
|
||||
|
||||
const [notificationVariation, setNotificationVariation] =
|
||||
useState<keyof typeof notificationVariations>("default");
|
||||
const [notificationAlignment, setNotificationAlignment] =
|
||||
useState<AchievementCustomNotificationPosition>("top-left");
|
||||
|
||||
const achievementPreview = useMemo(() => {
|
||||
return {
|
||||
achievement: {
|
||||
...generateAchievementCustomNotificationTest(t, i18n.language),
|
||||
isRare: notificationVariation === "rare",
|
||||
isHidden: notificationVariation === "hidden",
|
||||
isPlatinum: notificationVariation === "platinum",
|
||||
},
|
||||
position: notificationAlignment,
|
||||
};
|
||||
}, [t, i18n.language, notificationVariation, notificationAlignment]);
|
||||
|
||||
useEffect(() => {
|
||||
window.document.title = "Hydra - Theme Editor";
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (themeId) {
|
||||
@@ -33,12 +67,17 @@ export default function ThemeEditor() {
|
||||
if (theme) {
|
||||
await window.electron.updateCustomTheme(theme.id, code);
|
||||
setHasUnsavedChanges(false);
|
||||
setIsClosingNotifications(true);
|
||||
setTimeout(() => {
|
||||
injectCustomCss(code);
|
||||
setIsClosingNotifications(false);
|
||||
}, 450);
|
||||
}
|
||||
}, [code, theme]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === "s") {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "s") {
|
||||
event.preventDefault();
|
||||
handleSave();
|
||||
}
|
||||
@@ -58,6 +97,21 @@ export default function ThemeEditor() {
|
||||
}
|
||||
};
|
||||
|
||||
const achievementCustomNotificationPositionOptions = useMemo(() => {
|
||||
return [
|
||||
"top-left",
|
||||
"top-center",
|
||||
"top-right",
|
||||
"bottom-left",
|
||||
"bottom-center",
|
||||
"bottom-right",
|
||||
].map((position) => ({
|
||||
key: position,
|
||||
value: position,
|
||||
label: t(position),
|
||||
}));
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<div className="theme-editor">
|
||||
<div
|
||||
@@ -71,21 +125,75 @@ export default function ThemeEditor() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Editor
|
||||
theme="vs-dark"
|
||||
defaultLanguage="css"
|
||||
value={code}
|
||||
onChange={handleEditorChange}
|
||||
options={{
|
||||
minimap: { enabled: false },
|
||||
fontSize: 14,
|
||||
lineNumbers: "on",
|
||||
wordWrap: "on",
|
||||
automaticLayout: true,
|
||||
}}
|
||||
/>
|
||||
<div className="theme-editor__editor">
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
>
|
||||
<Editor
|
||||
theme="vs-dark"
|
||||
defaultLanguage="css"
|
||||
value={code}
|
||||
onChange={handleEditorChange}
|
||||
options={{
|
||||
minimap: { enabled: false },
|
||||
fontSize: 14,
|
||||
lineNumbers: "on",
|
||||
wordWrap: "on",
|
||||
automaticLayout: true,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="theme-editor__footer">
|
||||
<CollapsedMenu title={t("notification_preview")}>
|
||||
<div className="theme-editor__notification-preview">
|
||||
<SelectField
|
||||
className="theme-editor__notification-preview__select-variation"
|
||||
label={t("variation")}
|
||||
options={Object.values(notificationVariations).map(
|
||||
(variation) => {
|
||||
return {
|
||||
key: variation,
|
||||
value: variation,
|
||||
label: t(variation),
|
||||
};
|
||||
}
|
||||
)}
|
||||
onChange={(value) =>
|
||||
setNotificationVariation(
|
||||
value.target.value as keyof typeof notificationVariations
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
<SelectField
|
||||
label={t("alignment")}
|
||||
value={notificationAlignment}
|
||||
onChange={(e) =>
|
||||
setNotificationAlignment(
|
||||
e.target.value as AchievementCustomNotificationPosition
|
||||
)
|
||||
}
|
||||
options={achievementCustomNotificationPositionOptions}
|
||||
/>
|
||||
|
||||
<div className="theme-editor__notification-preview-wrapper">
|
||||
<AchievementNotificationItem
|
||||
position={achievementPreview.position}
|
||||
achievement={achievementPreview.achievement}
|
||||
isClosing={isClosingNotifications}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsedMenu>
|
||||
|
||||
<div className="theme-editor__footer-actions">
|
||||
<Button onClick={handleSave}>
|
||||
<CheckIcon />
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import { charMap } from "./char-map";
|
||||
import { Downloader } from "./constants";
|
||||
import { format } from "date-fns";
|
||||
import { AchievementNotificationInfo } from "@types";
|
||||
|
||||
export * from "./constants";
|
||||
|
||||
@@ -175,3 +176,24 @@ export const formatDate = (
|
||||
if (isNaN(new Date(date).getDate())) return "N/A";
|
||||
return format(date, language == "en" ? "MM-dd-yyyy" : "dd/MM/yyyy");
|
||||
};
|
||||
|
||||
export const generateAchievementCustomNotificationTest = (
|
||||
t: any,
|
||||
language?: string
|
||||
): AchievementNotificationInfo => {
|
||||
return {
|
||||
title: t("test_achievement_notification_title", {
|
||||
ns: "notifications",
|
||||
lng: language ?? "en",
|
||||
}),
|
||||
description: t("test_achievement_notification_description", {
|
||||
ns: "notifications",
|
||||
lng: language ?? "en",
|
||||
}),
|
||||
iconUrl: "https://cdn.losbroxas.org/favicon.svg",
|
||||
points: 2440,
|
||||
isHidden: false,
|
||||
isRare: false,
|
||||
isPlatinum: false,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -263,6 +263,15 @@ export type GameAchievementFiles = {
|
||||
[id: string]: AchievementFile[];
|
||||
};
|
||||
|
||||
export interface AchievementNotificationInfo {
|
||||
title: string;
|
||||
description?: string;
|
||||
iconUrl: string;
|
||||
isHidden: boolean;
|
||||
isRare: boolean;
|
||||
isPlatinum: boolean;
|
||||
points?: number;
|
||||
}
|
||||
export interface GameArtifact {
|
||||
id: string;
|
||||
artifactLengthInBytes: number;
|
||||
|
||||
@@ -70,6 +70,14 @@ export interface GameAchievement {
|
||||
cacheExpiresTimestamp: number | undefined;
|
||||
}
|
||||
|
||||
export type AchievementCustomNotificationPosition =
|
||||
| "top-left"
|
||||
| "top-center"
|
||||
| "top-right"
|
||||
| "bottom-left"
|
||||
| "bottom-center"
|
||||
| "bottom-right";
|
||||
|
||||
export interface UserPreferences {
|
||||
downloadsPath?: string | null;
|
||||
language?: string;
|
||||
@@ -86,6 +94,8 @@ export interface UserPreferences {
|
||||
downloadNotificationsEnabled?: boolean;
|
||||
repackUpdatesNotificationsEnabled?: boolean;
|
||||
achievementNotificationsEnabled?: boolean;
|
||||
achievementCustomNotificationsEnabled?: boolean;
|
||||
achievementCustomNotificationPosition?: AchievementCustomNotificationPosition;
|
||||
friendRequestNotificationsEnabled?: boolean;
|
||||
showDownloadSpeedInMegabytes?: boolean;
|
||||
extractFilesByDefault?: boolean;
|
||||
|
||||
@@ -40,3 +40,12 @@ export interface LudusaviConfig {
|
||||
registry: [];
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface LudusaviBackupMapping {
|
||||
files: {
|
||||
[key: string]: {
|
||||
hash: string;
|
||||
size: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,3 +53,22 @@ export interface SteamAppDetails {
|
||||
ids: number[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface SteamShortcut {
|
||||
appid: number;
|
||||
appname: string;
|
||||
Exe: string;
|
||||
StartDir: string;
|
||||
icon: string;
|
||||
ShortcutPath: string;
|
||||
LaunchOptions: string;
|
||||
IsHidden: boolean;
|
||||
AllowDesktopConfig: boolean;
|
||||
AllowOverlay: boolean;
|
||||
OpenVR: boolean;
|
||||
Devkit: boolean;
|
||||
DevkitGameID: string;
|
||||
DevkitOverrideAppID: boolean;
|
||||
LastPlayTime: number;
|
||||
FlatpakAppID: string;
|
||||
}
|
||||
|
||||
142
yarn.lock
142
yarn.lock
@@ -1850,108 +1850,6 @@
|
||||
dependencies:
|
||||
"@monaco-editor/loader" "^1.4.0"
|
||||
|
||||
"@napi-rs/nice-android-arm-eabi@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm-eabi/-/nice-android-arm-eabi-1.0.1.tgz#9a0cba12706ff56500df127d6f4caf28ddb94936"
|
||||
integrity sha512-5qpvOu5IGwDo7MEKVqqyAxF90I6aLj4n07OzpARdgDRfz8UbBztTByBp0RC59r3J1Ij8uzYi6jI7r5Lws7nn6w==
|
||||
|
||||
"@napi-rs/nice-android-arm64@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm64/-/nice-android-arm64-1.0.1.tgz#32fc32e9649bd759d2a39ad745e95766f6759d2f"
|
||||
integrity sha512-GqvXL0P8fZ+mQqG1g0o4AO9hJjQaeYG84FRfZaYjyJtZZZcMjXW5TwkL8Y8UApheJgyE13TQ4YNUssQaTgTyvA==
|
||||
|
||||
"@napi-rs/nice-darwin-arm64@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-arm64/-/nice-darwin-arm64-1.0.1.tgz#d3c44c51b94b25a82d45803e2255891e833e787b"
|
||||
integrity sha512-91k3HEqUl2fsrz/sKkuEkscj6EAj3/eZNCLqzD2AA0TtVbkQi8nqxZCZDMkfklULmxLkMxuUdKe7RvG/T6s2AA==
|
||||
|
||||
"@napi-rs/nice-darwin-x64@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-x64/-/nice-darwin-x64-1.0.1.tgz#f1b1365a8370c6a6957e90085a9b4873d0e6a957"
|
||||
integrity sha512-jXnMleYSIR/+TAN/p5u+NkCA7yidgswx5ftqzXdD5wgy/hNR92oerTXHc0jrlBisbd7DpzoaGY4cFD7Sm5GlgQ==
|
||||
|
||||
"@napi-rs/nice-freebsd-x64@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-freebsd-x64/-/nice-freebsd-x64-1.0.1.tgz#4280f081efbe0b46c5165fdaea8b286e55a8f89e"
|
||||
integrity sha512-j+iJ/ezONXRQsVIB/FJfwjeQXX7A2tf3gEXs4WUGFrJjpe/z2KB7sOv6zpkm08PofF36C9S7wTNuzHZ/Iiccfw==
|
||||
|
||||
"@napi-rs/nice-linux-arm-gnueabihf@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm-gnueabihf/-/nice-linux-arm-gnueabihf-1.0.1.tgz#07aec23a9467ed35eb7602af5e63d42c5d7bd473"
|
||||
integrity sha512-G8RgJ8FYXYkkSGQwywAUh84m946UTn6l03/vmEXBYNJxQJcD+I3B3k5jmjFG/OPiU8DfvxutOP8bi+F89MCV7Q==
|
||||
|
||||
"@napi-rs/nice-linux-arm64-gnu@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-gnu/-/nice-linux-arm64-gnu-1.0.1.tgz#038a77134cc6df3c48059d5a5e199d6f50fb9a90"
|
||||
integrity sha512-IMDak59/W5JSab1oZvmNbrms3mHqcreaCeClUjwlwDr0m3BoR09ZiN8cKFBzuSlXgRdZ4PNqCYNeGQv7YMTjuA==
|
||||
|
||||
"@napi-rs/nice-linux-arm64-musl@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-musl/-/nice-linux-arm64-musl-1.0.1.tgz#715d0906582ba0cff025109f42e5b84ea68c2bcc"
|
||||
integrity sha512-wG8fa2VKuWM4CfjOjjRX9YLIbysSVV1S3Kgm2Fnc67ap/soHBeYZa6AGMeR5BJAylYRjnoVOzV19Cmkco3QEPw==
|
||||
|
||||
"@napi-rs/nice-linux-ppc64-gnu@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-ppc64-gnu/-/nice-linux-ppc64-gnu-1.0.1.tgz#ac1c8f781c67b0559fa7a1cd4ae3ca2299dc3d06"
|
||||
integrity sha512-lxQ9WrBf0IlNTCA9oS2jg/iAjQyTI6JHzABV664LLrLA/SIdD+I1i3Mjf7TsnoUbgopBcCuDztVLfJ0q9ubf6Q==
|
||||
|
||||
"@napi-rs/nice-linux-riscv64-gnu@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-riscv64-gnu/-/nice-linux-riscv64-gnu-1.0.1.tgz#b0a430549acfd3920ffd28ce544e2fe17833d263"
|
||||
integrity sha512-3xs69dO8WSWBb13KBVex+yvxmUeEsdWexxibqskzoKaWx9AIqkMbWmE2npkazJoopPKX2ULKd8Fm9veEn0g4Ig==
|
||||
|
||||
"@napi-rs/nice-linux-s390x-gnu@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-s390x-gnu/-/nice-linux-s390x-gnu-1.0.1.tgz#5b95caf411ad72a965885217db378c4d09733e97"
|
||||
integrity sha512-lMFI3i9rlW7hgToyAzTaEybQYGbQHDrpRkg+1gJWEpH0PLAQoZ8jiY0IzakLfNWnVda1eTYYlxxFYzW8Rqczkg==
|
||||
|
||||
"@napi-rs/nice-linux-x64-gnu@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-gnu/-/nice-linux-x64-gnu-1.0.1.tgz#a98cdef517549f8c17a83f0236a69418a90e77b7"
|
||||
integrity sha512-XQAJs7DRN2GpLN6Fb+ZdGFeYZDdGl2Fn3TmFlqEL5JorgWKrQGRUrpGKbgZ25UeZPILuTKJ+OowG2avN8mThBA==
|
||||
|
||||
"@napi-rs/nice-linux-x64-musl@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-musl/-/nice-linux-x64-musl-1.0.1.tgz#5e26843eafa940138aed437c870cca751c8a8957"
|
||||
integrity sha512-/rodHpRSgiI9o1faq9SZOp/o2QkKQg7T+DK0R5AkbnI/YxvAIEHf2cngjYzLMQSQgUhxym+LFr+UGZx4vK4QdQ==
|
||||
|
||||
"@napi-rs/nice-win32-arm64-msvc@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-arm64-msvc/-/nice-win32-arm64-msvc-1.0.1.tgz#bd62617d02f04aa30ab1e9081363856715f84cd8"
|
||||
integrity sha512-rEcz9vZymaCB3OqEXoHnp9YViLct8ugF+6uO5McifTedjq4QMQs3DHz35xBEGhH3gJWEsXMUbzazkz5KNM5YUg==
|
||||
|
||||
"@napi-rs/nice-win32-ia32-msvc@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-ia32-msvc/-/nice-win32-ia32-msvc-1.0.1.tgz#b8b7aad552a24836027473d9b9f16edaeabecf18"
|
||||
integrity sha512-t7eBAyPUrWL8su3gDxw9xxxqNwZzAqKo0Szv3IjVQd1GpXXVkb6vBBQUuxfIYaXMzZLwlxRQ7uzM2vdUE9ULGw==
|
||||
|
||||
"@napi-rs/nice-win32-x64-msvc@1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-x64-msvc/-/nice-win32-x64-msvc-1.0.1.tgz#37d8718b8f722f49067713e9f1e85540c9a3dd09"
|
||||
integrity sha512-JlF+uDcatt3St2ntBG8H02F1mM45i5SF9W+bIKiReVE6wiy3o16oBP/yxt+RZ+N6LbCImJXJ6bXNO2kn9AXicg==
|
||||
|
||||
"@napi-rs/nice@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/nice/-/nice-1.0.1.tgz#483d3ff31e5661829a1efb4825591a135c3bfa7d"
|
||||
integrity sha512-zM0mVWSXE0a0h9aKACLwKmD6nHcRiKrPpCfvaKqG1CqDEyjEawId0ocXxVzPMCAm6kkWr2P025msfxXEnt8UGQ==
|
||||
optionalDependencies:
|
||||
"@napi-rs/nice-android-arm-eabi" "1.0.1"
|
||||
"@napi-rs/nice-android-arm64" "1.0.1"
|
||||
"@napi-rs/nice-darwin-arm64" "1.0.1"
|
||||
"@napi-rs/nice-darwin-x64" "1.0.1"
|
||||
"@napi-rs/nice-freebsd-x64" "1.0.1"
|
||||
"@napi-rs/nice-linux-arm-gnueabihf" "1.0.1"
|
||||
"@napi-rs/nice-linux-arm64-gnu" "1.0.1"
|
||||
"@napi-rs/nice-linux-arm64-musl" "1.0.1"
|
||||
"@napi-rs/nice-linux-ppc64-gnu" "1.0.1"
|
||||
"@napi-rs/nice-linux-riscv64-gnu" "1.0.1"
|
||||
"@napi-rs/nice-linux-s390x-gnu" "1.0.1"
|
||||
"@napi-rs/nice-linux-x64-gnu" "1.0.1"
|
||||
"@napi-rs/nice-linux-x64-musl" "1.0.1"
|
||||
"@napi-rs/nice-win32-arm64-msvc" "1.0.1"
|
||||
"@napi-rs/nice-win32-ia32-msvc" "1.0.1"
|
||||
"@napi-rs/nice-win32-x64-msvc" "1.0.1"
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz"
|
||||
@@ -3459,6 +3357,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.10.tgz#d5a4b56abac169bfbc8b23d291363a682e6fa087"
|
||||
integrity sha512-l4MM0Jppn18hb9xmM6wwD1uTdShpf9Pn80aXTStnK1C94gtPvJcV2FrDmbOQUAQfJ1cKZHktkQUDwEqaAKXMMg==
|
||||
|
||||
"@types/winreg@^1.2.36":
|
||||
version "1.2.36"
|
||||
resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.36.tgz#f1d9a9918cae90a63c6106c98224aca6a36983fc"
|
||||
integrity sha512-DtafHy5A8hbaosXrbr7YdjQZaqVewXmiasRS5J4tYMzt3s1gkh40ixpxgVFfKiQ0JIYetTJABat47v9cpr/sQg==
|
||||
|
||||
"@types/ws@^8.18.1":
|
||||
version "8.18.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.1.tgz#48464e4bf2ddfd17db13d845467f6070ffea4aa9"
|
||||
@@ -4111,7 +4014,7 @@ buffer-from@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
|
||||
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
|
||||
|
||||
buffer@^5.1.0, buffer@^5.5.0:
|
||||
buffer@^5.1.0, buffer@^5.5.0, buffer@^5.6.0:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
|
||||
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
|
||||
@@ -4544,6 +4447,11 @@ crc@^3.8.0:
|
||||
dependencies:
|
||||
buffer "^5.1.0"
|
||||
|
||||
crc@^4.3.2:
|
||||
version "4.3.2"
|
||||
resolved "https://registry.yarnpkg.com/crc/-/crc-4.3.2.tgz#49b7821cbf2cf61dfd079ed93863bbebd5469b9a"
|
||||
integrity sha512-uGDHf4KLLh2zsHa8D8hIQ1H/HtFQhyHrc0uhHBcoKGol/Xnb+MPYfUMw7cvON6ze/GUESTudKayDcJC5HnJv1A==
|
||||
|
||||
create-desktop-shortcuts@^1.11.1:
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/create-desktop-shortcuts/-/create-desktop-shortcuts-1.11.1.tgz#59f9dced7931bda551c0717791a909419472c809"
|
||||
@@ -7016,7 +6924,7 @@ lodash.upperfirst@^4.3.1:
|
||||
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
|
||||
integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==
|
||||
|
||||
lodash@^4.17.15:
|
||||
lodash@^4.17.15, lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
@@ -7468,6 +7376,13 @@ object-keys@^1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
|
||||
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
|
||||
|
||||
object-sizeof@^1.2.0:
|
||||
version "1.6.3"
|
||||
resolved "https://registry.yarnpkg.com/object-sizeof/-/object-sizeof-1.6.3.tgz#6edbbf26825b971fd7a32125a800ed2a9895af95"
|
||||
integrity sha512-LGtilAKuDGKCcvu1Xg3UvAhAeJJlFmblo3faltmOQ80xrGwAHxnauIXucalKdTEksHp/Pq9tZGz1hfyEmjFJPQ==
|
||||
dependencies:
|
||||
buffer "^5.6.0"
|
||||
|
||||
object.assign@^4.1.4, object.assign@^4.1.5:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0"
|
||||
@@ -7722,13 +7637,6 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
piscina@^4.7.0:
|
||||
version "4.7.0"
|
||||
resolved "https://registry.yarnpkg.com/piscina/-/piscina-4.7.0.tgz#68936fc77128db00541366531330138e366dc851"
|
||||
integrity sha512-b8hvkpp9zS0zsfa939b/jXbe64Z2gZv0Ha7FYPNUiDIB1y2AtxcOZdfP8xN8HFjUaqQiT9gRlfjAsoL8vdJ1Iw==
|
||||
optionalDependencies:
|
||||
"@napi-rs/nice" "^1.0.1"
|
||||
|
||||
plist@3.1.0, plist@^3.0.4, plist@^3.0.5, plist@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9"
|
||||
@@ -8657,6 +8565,13 @@ state-local@^1.0.6:
|
||||
resolved "https://registry.yarnpkg.com/state-local/-/state-local-1.0.7.tgz#da50211d07f05748d53009bee46307a37db386d5"
|
||||
integrity sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==
|
||||
|
||||
"steam-shortcut-editor@https://github.com/hydralauncher/steam-shortcut-editor":
|
||||
version "3.1.3"
|
||||
resolved "https://github.com/hydralauncher/steam-shortcut-editor#7d9ba44eced1f8840cf6c7d2cd40dd4d3d5c660f"
|
||||
dependencies:
|
||||
lodash "^4.17.21"
|
||||
object-sizeof "^1.2.0"
|
||||
|
||||
"string-width-cjs@npm:string-width@^4.2.0":
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
@@ -9552,6 +9467,11 @@ winreg@1.2.4:
|
||||
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
|
||||
integrity sha512-IHpzORub7kYlb8A43Iig3reOvlcBJGX9gZ0WycHhghHtA65X0LYnMRuJs+aH1abVnMJztQkvQNlltnbPi5aGIA==
|
||||
|
||||
winreg@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.5.tgz#b650383e89278952494b5d113ba049a5a4fa96d8"
|
||||
integrity sha512-uf7tHf+tw0B1y+x+mKTLHkykBgK2KMs3g+KlzmyMbLvICSHQyB/xOFjTT8qZ3oeTFyU7Bbj4FzXitGG6jvKhYw==
|
||||
|
||||
word-wrap@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
|
||||
|
||||
Reference in New Issue
Block a user