mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-04-20 11:02:14 +02:00
updated code logic to pic FW/App version from appversion instead of hard-coding in js/html/cpp files
This commit is contained in:
parent
bb61a1703d
commit
fe4aa83ed2
8 changed files with 78 additions and 155 deletions
|
|
@ -1 +1 @@
|
|||
2.4.8
|
||||
2.5.0
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
<meta name="apple-mobile-web-app-title" content="ESPSomfy RTS App">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="main.css?v=2.4.8c" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.4.8c" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.4.8c" type="text/css" />
|
||||
<link rel="stylesheet" href="main.css" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
|
||||
<!-- iPad retina icon -->
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
rel="apple-touch-startup-image">
|
||||
|
||||
|
||||
<script type="text/javascript" src="index.js?v=2.4.8c"></script>
|
||||
<script type="text/javascript" src="index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divContainer" class="container main" data-auth="false">
|
||||
|
|
|
|||
|
|
@ -1267,9 +1267,27 @@ class Security {
|
|||
}
|
||||
var security = new Security();
|
||||
|
||||
// let appVersion = 'v0.0.0'; // Default placeholder
|
||||
async function getAppVersion() {
|
||||
try {
|
||||
const response = await fetch('/appversion');
|
||||
if (!response.ok) throw new Error('File not found');
|
||||
|
||||
const data = await response.text();
|
||||
appVersion = `v${data.trim()}`;
|
||||
|
||||
console.log("Loaded Version:", appVersion);
|
||||
// Trigger any UI updates here
|
||||
} catch (error) {
|
||||
console.error("Error loading App version:", error);
|
||||
appVersion = 'v0.0.0'; // Default placeholder
|
||||
}
|
||||
return appVersion;
|
||||
}
|
||||
|
||||
class General {
|
||||
initialized = false;
|
||||
appVersion = 'v2.4.8';
|
||||
appVersion = getAppVersion();
|
||||
reloadApp = false;
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
|
|
@ -4815,3 +4833,15 @@ class Firmware {
|
|||
}
|
||||
var firmware = new Firmware();
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
// 1. Initialize your main application logic
|
||||
// await init();
|
||||
|
||||
// 2. Fetch and display the app version
|
||||
appVersion = await getAppVersion();
|
||||
const spanAppVersion = document.getElementById('spanAppVersion');
|
||||
spanAppVersion.innerText = `${appVersion.trim()}`;
|
||||
|
||||
console.log("Application fully loaded and version updated.");
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue