fix: adding fallback to language

This commit is contained in:
Chubby Granny Chaser
2025-05-09 13:18:38 +01:00
parent a01c77b424
commit eb6317e659
2 changed files with 10 additions and 11 deletions

View File

@@ -59,9 +59,11 @@ app.whenReady().then(async () => {
await loadState();
const language = await db.get<string, string>(levelKeys.language, {
valueEncoding: "utf8",
});
const language = await db
.get<string, string>(levelKeys.language, {
valueEncoding: "utf8",
})
.catch(() => "en");
if (language) i18n.changeLanguage(language);

View File

@@ -1,4 +1,4 @@
import axios, { AxiosInstance } from "axios";
import axios from "axios";
import cp from "node:child_process";
import fs from "node:fs";
@@ -31,7 +31,9 @@ const rustBinaryNameByPlatform: Partial<Record<NodeJS.Platform, string>> = {
export class PythonRPC {
public static readonly BITTORRENT_PORT = "5881";
public static readonly RPC_PORT = "8084";
public static rpc: AxiosInstance;
public static readonly rpc = axios.create({
baseURL: `http://localhost:${this.RPC_PORT}`,
});
private static pythonProcess: cp.ChildProcess | null = null;
@@ -134,12 +136,7 @@ export class PythonRPC {
this.pythonProcess = childProcess;
}
this.rpc = axios.create({
baseURL: `http://localhost:${this.RPC_PORT}`,
headers: {
"x-hydra-rpc-password": rpcPassword,
},
});
this.rpc.defaults.headers.common["x-hydra-rpc-password"] = rpcPassword;
}
public static kill() {