Bugfix reverse proxy path detection
This commit is contained in:
parent
dfb8de2349
commit
eb8e95723c
@ -363,7 +363,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button class="btn infobtn" onclick="requestJson()">Refresh</button>
|
<button class="btn infobtn" onclick="requestJson()">Refresh</button>
|
||||||
<button class="btn infobtn" onclick="toggleNodes()">Instance List</button>
|
<button class="btn infobtn" onclick="toggleNodes()">Instance List</button>
|
||||||
<button class="btn infobtn" onclick="window.open('/update','_self');">Update WLED</button>
|
<button class="btn infobtn" onclick="window.open(getURL('/update'),'_self');">Update WLED</button>
|
||||||
<button class="btn infobtn" id="resetbtn" onclick="cnfReset()">Reboot WLED</button>
|
<button class="btn infobtn" id="resetbtn" onclick="cnfReset()">Reboot WLED</button>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
@ -204,7 +204,8 @@ function getURL(path) {
|
|||||||
}
|
}
|
||||||
function onLoad()
|
function onLoad()
|
||||||
{
|
{
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -213,12 +214,12 @@ function onLoad()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy and/or HTTPS
|
// detect reverse proxy and/or HTTPS
|
||||||
let l = window.location;
|
|
||||||
let pathn = l.pathname;
|
let pathn = l.pathname;
|
||||||
let paths = pathn.slice(1,pathn.endsWith('/')?-1:undefined).split("/");
|
let paths = pathn.slice(1,pathn.endsWith('/')?-1:undefined).split("/");
|
||||||
|
//while (paths[0]==="") paths.shift();
|
||||||
locproto = l.protocol;
|
locproto = l.protocol;
|
||||||
locip = l.hostname + (l.port ? ":" + l.port : "")
|
locip = l.hostname + (l.port ? ":" + l.port : "");
|
||||||
if (paths.length > 1) {
|
if (paths.length > 0 && paths[0]!=="") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip += "/" + paths[0];
|
locip += "/" + paths[0];
|
||||||
} else if (locproto==="https:") {
|
} else if (locproto==="https:") {
|
||||||
@ -2594,7 +2595,7 @@ function cnfReset()
|
|||||||
bt.innerHTML = "Confirm Reboot";
|
bt.innerHTML = "Confirm Reboot";
|
||||||
cnfr = true; return;
|
cnfr = true; return;
|
||||||
}
|
}
|
||||||
window.location.href = "/reset";
|
window.location.href = getURL("/reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
var cnfrS = false;
|
var cnfrS = false;
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -36,12 +37,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 1) {
|
if (paths.length > 1) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=0'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=0'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -44,12 +45,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=10'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=10'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S(){
|
function S(){
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -63,12 +64,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=7'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=7'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -547,7 +547,8 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function S(){
|
function S(){
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -556,12 +557,12 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=2'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=2'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -65,7 +65,8 @@
|
|||||||
x.setAttribute("download","wled_" + x.getAttribute("download") + (sd=="WLED"?"":("_" +sd)));
|
x.setAttribute("download","wled_" + x.getAttribute("download") + (sd=="WLED"?"":("_" +sd)));
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -74,12 +75,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=6'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=6'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Sync Settings</title>
|
<title>Sync Settings</title>
|
||||||
<script>var d=document;
|
<script>var d=document;
|
||||||
var loc = false, locip, locproto;
|
var loc = false, locip, locproto = "http:";
|
||||||
function gId(s){return d.getElementById(s);}
|
function gId(s){return d.getElementById(s);}
|
||||||
function toggle(el){gId(el).classList.toggle("hide"); gId('No'+el).classList.toggle("hide");}
|
function toggle(el){gId(el).classList.toggle("hide"); gId('No'+el).classList.toggle("hide");}
|
||||||
function H(){window.open("https://kno.wled.ge/interfaces/udp-notifier/");}
|
function H(){window.open("https://kno.wled.ge/interfaces/udp-notifier/");}
|
||||||
@ -56,8 +56,8 @@
|
|||||||
function SP(){var p = d.Sf.DI.value; gId("xp").style.display = (p > 0)?"none":"block"; if (p > 0) d.Sf.EP.value = p;}
|
function SP(){var p = d.Sf.DI.value; gId("xp").style.display = (p > 0)?"none":"block"; if (p > 0) d.Sf.EP.value = p;}
|
||||||
function SetVal(){switch(parseInt(d.Sf.EP.value)){case 5568: d.Sf.DI.value = 5568; break; case 6454: d.Sf.DI.value = 6454; break; case 4048: d.Sf.DI.value = 4048; break; }; SP();FC();}
|
function SetVal(){switch(parseInt(d.Sf.EP.value)){case 5568: d.Sf.DI.value = 5568; break; case 6454: d.Sf.DI.value = 6454; break; case 4048: d.Sf.DI.value = 4048; break; }; SP();FC();}
|
||||||
function S(){
|
function S(){
|
||||||
locproto = "http:";
|
let l = window.location;
|
||||||
if (window.location.protocol == "file:") {
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -66,11 +66,11 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let paths = window.location.pathname.slice(1,window.location.pathname.endsWith('/')?-1:0).split("/");
|
let paths = l.pathname.slice(1,l.pathname.endsWith('/')?-1:0).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=4'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=4'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -42,12 +43,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=5'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=5'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -186,7 +186,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -195,12 +196,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=3'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=3'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
@ -47,7 +47,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -56,12 +57,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ldS();
|
ldS();
|
||||||
|
@ -120,7 +120,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S() {
|
function S() {
|
||||||
if (window.location.protocol == "file:") {
|
let l = window.location;
|
||||||
|
if (l.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip) {
|
if (!locip) {
|
||||||
@ -129,12 +130,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// detect reverse proxy
|
// detect reverse proxy
|
||||||
let path = window.location.pathname;
|
let path = l.pathname;
|
||||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||||
if (paths.length > 2) {
|
if (paths.length > 2) {
|
||||||
locproto = window.location.protocol;
|
locproto = l.protocol;
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
locip = l.hostname+l.port+"/"+paths[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadJS(getURL('/settings/s.js?p=1'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
loadJS(getURL('/settings/s.js?p=1'), false); // If we set async false, file is loaded and executed, then next statement is processed
|
||||||
|
File diff suppressed because it is too large
Load Diff
3952
wled00/html_ui.h
3952
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user