Get electron and application versions dynamically.

This commit is contained in:
Keith Maika 2022-01-07 13:53:19 -05:00
parent e7482bc6cb
commit ac7a137f4e
No known key found for this signature in database
GPG Key ID: F71740E8722C75F1
4 changed files with 19 additions and 3 deletions

View File

@ -1,11 +1,11 @@
const angApp = angular.module('app', [])
angApp.constant('AppInfo', {
APP_NAME: 'Converse Desktop',
APP_VERSION: 'v0.1.0',
APP_VERSION: await api.getApplicationVersion(),
APP_HOME: 'https://github.com/conversejs/converse-desktop',
APP_RELEASES_CHECK_URL: 'https://api.github.com/repos/conversejs/converse-desktop/releases',
APP_RELEASES_URL: 'https://github.com/conversejs/converse-desktop/releases',
ELECTRON_VERSION: '13.6.6'
ELECTRON_VERSION: await api.getElectronVersion()
});
export default angApp;

View File

@ -6,7 +6,7 @@
class="chimeverse-branding__img" />
</div>
<div class="about-card__description">
<h3 class="about__title">About {{appInfo.APP_NAME}} {{appInfo.APP_VERSION}}</h3>
<h3 class="about__title">About {{appInfo.APP_NAME}} v{{appInfo.APP_VERSION}}</h3>
<div class="about__description">Jabber/XMPP client based on Converse.js and Electron</div>
<div>&nbsp;</div>
<div class="about__converse-version">

View File

@ -141,6 +141,14 @@ function createWindow() {
return mainWindow.reload();
})
ipcMain.handle('getApplicationVersion', () => {
return app.getVersion();
});
ipcMain.handle('getElectronVersion', () => {
return process.versions.electron;
});
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows

View File

@ -15,6 +15,14 @@ contextBridge.exposeInMainWorld('api', {
ipcRenderer.send('reload')
},
getApplicationVersion() {
return ipcRenderer.invoke('getApplicationVersion');
},
getElectronVersion() {
return ipcRenderer.invoke('getElectronVersion');
},
electronSettings: {
hasSync(setting) {
return ipcRenderer.sendSync('electron-settings', 'hasSync', setting)