Fix settings saving

This commit is contained in:
smartfrigde 2022-04-17 20:55:30 +02:00
parent 16531fa922
commit 03e45c272c
3 changed files with 16 additions and 15 deletions

View file

@ -67,15 +67,15 @@
loadSettings();
document.getElementById("save").addEventListener("click", function () {
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
settings.save(
document.getElementById("theme").value,
document.getElementById("channel").value,
document.getElementById("csp").checked,
document.getElementById("tray").checked,
document.getElementById("patches").checked,
document.getElementById("mod").value,
"acrylic"
);
settings.save({
windowStyle: document.getElementById("theme").value,
channel: document.getElementById("channel").value,
armcordCSP: document.getElementById("csp").checked,
minimizeToTray: document.getElementById("tray").checked,
automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value,
blurType: "acrylic"
});
});
</script>
</html>

View file

@ -1,6 +1,6 @@
import * as storage from "electron-json-storage";
import * as fs from "fs";
import {app} from "electron";
import {app, dialog} from "electron";
import path from "path";
export var firstRun: boolean;
@ -21,10 +21,11 @@ export async function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export async function checkIfConfigIsNew() {
if (await getConfigUnsafe("automaticPatches") == undefined) {
console.log("Outdated config")
export async function checkIfConfigIsBroken() {
if (await getConfigUnsafe("0") == "d") {
console.log("Detected a corrupted config")
setup()
dialog.showErrorBox("Oops, something went wrong.", "ArmCord has detected that your configuration file is corrupted, please restart the app and set your settings again. If this issue persists, report it on the support server/Github issues.")
}
}

View file

@ -5,7 +5,7 @@
import {BrowserWindow, shell, app, ipcMain, dialog} from "electron";
import path from "path";
import {contentPath} from "./main";
import {checkIfConfigIsNew, firstRun, getConfigUnsafe} from "./utils";
import {checkIfConfigIsBroken, firstRun, getConfigUnsafe} from "./utils";
import {registerIpc} from "./ipc";
import contextMenu from "electron-context-menu";
export let mainWindow: BrowserWindow;
@ -19,7 +19,7 @@ contextMenu({
});
function doAfterDefiningTheWindow() {
checkIfConfigIsNew();
checkIfConfigIsBroken()
registerIpc();
mainWindow.webContents.userAgent =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"; //fake useragent for screenshare to work