Simplify loading internal plugins
This commit is contained in:
parent
dd90d70560
commit
3d738bfe0e
1 changed files with 14 additions and 26 deletions
38
src/main.ts
38
src/main.ts
|
|
@ -37,33 +37,21 @@ const loadInject = () => {
|
||||||
|
|
||||||
mainWindow.webContents.on("dom-ready", async () => {
|
mainWindow.webContents.on("dom-ready", async () => {
|
||||||
try {
|
try {
|
||||||
const injectPath = path.join(__dirname, "inject.js");
|
const plugins: string[] = [
|
||||||
const injectCode = fs.readFileSync(injectPath, "utf8");
|
"inject.js",
|
||||||
await mainWindow.webContents.executeJavaScript(injectCode, true);
|
"LocalPlugins.js",
|
||||||
|
"aviaclientcategory.js",
|
||||||
|
"themes.js",
|
||||||
|
"aviafavsystem.js",
|
||||||
|
"pluginsupport.js",
|
||||||
|
"aviaversion.js"
|
||||||
|
];
|
||||||
|
|
||||||
const localPluginsPath = path.join(__dirname, "LocalPlugins.js");
|
for (const plugin of plugins) {
|
||||||
const localPluginsCode = fs.readFileSync(localPluginsPath, "utf8");
|
const pluginPath: string = path.join(__dirname, plugin);
|
||||||
await mainWindow.webContents.executeJavaScript(localPluginsCode, true);
|
const pluginCode: string = fs.readFileSync(pluginPath, "utf8");
|
||||||
|
|
||||||
const categoryPath = path.join(__dirname, "aviaclientcategory.js");
|
|
||||||
const categoryCode = fs.readFileSync(categoryPath, "utf8");
|
|
||||||
await mainWindow.webContents.executeJavaScript(categoryCode, true);
|
|
||||||
|
|
||||||
const themesPath = path.join(__dirname, "themes.js");
|
|
||||||
const themesCode = fs.readFileSync(themesPath, "utf8");
|
|
||||||
await mainWindow.webContents.executeJavaScript(themesCode, true);
|
|
||||||
|
|
||||||
const favPath = path.join(__dirname, "aviafavsystem.js");
|
|
||||||
const favCode = fs.readFileSync(favPath, "utf8");
|
|
||||||
await mainWindow.webContents.executeJavaScript(favCode, true);
|
|
||||||
|
|
||||||
const pluginPath = path.join(__dirname, "pluginsupport.js");
|
|
||||||
const pluginCode = fs.readFileSync(pluginPath, "utf8");
|
|
||||||
await mainWindow.webContents.executeJavaScript(pluginCode, true);
|
await mainWindow.webContents.executeJavaScript(pluginCode, true);
|
||||||
|
}
|
||||||
const badgePath = path.join(__dirname, "aviaversion.js");
|
|
||||||
const badgeCode = fs.readFileSync(badgePath, "utf8");
|
|
||||||
await mainWindow.webContents.executeJavaScript(badgeCode, true);
|
|
||||||
} catch {}
|
} catch {}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue