fix: show dynamic app version everywhere in UI

- Add get-app-version IPC handler in main.js (returns app.getVersion())
- Expose electronAPI.getAppVersion() in preload.js
- index.html: replace hardcoded v4.2.0 span with dynamic population
  from getAppVersion() in DOMContentLoaded
- welcome.js: accept appVersion param instead of hardcoded 4.1.0
- renderer.js: pass live version to createWelcomeContent()
- main.js about screen: use app.getVersion() instead of hardcoded 4.1.0
- Update stale @version 4.1.0 JSDoc comments to 4.3.0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-23 23:31:18 +05:30
co-authored by Copilot
parent a6747b12f0
commit 94ec3f45ce
8 changed files with 22 additions and 12 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
* Implements file system operations for Electron using IPC.
* This abstracts file operations to enable easier testing and migration.
*
* @version 4.1.0
* @version 4.3.0
*/
/**
+1 -1
View File
@@ -5,7 +5,7 @@
* Adapters abstract file system, conversion, and system operations
* to enable easier testing and future platform migration.
*
* @version 4.1.0
* @version 4.3.0
*/
/**
+1 -1
View File
@@ -31,7 +31,7 @@
<span class="app-title">MarkdownConverter</span>
</div>
<div class="app-header-right">
<span class="app-version">v4.2.0</span>
<span class="app-version" id="app-version-display"></span>
</div>
</div>
<div class="tab-bar" id="tab-bar" role="tablist" aria-label="Document tabs">
+2 -1
View File
@@ -317,6 +317,7 @@ ipcMain.handle('plugin-settings:get', (_event, key) => {
ipcMain.handle('plugin-settings:set', (_event, { key, value }) => {
store.set(key, value);
});
ipcMain.handle('get-app-version', () => app.getVersion());
let mainWindow;
let currentFile = null; // This will now represent the active tab's file
@@ -1064,7 +1065,7 @@ function showAboutDialog() {
<body>
<img src="${iconBase64}" class="logo" alt="MarkdownConverter">
<h1>MarkdownConverter</h1>
<div class="version">Version 4.1.0</div>
<div class="version">Version ${app.getVersion()}</div>
<div class="company">
<span>by</span>
+4 -2
View File
@@ -9,7 +9,7 @@
* - All IPC channels are explicitly whitelisted
* - Prevents XSS from escalating to full system access
*
* @version 4.1.0
* @version 4.3.0
*/
const { contextBridge, ipcRenderer } = require('electron');
@@ -433,7 +433,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
generators: {
openAscii: () => ipcRenderer.send('open-ascii-generator'),
openTable: () => ipcRenderer.send('open-table-generator')
}
},
getAppVersion: () => ipcRenderer.invoke('get-app-version')
});
// Log successful preload initialization
+10 -3
View File
@@ -1,6 +1,6 @@
/**
* MarkdownConverter Renderer Process
* @version 4.1.0
* @version 4.3.0
*/
const { ipcRenderer } = require('electron');
@@ -1442,11 +1442,17 @@ class TabManager {
let tabManager;
let replPanel;
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('DOMContentLoaded', async () => {
tabManager = new TabManager();
const ReplPanel = getReplPanel();
replPanel = new ReplPanel();
// Populate app version from main process
window.electronAPI.getAppVersion().then((version) => {
const el = document.getElementById('app-version-display');
if (el) el.textContent = `v${version}`;
});
// Initialize ModalManager for all dialogs
const findModal = new ModalManager('#find-dialog');
const exportModal = new ModalManager('#export-dialog');
@@ -1613,7 +1619,8 @@ document.addEventListener('DOMContentLoaded', () => {
// Set welcome content in the first tab's preview
const recentFiles = JSON.parse(localStorage.getItem('recentFiles') || '[]');
const welcomeHtml = getCreateWelcomeContent()(recentFiles);
const appVersion = await window.electronAPI.getAppVersion().catch(() => '');
const welcomeHtml = getCreateWelcomeContent()(recentFiles, appVersion);
const tab = tabManager.tabs.get(tabManager.activeTabId);
if (tab) {
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* ModalManager - Unified modal system with accessibility support
* @version 4.1.0
* @version 4.3.0
*/
class ModalManager {
#modal;
+2 -2
View File
@@ -1,4 +1,4 @@
function createWelcomeContent(recentFiles = []) {
function createWelcomeContent(recentFiles = [], appVersion = '') {
const recentHtml = recentFiles.length
? recentFiles.map(f => {
const name = f.split(/[/\\]/).pop();
@@ -10,7 +10,7 @@ function createWelcomeContent(recentFiles = []) {
<div class="welcome-container">
<div class="welcome-hero">
<h1 class="welcome-title">MarkdownConverter</h1>
<p class="welcome-version">Version 4.1.0</p>
<p class="welcome-version">${appVersion ? `Version ${appVersion}` : ''}</p>
<p class="welcome-subtitle">Professional Markdown Editor & Universal Document Converter</p>
</div>