Feat: Add version badge controlled. Before we needed to write with the hand for the front. But now there is an IPC event that provide App Version from package.json

This commit is contained in:
MasterAcnolo
2026-01-15 09:03:50 +01:00
parent a69114edce
commit 745a73a5b0
4 changed files with 10 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ const defaultDownloadPath = path.join(os.homedir(), "Downloads", "Freedom Loader
app.setAppUserModelId("com.masteracnolo.freedomloader"); // pour notifications Windows
app.disableHardwareAcceleration();
ipcMain.handle("version", () => config.version);
// Gestion single instance
const gotLock = app.requestSingleInstanceLock();

View File

@@ -5,6 +5,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
selectDownloadFolder: () => ipcRenderer.invoke("select-download-folder"),
setProgress: (percent) => ipcRenderer.send("set-progress", percent),
getFeatures: () => ipcRenderer.invoke("features"),
getVersion: () => ipcRenderer.invoke("version"),
getValidatedDownloadPath: (path) => ipcRenderer.invoke("validate-download-path", path)
});

View File

@@ -95,10 +95,11 @@
<div id="videoInfo" style="margin-top: 20px;"></div>
</div>
<span id="version-badge" class="version-badge">v1.3.1</span>
<span id="version-badge" class="version-badge"></span>
<!-- Scripts -->
<script src="script/custompath.js"></script>
<script src="script/appVersion.js"></script>
<script src="script/downloadstatus.js"></script>
<script src="script/fetchinfo.js"></script>
<script src="script/progressBar.js"></script>

View File

@@ -0,0 +1,6 @@
async function versionLabel(){
const appVersion = await window.electronAPI.getVersion();
document.getElementById("version-badge").textContent = `v${appVersion}`;
};
versionLabel();