mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Feat: Add Configuration Button. user can edit config.json as wanted. Linked and IPC
This commit is contained in:
10
main.js
10
main.js
@@ -11,6 +11,13 @@ const { startRPC } = require("./server/discordRPC");
|
|||||||
|
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
const logsFolderPath = logDir;
|
const logsFolderPath = logDir;
|
||||||
|
|
||||||
|
const basePath = config.localMode
|
||||||
|
? path.join(__dirname, "config")
|
||||||
|
: path.join(path.dirname(process.execPath), "resources");
|
||||||
|
|
||||||
|
const configFolderPath = path.join(basePath, "config.json");
|
||||||
|
|
||||||
const defaultDownloadPath = path.join(os.homedir(), "Downloads", "Freedom Loader");
|
const defaultDownloadPath = path.join(os.homedir(), "Downloads", "Freedom Loader");
|
||||||
|
|
||||||
app.setAppUserModelId("com.masteracnolo.freedomloader"); // pour notifications Windows
|
app.setAppUserModelId("com.masteracnolo.freedomloader"); // pour notifications Windows
|
||||||
@@ -176,6 +183,9 @@ ipcMain.on("open-website", () => {
|
|||||||
ipcMain.on("open-wiki", () => {
|
ipcMain.on("open-wiki", () => {
|
||||||
shell.openExternal("https://masteracnolo.github.io/FreedomLoader/pages/wiki.html");
|
shell.openExternal("https://masteracnolo.github.io/FreedomLoader/pages/wiki.html");
|
||||||
});
|
});
|
||||||
|
ipcMain.on("open-config", () => {
|
||||||
|
if (configFolderPath) shell.openPath(configFolderPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// App ready
|
// App ready
|
||||||
|
|||||||
@@ -17,5 +17,6 @@ contextBridge.exposeInMainWorld("topbarAPI", {
|
|||||||
openDevTools: () => ipcRenderer.send("open-devtools"),
|
openDevTools: () => ipcRenderer.send("open-devtools"),
|
||||||
openLogs: () => ipcRenderer.send("open-logs"),
|
openLogs: () => ipcRenderer.send("open-logs"),
|
||||||
openWebsite: () => ipcRenderer.send("open-website"),
|
openWebsite: () => ipcRenderer.send("open-website"),
|
||||||
openWiki: () => ipcRenderer.send("open-wiki")
|
openWiki: () => ipcRenderer.send("open-wiki"),
|
||||||
|
openConfig: () => ipcRenderer.send("open-config")
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<button id="logs-btn" title="Logs">Logs</button>
|
<button id="logs-btn" title="Logs">Logs</button>
|
||||||
<button id="website-btn" title="Website">Website</button>
|
<button id="website-btn" title="Website">Website</button>
|
||||||
<button id="wiki-btn" title="Wiki">Wiki</button>
|
<button id="wiki-btn" title="Wiki">Wiki</button>
|
||||||
|
<button id="config-btn" title="Configuration">Configuration</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="window-controls">
|
<div class="window-controls">
|
||||||
<button id="minimize-btn" title="Réduire"><img src="assets/icon/minimize.svg"></button>
|
<button id="minimize-btn" title="Réduire"><img src="assets/icon/minimize.svg"></button>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ function setupTopbarListeners() {
|
|||||||
const logsBtn = document.getElementById('logs-btn');
|
const logsBtn = document.getElementById('logs-btn');
|
||||||
const websiteBtn = document.getElementById('website-btn');
|
const websiteBtn = document.getElementById('website-btn');
|
||||||
const wikiBtn = document.getElementById('wiki-btn');
|
const wikiBtn = document.getElementById('wiki-btn');
|
||||||
|
const configBtn = document.getElementById('config-btn');
|
||||||
|
|
||||||
if (minBtn) minBtn.onclick = () => topbarAPI.minimize();
|
if (minBtn) minBtn.onclick = () => topbarAPI.minimize();
|
||||||
if (maxBtn) maxBtn.onclick = () => topbarAPI.maximize();
|
if (maxBtn) maxBtn.onclick = () => topbarAPI.maximize();
|
||||||
@@ -18,6 +19,7 @@ function setupTopbarListeners() {
|
|||||||
if (logsBtn) logsBtn.onclick = () => topbarAPI.openLogs();
|
if (logsBtn) logsBtn.onclick = () => topbarAPI.openLogs();
|
||||||
if (websiteBtn) websiteBtn.onclick = () => topbarAPI.openWebsite();
|
if (websiteBtn) websiteBtn.onclick = () => topbarAPI.openWebsite();
|
||||||
if (wikiBtn) wikiBtn.onclick = () => topbarAPI.openWiki();
|
if (wikiBtn) wikiBtn.onclick = () => topbarAPI.openWiki();
|
||||||
|
if (configBtn) configBtn.onclick = () => topbarAPI.openConfig();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user