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