diff --git a/index.html b/index.html index 4086f31..dd9bc32 100644 --- a/index.html +++ b/index.html @@ -46,7 +46,7 @@ -

📡 CoreScope RX

+

📡 CoreScope RX

diff --git a/package.json b/package.json index ee97391..a245241 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "corescope-rx", - "version": "0.1.0", + "version": "0.5.0", "private": true, "type": "module", "description": "Mobile RX coverage capture for CoreScope: BLE companion → MQTT (GPS + SNR/RSSI + multibyte)", diff --git a/src/app.js b/src/app.js index 674cffc..9bc61a3 100644 --- a/src/app.js +++ b/src/app.js @@ -17,6 +17,8 @@ const els = (id) => document.getElementById(id); const state = { transport: null, gps: new Gps(), queue: new Queue(), publisher: null, heard: 0, companionPubkey: '', companionName: '', connected: false, recent: [], localMap: null }; const RECENT_MAX = 20; +// Build version, injected from package.json by Vite (see vite.config.js). +const VERSION = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : 'dev'; // SNR → colour bucket (LoRa-ish). Returns a CSS colour. function snrColor(snr) { @@ -210,6 +212,7 @@ async function disconnectAll(keepProgress) { } window.addEventListener('DOMContentLoaded', () => { + els('appver').textContent = 'v' + VERSION; setButton(); els('btnConnect').addEventListener('click', () => (state.connected ? disconnectAll() : connectAll())); els('btnClear').addEventListener('click', () => { els('log').textContent = ''; }); diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..c17fd8b --- /dev/null +++ b/vite.config.js @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite'; +import { readFileSync } from 'fs'; + +// Inject the package.json version so the app can display which build is running. +const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')); + +export default defineConfig({ + define: { + __APP_VERSION__: JSON.stringify(pkg.version), + }, +});