@@ -197,7 +197,7 @@ <h1 class="brand-header">
197197 < img src ="./company_logo.png " alt ="Smart Parks logo " class ="brand-logo ">
198198 < span > Smart Parks - Log File Decoder</ span >
199199 </ h1 >
200- < div id ="appVersion " class ="muted " style ="margin: -2px 0 12px 0; "> App version: v1.12 </ div >
200+ < div id ="appVersion " class ="muted " style ="margin: -2px 0 12px 0; "> App version: (loading...) </ div >
201201 < div id ="errorBanner "> </ div >
202202
203203 <!-- === DECODER SECTION === -->
@@ -441,9 +441,26 @@ <h1 class="brand-header">
441441
442442 < script >
443443 const versionLabel = document . getElementById ( "appVersion" ) ;
444- const APP_VERSION = versionLabel
445- ? versionLabel . textContent . replace ( / ^ A p p v e r s i o n : \s * / i, "" ) . trim ( )
446- : "" ;
444+ let APP_VERSION = "" ;
445+
446+ async function loadAppVersion ( ) {
447+ if ( ! versionLabel ) return ;
448+ try {
449+ const resp = await fetch ( 'version.txt' , { cache : 'no-store' } ) ;
450+ if ( ! resp . ok ) throw new Error ( `version.txt responded with ${ resp . status } ` ) ;
451+ const txt = ( await resp . text ( ) ) . trim ( ) ;
452+ if ( txt ) {
453+ APP_VERSION = txt ;
454+ versionLabel . textContent = "App version: " + APP_VERSION ;
455+ } else {
456+ versionLabel . textContent = "App version: (unknown)" ;
457+ }
458+ } catch ( err ) {
459+ console . error ( 'Failed to load version.txt' , err ) ;
460+ versionLabel . textContent = "App version: (unknown)" ;
461+ }
462+ }
463+ loadAppVersion ( ) ;
447464
448465 // ---------- Error banner ----------
449466 window . onerror = function ( msg , src , line , col , err ) {
@@ -466,11 +483,6 @@ <h1 class="brand-header">
466483 const customDecoderInput = document . getElementById ( "customDecoder" ) ;
467484 const decoderSelect = document . getElementById ( "decoderSelect" ) ;
468485
469- // Version label
470- if ( versionLabel && APP_VERSION ) {
471- versionLabel . textContent = "App version: " + APP_VERSION ;
472- }
473-
474486 function loadDecoder ( callback ) {
475487 clearError ( ) ;
476488 const existing = document . getElementById ( "decoderScript" ) ;
0 commit comments