mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
fix theme loading
This commit is contained in:
parent
6f6a5b2ca8
commit
f2cfcbfb5d
3 changed files with 46 additions and 42 deletions
|
@ -54,21 +54,28 @@ export function createSettingsWindow(): void {
|
||||||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||||
}
|
}
|
||||||
settingsWindow.webContents.on("did-finish-load", () => {
|
settingsWindow.webContents.on("did-finish-load", () => {
|
||||||
if (!settingsWindow.webContents.isLoading()) {
|
|
||||||
fs.readdirSync(themesFolder).forEach((file) => {
|
fs.readdirSync(themesFolder).forEach((file) => {
|
||||||
try {
|
try {
|
||||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||||
let themeFile = JSON.parse(manifest);
|
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 {
|
||||||
settingsWindow.webContents.send(
|
settingsWindow.webContents.send(
|
||||||
"themeLoader",
|
"themeLoader",
|
||||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||||
);
|
);
|
||||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
ipcMain.on("saveSettings", (_event, args: Settings) => {
|
ipcMain.on("saveSettings", (_event, args: Settings) => {
|
||||||
console.log(args);
|
console.log(args);
|
||||||
|
|
|
@ -195,16 +195,15 @@ export function createTManagerWindow(): void {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
themeWindow.webContents.on("did-finish-load", () => {
|
themeWindow.webContents.on("did-finish-load", () => {
|
||||||
if (!themeWindow.webContents.isLoading()) {
|
|
||||||
fs.readdirSync(themesFolder).forEach((file) => {
|
fs.readdirSync(themesFolder).forEach((file) => {
|
||||||
try {
|
try {
|
||||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||||
|
console.log(manifest);
|
||||||
themeWindow.webContents.send("themeManifest", manifest);
|
themeWindow.webContents.send("themeManifest", manifest);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
managerLoadPage();
|
managerLoadPage();
|
||||||
|
|
|
@ -195,7 +195,6 @@ async function doAfterDefiningTheWindow(): Promise<void> {
|
||||||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||||
}
|
}
|
||||||
mainWindow.webContents.on("did-finish-load", () => {
|
mainWindow.webContents.on("did-finish-load", () => {
|
||||||
if (!mainWindow.webContents.isLoading()) {
|
|
||||||
fs.readdirSync(themesFolder).forEach((file) => {
|
fs.readdirSync(themesFolder).forEach((file) => {
|
||||||
try {
|
try {
|
||||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||||
|
@ -218,7 +217,6 @@ async function doAfterDefiningTheWindow(): Promise<void> {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
await setMenu();
|
await setMenu();
|
||||||
mainWindow.on("close", async (e) => {
|
mainWindow.on("close", async (e) => {
|
||||||
|
|
Loading…
Reference in a new issue