mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add potential workarounds for renderer crash
This commit is contained in:
parent
a531d4e30f
commit
5aefe765ec
4 changed files with 59 additions and 46 deletions
|
@ -21,6 +21,11 @@ import {createSplashWindow} from "./splash/main";
|
|||
export let iconPath: string;
|
||||
export let settings: any;
|
||||
export let customTitlebar: boolean;
|
||||
app.on("render-process-gone", (event, webContents, details) => {
|
||||
if (details.reason == "crashed") {
|
||||
app.relaunch();
|
||||
}
|
||||
});
|
||||
async function args(): Promise<void> {
|
||||
let argNum = 2;
|
||||
if (process.argv[0] == "electron") argNum++;
|
||||
|
|
|
@ -54,19 +54,21 @@ export function createSettingsWindow(): void {
|
|||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||
}
|
||||
settingsWindow.webContents.on("did-finish-load", () => {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
settingsWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
if (!settingsWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
settingsWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ipcMain.on("saveSettings", (_event, args: Settings) => {
|
||||
console.log(args);
|
||||
|
|
|
@ -195,14 +195,16 @@ export function createTManagerWindow(): void {
|
|||
}
|
||||
});
|
||||
themeWindow.webContents.on("did-finish-load", () => {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
themeWindow.webContents.send("themeManifest", manifest);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
if (!themeWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
themeWindow.webContents.send("themeManifest", manifest);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
managerLoadPage();
|
||||
|
|
|
@ -198,28 +198,30 @@ async function doAfterDefiningTheWindow(): Promise<void> {
|
|||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||
}
|
||||
mainWindow.webContents.on("did-finish-load", () => {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
if (
|
||||
fs
|
||||
.readFileSync(path.join(userDataPath, "/disabled.txt"))
|
||||
.toString()
|
||||
.includes(themeFile.name.replace(" ", "-"))
|
||||
) {
|
||||
console.log(`%cSkipped ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} else {
|
||||
mainWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
if (!mainWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
if (
|
||||
fs
|
||||
.readFileSync(path.join(userDataPath, "/disabled.txt"))
|
||||
.toString()
|
||||
.includes(themeFile.name.replace(" ", "-"))
|
||||
) {
|
||||
console.log(`%cSkipped ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} else {
|
||||
mainWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
await setMenu();
|
||||
mainWindow.on("close", async (e) => {
|
||||
|
@ -370,9 +372,11 @@ export async function createInviteWindow(code: string): Promise<void> {
|
|||
});
|
||||
inviteWindow.loadURL(formInviteURL);
|
||||
inviteWindow.webContents.once("did-finish-load", () => {
|
||||
inviteWindow.show();
|
||||
inviteWindow.webContents.once("will-navigate", () => {
|
||||
inviteWindow.close();
|
||||
});
|
||||
if (!mainWindow.webContents.isLoading()) {
|
||||
inviteWindow.show();
|
||||
inviteWindow.webContents.once("will-navigate", () => {
|
||||
inviteWindow.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue