mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-11 07:01:38 +02:00
added update information to index.html
This commit is contained in:
parent
4f962ff962
commit
75628ad230
3 changed files with 23 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
* fix Update button protection (prevent double click #527)
|
* fix Update button protection (prevent double click #527)
|
||||||
* optimized scheduler #515 (thx @beegee3)
|
* optimized scheduler #515 (thx @beegee3)
|
||||||
* potential fix of #526 duplicates in API `/api/record/live`
|
* potential fix of #526 duplicates in API `/api/record/live`
|
||||||
|
* added update information to `index.html`
|
||||||
|
|
||||||
## 0.5.62
|
## 0.5.62
|
||||||
* fix MQTT `status` update
|
* fix MQTT `status` update
|
||||||
|
|
|
@ -54,7 +54,6 @@ class RestApi {
|
||||||
AsyncJsonResponse* response = new AsyncJsonResponse(false, 8192);
|
AsyncJsonResponse* response = new AsyncJsonResponse(false, 8192);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
Inverter<> *iv = mSys->getInverterByPos(0, false);
|
|
||||||
String path = request->url().substring(5);
|
String path = request->url().substring(5);
|
||||||
if(path == "html/system") getHtmlSystem(root);
|
if(path == "html/system") getHtmlSystem(root);
|
||||||
else if(path == "html/logout") getHtmlLogout(root);
|
else if(path == "html/logout") getHtmlLogout(root);
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
var tickCnt = 0;
|
var tickCnt = 0;
|
||||||
var ts = 0;
|
var ts = 0;
|
||||||
var commInfo = "";
|
var commInfo = "";
|
||||||
|
var release = null;
|
||||||
|
|
||||||
function apiCb(obj) {
|
function apiCb(obj) {
|
||||||
var e = document.getElementById("apiResult");
|
var e = document.getElementById("apiResult");
|
||||||
|
@ -198,7 +199,7 @@
|
||||||
document.getElementById("iv").replaceChildren(p);
|
document.getElementById("iv").replaceChildren(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseWarnInfo(warn, success) {
|
function parseWarnInfo(warn, success, version) {
|
||||||
var p = div(["none"]);
|
var p = div(["none"]);
|
||||||
for(var w of warn) {
|
for(var w of warn) {
|
||||||
p.append(svg(iconWarn, 20, 20, "#F70", "icon"), span(w), br());
|
p.append(svg(iconWarn, 20, 20, "#F70", "icon"), span(w), br());
|
||||||
|
@ -209,6 +210,14 @@
|
||||||
|
|
||||||
if(commInfo.length > 0)
|
if(commInfo.length > 0)
|
||||||
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span(commInfo), br());
|
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span(commInfo), br());
|
||||||
|
|
||||||
|
if(null != release) {
|
||||||
|
if(getVerInt(version) < getVerInt(release))
|
||||||
|
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("Update available, current released version: " + release), br());
|
||||||
|
else if(getVerInt(version) > getVerInt(release))
|
||||||
|
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("You are using a development version, current released version: " + release), br());
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("warn_info").replaceChildren(p);
|
document.getElementById("warn_info").replaceChildren(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,14 +237,25 @@
|
||||||
parseGeneric(obj["generic"]);
|
parseGeneric(obj["generic"]);
|
||||||
parseSys(obj);
|
parseSys(obj);
|
||||||
parseIv(obj["inverter"]);
|
parseIv(obj["inverter"]);
|
||||||
parseWarnInfo(obj["warnings"], obj["infos"]);
|
parseWarnInfo(obj["warnings"], obj["infos"], obj["generic"]["version"]);
|
||||||
if(exeOnce) {
|
if(exeOnce) {
|
||||||
window.setInterval("tick()", 1000);
|
window.setInterval("tick()", 1000);
|
||||||
exeOnce = false;
|
exeOnce = false;
|
||||||
|
getAjax("https://api.github.com/repos/lumapu/ahoy/releases/latest", parseRelease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getVerInt(ver) {
|
||||||
|
var a = ver.split('.');
|
||||||
|
return (a[0] << 24) | (a[1] << 16) | a[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseRelease(obj) {
|
||||||
|
release = obj["name"].substring(6);
|
||||||
|
}
|
||||||
|
|
||||||
getAjax("/api/index", parse);
|
getAjax("/api/index", parse);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue