This commit is contained in:
smartfrigde 2023-09-25 13:15:49 +02:00
parent 9ddf304663
commit b1f876de7c
3 changed files with 8 additions and 4 deletions

View file

@ -6,6 +6,7 @@ import {
checkForDataFolder,
checkIfConfigExists,
firstRun,
checkIfConfigIsBroken,
getConfig,
getConfigSync,
injectElectronFlags,
@ -70,7 +71,7 @@ if (!app.requestSingleInstanceLock() && getConfigSync("multiInstance") == (false
}
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
checkIfConfigIsBroken();
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
app.commandLine.appendSwitch(

View file

@ -26,7 +26,12 @@ export async function sleep(ms: number): Promise<void> {
}
export async function checkIfConfigIsBroken(): Promise<void> {
if ((await getConfig("0")) == "d") {
try {
let rawdata = fs.readFileSync(getConfigLocation(), "utf-8");
JSON.parse(rawdata);
console.log("Config is fine");
} catch (e) {
console.error(e);
console.log("Detected a corrupted config");
setup();
dialog.showErrorBox(

View file

@ -5,7 +5,6 @@
import {BrowserWindow, MessageBoxOptions, app, dialog, nativeImage, shell} from "electron";
import path from "path";
import {
checkIfConfigIsBroken,
contentPath,
firstRun,
getConfig,
@ -68,7 +67,6 @@ async function doAfterDefiningTheWindow(): Promise<void> {
}
}
let ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
await checkIfConfigIsBroken();
registerIpc();
if (await getConfig("mobileMode")) {
mainWindow.webContents.userAgent =