mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 20:16:55 +03:00
Revert "consolidate test-ip definition, added missing Access-Control-Allow-Origin,"
This reverts commit 56cfeb732e.
This commit is contained in:
@@ -1,52 +1,8 @@
|
||||
|
||||
/* The UI can also be run locally, but you have to set the IP of your devide accordingly.
|
||||
* And you also might have to disable CORS in your webbrowser! */
|
||||
var domainname_for_testing = "192.168.1.153";
|
||||
|
||||
|
||||
|
||||
function gethost_Version(){
|
||||
return "1.0.0 - 20200910";
|
||||
}
|
||||
|
||||
|
||||
/* Returns the domainname with prepended protocol.
|
||||
Eg. http://watermeter.fritz.box or http://192.168.1.5 */
|
||||
function getDomainname(){
|
||||
var host = window.location.hostname;
|
||||
if (((host == "127.0.0.1") || (host == "localhost") || (host == ""))
|
||||
// && ((window.location.port == "80") || (window.location.port == ""))
|
||||
)
|
||||
|
||||
{
|
||||
console.log("Using pre-defined domainname for testing: " + domainname_for_testing);
|
||||
domainname = "http://" + domainname_for_testing
|
||||
}
|
||||
else
|
||||
{
|
||||
domainname = window.location.protocol + "//" + host;
|
||||
if (window.location.port != "") {
|
||||
domainname = domainname + ":" + window.location.port;
|
||||
}
|
||||
}
|
||||
|
||||
return domainname;
|
||||
}
|
||||
|
||||
function UpdatePage(_dosession = true){
|
||||
var zw = location.href;
|
||||
zw = zw.substr(0, zw.indexOf("?"));
|
||||
if (_dosession) {
|
||||
window.location = zw + '?session=' + Math.floor((Math.random() * 1000000) + 1);
|
||||
}
|
||||
else {
|
||||
window.location = zw;
|
||||
}
|
||||
}
|
||||
|
||||
var basepath = "http://192.168.178.22";
|
||||
|
||||
function LoadHostname() {
|
||||
_domainname = getDomainname();
|
||||
_basepath = getbasepath();
|
||||
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
@@ -63,7 +19,7 @@ function LoadHostname() {
|
||||
|
||||
// var xhttp = new XMLHttpRequest();
|
||||
try {
|
||||
url = _domainname + '/info?type=Hostname';
|
||||
url = _basepath + '/info?type=Hostname';
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
|
||||
@@ -79,7 +35,7 @@ var fwVersion = "";
|
||||
var webUiVersion = "";
|
||||
|
||||
function LoadFwVersion() {
|
||||
_domainname = getDomainname();
|
||||
_basepath = getbasepath();
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.addEventListener('load', function(event) {
|
||||
@@ -96,7 +52,7 @@ function LoadFwVersion() {
|
||||
});
|
||||
|
||||
try {
|
||||
url = _domainname + '/info?type=FirmwareVersion';
|
||||
url = _basepath + '/info?type=FirmwareVersion';
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
}
|
||||
@@ -106,7 +62,7 @@ function LoadFwVersion() {
|
||||
}
|
||||
|
||||
function LoadWebUiVersion() {
|
||||
_domainname = getDomainname();
|
||||
_basepath = getbasepath();
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.addEventListener('load', function(event) {
|
||||
@@ -122,8 +78,7 @@ function LoadWebUiVersion() {
|
||||
});
|
||||
|
||||
try {
|
||||
url = _domainname + '/info?type=HTMLVersion';
|
||||
console.log("url");
|
||||
url = _basepath + '/info?type=HTMLVersion';
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user