mirror of
https://github.com/heyman/heynote.git
synced 2024-11-24 17:03:19 +01:00
Add version number to settings dialog.
For the web app we also display the git hash.
This commit is contained in:
parent
37b62d416e
commit
295e55552b
@ -3,6 +3,7 @@ import { app, BrowserWindow, nativeTheme } from 'electron'
|
||||
|
||||
import { win } from "./index"
|
||||
import CONFIG from "../config"
|
||||
import { getVersionString } from './version'
|
||||
|
||||
let aboutWindow = null;
|
||||
|
||||
@ -33,10 +34,7 @@ export function openAboutWindow() {
|
||||
aboutWindow.loadFile(join(process.env.DIST, 'about.html'))
|
||||
}
|
||||
|
||||
let versionString = app.getVersion()
|
||||
if (CONFIG.get("settings.allowBetaVersions")) {
|
||||
versionString += " (beta channel)"
|
||||
}
|
||||
let versionString = getVersionString()
|
||||
|
||||
// don't show until content is loaded
|
||||
aboutWindow.webContents.on("did-finish-load", () => {
|
||||
|
12
electron/main/version.js
Normal file
12
electron/main/version.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { app, ipcMain } from "electron"
|
||||
import CONFIG from "../config"
|
||||
|
||||
export function getVersionString() {
|
||||
let versionString = app.getVersion()
|
||||
if (CONFIG.get("settings.allowBetaVersions")) {
|
||||
versionString += " (beta channel)"
|
||||
}
|
||||
return versionString
|
||||
}
|
||||
|
||||
ipcMain.handle("getVersion", () => getVersionString())
|
@ -100,6 +100,10 @@ contextBridge.exposeInMainWorld("heynote", {
|
||||
ipcRenderer.invoke(UPDATE_CHECK_FOR_UPDATES)
|
||||
},
|
||||
},
|
||||
|
||||
async getVersion() {
|
||||
return await ipcRenderer.invoke("getVersion")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
customBufferLocation: !!this.initialSettings.bufferPath,
|
||||
systemFonts: [[defaultFontFamily, defaultFontFamily + " (default)"]],
|
||||
defaultFontSize: defaultFontSize,
|
||||
appVersion: "",
|
||||
}
|
||||
},
|
||||
|
||||
@ -56,6 +57,8 @@
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
this.$refs.keymapSelector.focus()
|
||||
|
||||
this.appVersion = await window.heynote.getVersion()
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
@ -134,8 +137,7 @@
|
||||
@click="activeTab = 'appearance'"
|
||||
/>
|
||||
<TabListItem
|
||||
v-if="!isWebApp"
|
||||
name="Updates"
|
||||
:name="isWebApp ? 'Version' : 'Updates'"
|
||||
tab="updates"
|
||||
:activeTab="activeTab"
|
||||
@click="activeTab = 'updates'"
|
||||
@ -292,8 +294,15 @@
|
||||
</div>
|
||||
</TabContent>
|
||||
|
||||
<TabContent tab="updates" :activeTab="activeTab" v-if="!isWebApp">
|
||||
<TabContent tab="updates" :activeTab="activeTab">
|
||||
<div class="row">
|
||||
<div class="entry">
|
||||
<h2>Current Version</h2>
|
||||
<b>{{ appVersion }}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" v-if="!isWebApp">
|
||||
<div class="entry">
|
||||
<h2>Auto Update</h2>
|
||||
<label>
|
||||
@ -306,7 +315,7 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="!isWebApp">
|
||||
<div class="entry">
|
||||
<h2>Beta Versions</h2>
|
||||
<label>
|
||||
|
@ -148,6 +148,10 @@ const Heynote = {
|
||||
currencyData = JSON.parse(await response.text())
|
||||
return currencyData
|
||||
},
|
||||
|
||||
async getVersion() {
|
||||
return __APP_VERSION__ + " (" + __GIT_HASH__ + ")"
|
||||
},
|
||||
}
|
||||
|
||||
export { Heynote, ipcRenderer}
|
||||
|
@ -2,8 +2,8 @@ import path from 'path'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
//import { directoryPlugin } from "vite-plugin-list-directory-contents";
|
||||
|
||||
import * as child from "child_process";
|
||||
|
||||
const middleware = () => {
|
||||
return {
|
||||
@ -33,7 +33,6 @@ export default defineConfig({
|
||||
|
||||
plugins: [
|
||||
vue(),
|
||||
//directoryPlugin({ baseDir: __dirname }),
|
||||
],
|
||||
|
||||
css: {
|
||||
@ -51,4 +50,9 @@ export default defineConfig({
|
||||
'@': path.resolve(__dirname, '..'),
|
||||
},
|
||||
},
|
||||
|
||||
define: {
|
||||
'__APP_VERSION__': JSON.stringify(process.env.npm_package_version),
|
||||
'__GIT_HASH__': JSON.stringify(child.execSync('git rev-parse --short HEAD').toString().trim()),
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user