1
mirror of https://github.com/rvdbreemen/OTGW-firmware synced 2024-11-16 04:33:49 +01:00

rollback changes index.js

This commit is contained in:
Robert van den Breemen 2024-04-02 18:32:39 +02:00
parent 6752fdfc8e
commit 3f0320f41f
2 changed files with 64 additions and 58 deletions

View File

@ -8,10 +8,10 @@
** TERMS OF USE: MIT License. See bottom of file.
***************************************************************************
*/
"use strict";
const localURL=window.location.protocol+'//'+window.location.host;
const APIGW=localURL+'/api/';
const APIGW=window.location.protocol+'//'+window.location.host+'/api/';
"use strict";
let needReload = true;
refreshDevTime();
@ -161,19 +161,20 @@
}
//============================================================================
function refreshDevTime() {
fetch(APIGW + "v0/devtime")
function refreshDevTime()
{
//console.log("Refresh api/v0/devtime ..");
fetch(APIGW+"v0/devtime")
.then(response => response.json())
.then(json => {
const dateTime = json.devtime.find(item => item.name === "dateTime");
const message = json.devtime.find(item => item.name === "message");
if (dateTime) {
document.getElementById('theTime').innerHTML = dateTime.value;
//console.log("parsed .., data is ["+ JSON.stringify(json)+"]");
for( let i in json.devtime ){
if (json.devtime[i].name == "dateTime")
{
//console.log("Got new time ["+json.devtime[i].value+"]");
document.getElementById('theTime').innerHTML = json.devtime[i].value;
}
if (message) {
document.getElementById('message').innerHTML = message.value;
if (json.devtime[i].name == "message") document.getElementById('message').innerHTML = json.devtime[i].value;
}
})
.catch(function(error) {
@ -182,14 +183,15 @@
document.createTextNode('Error: ' + error.message)
);
});
} // refreshDevTime()
//============================================================================
function refreshFirmware() {
console.log("refreshFirmware() .. " + APIGW + "firmwarefilelist");
fetch(APIGW + "firmwarefilelist")
function refreshFirmware(){
console.log("refreshFirmware() .. "+APIGW+"firmwarefilelist");
fetch(APIGW+"firmwarefilelist")
.then(response => response.json())
.then(files => {
console.log("parsed ... data is [" + JSON.stringify(files) + "]");
console.log("parsed ... data is ["+ JSON.stringify(files)+"]");
let displayPICpage = document.getElementById('displayPICpage');
while (displayPICpage.lastChild) {
@ -227,12 +229,14 @@
rowDiv.appendChild(btn);
tableDiv.appendChild(rowDiv);
for (let i in files) {
console.log("[" + files[i].name + "]=>[" + files[i].version + "]=>[" + files[i].size + "]");
for( let i in files )
{
console.log("["+files[i].name+"]=>["+files[i].version+"]=>["+files[i].size+"]");
// var displayPICflash = document.getElementById('displayPICflash');
var rowDiv = document.createElement("div");
rowDiv.setAttribute("class", "picrow");
rowDiv.setAttribute("id", "firmware_" + files[i].name);
rowDiv.setAttribute("id", "firmware_"+files[i].name);
rowDiv.style.background = "lightblue";
//--- field Name ---
var fldDiv = document.createElement("div");
@ -254,13 +258,13 @@
btn.setAttribute("class", "piccolumn4");
var a = document.createElement('a');
// a.title = "Update";
a.href = localURL + '/pic?action=refresh&name=' + files[i].name + '&version=' + files[i].version;
a.href = localURL+'/pic?action=refresh&name='+files[i].name+'&version='+files[i].version;
var img = document.createElement('img');
img.src = localURL + '/update.png';
img.src = localURL+'/update.png';
img.title = "Update firmware from web";
img.style.width = '16px';
img.style.height = 'auto';
img.setAttribute = ("alt", "Update");
img.setAttribute=("alt", "Update");
a.appendChild(img);
btn.appendChild(a);
rowDiv.appendChild(btn);
@ -268,13 +272,13 @@
var btn = document.createElement("div");
btn.setAttribute("class", "piccolumn5");
var a = document.createElement('a');
a.href = localURL + '/pic?action=upgrade&name=' + files[i].name + '&version=' + files[i].version;
a.href = localURL+'/pic?action=upgrade&name='+files[i].name+'&version='+files[i].version;
var img = document.createElement('img');
img.src = localURL + '/system_update.png'
img.src = localURL+'/system_update.png'
img.title = "Install firmware onto pic";
img.style.width = '16px';
img.style.height = 'auto';
img.setAttribute = ("alt", "Install");
img.setAttribute=("alt", "Install");
a.appendChild(img);
btn.appendChild(a);
rowDiv.appendChild(btn);
@ -283,12 +287,14 @@
displayPICpage.appendChild(tableDiv);
})
.catch(function (error) {
.catch(function(error) {
var p = document.createElement('p');
p.appendChild(
document.createTextNode('Error: ' + error.message)
);
});
}

View File

@ -2,15 +2,15 @@
#define _VERSION_MAJOR 0
#define _VERSION_MINOR 10
#define _VERSION_PATCH 3
#define _VERSION_BUILD 2105
#define _VERSION_GITHASH "1214611"
#define _VERSION_BUILD 2106
#define _VERSION_GITHASH "6752fdf"
#define _VERSION_PRERELEASE beta
#define _VERSION_DATE "01-04-2024"
#define _VERSION_TIME "09:17:10"
#define _VERSION_DATE "02-04-2024"
#define _VERSION_TIME "18:29:36"
#define _SEMVER_CORE "0.10.3"
#define _SEMVER_BUILD "0.10.3+2105"
#define _SEMVER_GITHASH "0.10.3+1214611"
#define _SEMVER_FULL "0.10.3-beta+1214611"
#define _SEMVER_NOBUILD "0.10.3-beta (01-04-2024)"
#define _VERSION "0.10.3-beta+1214611 (01-04-2024)"
#define _SEMVER_BUILD "0.10.3+2106"
#define _SEMVER_GITHASH "0.10.3+6752fdf"
#define _SEMVER_FULL "0.10.3-beta+6752fdf"
#define _SEMVER_NOBUILD "0.10.3-beta (02-04-2024)"
#define _VERSION "0.10.3-beta+6752fdf (02-04-2024)"
//The version information is created automatically, more information here: https://github.com/rvdbreemen/autoinc-semver