2022-02-26 21:26:16 +00:00
|
|
|
import {contextBridge, ipcRenderer} from "electron";
|
2022-08-25 14:10:26 +00:00
|
|
|
import * as path from "path";
|
2022-08-24 15:25:12 +00:00
|
|
|
import {addStyle} from "../utils";
|
|
|
|
import fs from "fs";
|
2022-03-04 17:53:18 +00:00
|
|
|
console.log("ArmCord Settings");
|
2022-07-15 21:04:00 +00:00
|
|
|
|
2022-02-26 21:26:16 +00:00
|
|
|
contextBridge.exposeInMainWorld("settings", {
|
2022-03-04 17:53:18 +00:00
|
|
|
save: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
2022-06-12 11:18:18 +00:00
|
|
|
getLang: (toGet: string) =>
|
|
|
|
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
|
|
|
return result;
|
|
|
|
}),
|
2022-03-04 17:53:18 +00:00
|
|
|
get: (toGet: string) =>
|
|
|
|
ipcRenderer.invoke("getSetting", toGet).then((result) => {
|
|
|
|
return result;
|
2022-07-15 21:04:00 +00:00
|
|
|
}), //jank but works
|
|
|
|
openThemesFolder: () => ipcRenderer.send("openThemesFolder"),
|
|
|
|
openPluginsFolder: () => ipcRenderer.send("openPluginsFolder"),
|
|
|
|
openStorageFolder: () => ipcRenderer.send("openStorageFolder"),
|
|
|
|
copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
|
2022-03-04 17:53:18 +00:00
|
|
|
});
|
2022-08-24 15:25:12 +00:00
|
|
|
if (ipcRenderer.sendSync("getLangName") == "en-US") {
|
2022-08-25 14:42:54 +00:00
|
|
|
console.log("[Settings]: Lang " + ipcRenderer.sendSync("getLangName"));
|
2022-08-24 15:25:12 +00:00
|
|
|
const cssPath = path.join(__dirname, "../", "/content/css/settingsEng.css");
|
2022-08-25 14:42:54 +00:00
|
|
|
document.addEventListener("DOMContentLoaded", function (event) {
|
|
|
|
addStyle(fs.readFileSync(cssPath, "utf8"));
|
|
|
|
});
|
2022-08-24 15:25:12 +00:00
|
|
|
}
|
2022-08-25 16:40:43 +00:00
|
|
|
ipcRenderer.on("themeLoader", (event, message) => {
|
|
|
|
addStyle(message);
|
|
|
|
});
|