Cache clearing and v1.2.1 binaries

This commit is contained in:
Robert Strouse 2023-02-19 12:46:11 -08:00
parent c39f0e2ed8
commit f88e02b25c
4 changed files with 36 additions and 11 deletions

View file

@ -2,7 +2,7 @@
#ifndef configsettings_h #ifndef configsettings_h
#define configsettings_h #define configsettings_h
#define FW_VERSION "v1.2.0" #define FW_VERSION "v1.2.1"
enum DeviceStatus { enum DeviceStatus {
DS_OK = 0, DS_OK = 0,
DS_ERROR = 1, DS_ERROR = 1,

Binary file not shown.

Binary file not shown.

View file

@ -3,10 +3,12 @@
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" href="main.css" type="text/css" /> <link rel="stylesheet" href="main.css?v=1.2.1" type="text/css" />
<link rel="stylesheet" href="icons.css" type="text/css" /> <link rel="stylesheet" href="icons.css?v=1.2.1" type="text/css" />
<link rel="icon" type="image/png" href="favicon.png" /> <link rel="icon" type="image/png" href="favicon.png" />
<script> <script>
let appVersion = 'v1.2.1';
let reloadApp = false;
document.oncontextmenu = (event) => { event.preventDefault(); event.stopPropagation(); return false; } document.oncontextmenu = (event) => { event.preventDefault(); event.stopPropagation(); return false; }
class General { class General {
async init() { async init() {
@ -14,6 +16,18 @@
this.setTimeZones(); this.setTimeZones();
this.loadGeneral(); this.loadGeneral();
}; };
reload() {
let addMetaTag = (name, content) => {
let meta = document.createElement('meta');
meta.httpEquiv = name;
meta.content = content;
document.getElementsByTagName('head')[0].appendChild(meta);
}
addMetaTag('pragma', 'no-cache');
addMetaTag('expires', '0');
addMetaTag('cache-control', 'no-cache');
document.location.reload();
}
timeZones = [ timeZones = [
{ city: "Africa/Abidjan", code: "GMT0" }, { city: "Africa/Abidjan", code: "GMT0" },
{ city: "Africa/Addis_Ababa", code: "EAT-3" }, { city: "Africa/Addis_Ababa", code: "EAT-3" },
@ -129,6 +143,7 @@
break; break;
} }
} }
general.setAppVersion();
document.getElementById('spanFwVersion').innerText = settings.fwVersion; document.getElementById('spanFwVersion').innerText = settings.fwVersion;
document.getElementsByName('hostname')[0].value = settings.hostname; document.getElementsByName('hostname')[0].value = settings.hostname;
document.getElementsByName('ntptimeserver')[0].value = settings.ntpServer; document.getElementsByName('ntptimeserver')[0].value = settings.ntpServer;
@ -139,7 +154,7 @@
}); });
}; };
setAppVersion() { document.getElementById('spanAppVersion').innerText = 'v1.2.0'; }; setAppVersion() { document.getElementById('spanAppVersion').innerText = appVersion; };
setTimeZones() { setTimeZones() {
let dd = document.getElementById('selTimeZone'); let dd = document.getElementById('selTimeZone');
dd.length = 0; dd.length = 0;
@ -1185,6 +1200,7 @@
}; };
updateApplication() { updateApplication() {
let div = this.createFileUploader('/updateApplication'); let div = this.createFileUploader('/updateApplication');
reloadApp = true;
let inst = div.querySelector('div[id=divInstText]'); let inst = div.querySelector('div[id=divInstText]');
inst.innerHTML = '<div style="font-size:14px;margin-bottom:20px;">Select a binary file containing the littlefs data for the application then press the Upload File button.</div>'; inst.innerHTML = '<div style="font-size:14px;margin-bottom:20px;">Select a binary file containing the littlefs data for the application then press the Upload File button.</div>';
document.getElementById('fsUpdates').appendChild(div); document.getElementById('fsUpdates').appendChild(div);
@ -1234,7 +1250,7 @@
}; };
var firmware = new Firmware(); var firmware = new Firmware();
function setAppVersion() { document.getElementById('spanAppVersion').innerText = 'v1.0.8'; } function setAppVersion() { document.getElementById('spanAppVersion').innerText = appVersion; }
Number.prototype.round = function (dec) { return Number(Math.round(this + 'e' + dec) + 'e-' + dec); }; Number.prototype.round = function (dec) { return Number(Math.round(this + 'e' + dec) + 'e-' + dec); };
Number.prototype.fmt = function (format, empty) { Number.prototype.fmt = function (format, empty) {
if (isNaN(this)) return empty || ''; if (isNaN(this)) return empty || '';
@ -1490,12 +1506,17 @@
let errs = document.getElementsByClassName('socket-error'); let errs = document.getElementsByClassName('socket-error');
for (let i = 0; i < errs.length; i++) for (let i = 0; i < errs.length; i++)
errs[i].remove(); errs[i].remove();
if (reloadApp) {
general.reload();
}
else {
(async () => { (async () => {
await general.init(); await general.init();
await somfy.init(); await somfy.init();
await mqtt.init(); await mqtt.init();
await wifi.init(); await wifi.init();
})(); })();
}
}; };
socket.onclose = (evt) => { socket.onclose = (evt) => {
if (document.getElementsByClassName('socket-wait') === 0) if (document.getElementsByClassName('socket-wait') === 0)
@ -1832,6 +1853,10 @@
<button id="btnUpdateApplication" type="button" onclick="firmware.updateApplication();"> <button id="btnUpdateApplication" type="button" onclick="firmware.updateApplication();">
Update Application Update Application
</button> </button>
<button id="btnUpdateApplication" type="button" onclick="general.reload();">
Refresh Cache
</button>
</div> </div>
</form> </form>
</fieldset> </fieldset>