mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
fix: fixing main thread lock
This commit is contained in:
parent
1eb963679e
commit
e1955e11f5
@ -4,7 +4,6 @@ import {
|
||||
loadEnv,
|
||||
swcPlugin,
|
||||
externalizeDepsPlugin,
|
||||
bytecodePlugin,
|
||||
} from "electron-vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
||||
@ -34,12 +33,7 @@ export default defineConfig(({ mode }) => {
|
||||
"@resources": resolve("resources"),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
externalizeDepsPlugin(),
|
||||
swcPlugin(),
|
||||
bytecodePlugin(),
|
||||
sentryPlugin,
|
||||
],
|
||||
plugins: [externalizeDepsPlugin(), swcPlugin(), sentryPlugin],
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
@ -54,13 +48,7 @@ export default defineConfig(({ mode }) => {
|
||||
"@locales": resolve("src/locales"),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
svgr(),
|
||||
react(),
|
||||
vanillaExtractPlugin(),
|
||||
bytecodePlugin(),
|
||||
sentryPlugin,
|
||||
],
|
||||
plugins: [svgr(), react(), vanillaExtractPlugin(), sentryPlugin],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"home": {
|
||||
"featured": "Destaque",
|
||||
"recently_added": "Novidades",
|
||||
"recently_added": "Recém adicionados",
|
||||
"trending": "Populares",
|
||||
"surprise_me": "Surpreenda-me",
|
||||
"no_results": "Nenhum resultado encontrado"
|
||||
|
@ -1,5 +1,4 @@
|
||||
export * from "./game.entity";
|
||||
export * from "./image-cache.entity";
|
||||
export * from "./repack.entity";
|
||||
export * from "./repacker-friendly-name.entity";
|
||||
export * from "./user-preferences.entity";
|
||||
|
@ -8,7 +8,7 @@ import { stateManager } from "@main/state-manager";
|
||||
|
||||
const { Index } = flexSearch;
|
||||
const repacksIndex = new Index();
|
||||
const steamGamesIndex = new Index();
|
||||
const steamGamesIndex = new Index({ tokenize: "forward" });
|
||||
|
||||
const repacks = stateManager.getValue("repacks");
|
||||
const steamGames = stateManager.getValue("steamGames");
|
||||
|
@ -20,6 +20,7 @@ export const startProcessWatcher = async () => {
|
||||
});
|
||||
|
||||
if (games.length === 0) {
|
||||
await sleep(sleepTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,7 @@ const getXatabRepack = (url: string) => {
|
||||
worker.removeListener("message", onMessage);
|
||||
};
|
||||
|
||||
worker.on("message", onMessage);
|
||||
worker.postMessage($downloadButton.href);
|
||||
worker.once("message", onMessage);
|
||||
})();
|
||||
});
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
import path from "node:path";
|
||||
import cp from "node:child_process";
|
||||
import crypto from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import * as Sentry from "@sentry/electron/main";
|
||||
import { Notification, app, dialog } from "electron";
|
||||
@ -98,6 +99,25 @@ export class TorrentClient {
|
||||
return game.progress;
|
||||
}
|
||||
|
||||
private static createTempIcon(encodedIcon: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = crypto.randomBytes(16).toString("hex");
|
||||
const iconPath = path.join(app.getPath("temp"), `${hash}.png`);
|
||||
|
||||
fs.writeFile(
|
||||
iconPath,
|
||||
Buffer.from(
|
||||
encodedIcon.replace("data:image/jpeg;base64,", ""),
|
||||
"base64"
|
||||
),
|
||||
(err) => {
|
||||
if (err) reject(err);
|
||||
resolve(iconPath);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public static async onSocketData(data: Buffer) {
|
||||
const message = Buffer.from(data).toString("utf-8");
|
||||
|
||||
@ -139,7 +159,10 @@ export class TorrentClient {
|
||||
});
|
||||
|
||||
if (userPreferences?.downloadNotificationsEnabled) {
|
||||
const iconPath = await this.createTempIcon(game.iconUrl);
|
||||
|
||||
new Notification({
|
||||
icon: iconPath,
|
||||
title: t("download_complete", {
|
||||
ns: "notifications",
|
||||
lng: userPreferences.language,
|
||||
|
Loading…
Reference in New Issue
Block a user