Bugfix reverse proxy path detection
This commit is contained in:
parent
dfb8de2349
commit
eb8e95723c
@ -363,7 +363,7 @@
|
||||
<div>
|
||||
<button class="btn infobtn" onclick="requestJson()">Refresh</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>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -204,7 +204,8 @@ function getURL(path) {
|
||||
}
|
||||
function onLoad()
|
||||
{
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -213,12 +214,12 @@ function onLoad()
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy and/or HTTPS
|
||||
let l = window.location;
|
||||
let pathn = l.pathname;
|
||||
let paths = pathn.slice(1,pathn.endsWith('/')?-1:undefined).split("/");
|
||||
//while (paths[0]==="") paths.shift();
|
||||
locproto = l.protocol;
|
||||
locip = l.hostname + (l.port ? ":" + l.port : "")
|
||||
if (paths.length > 1) {
|
||||
locip = l.hostname + (l.port ? ":" + l.port : "");
|
||||
if (paths.length > 0 && paths[0]!=="") {
|
||||
loc = true;
|
||||
locip += "/" + paths[0];
|
||||
} else if (locproto==="https:") {
|
||||
@ -2594,7 +2595,7 @@ function cnfReset()
|
||||
bt.innerHTML = "Confirm Reboot";
|
||||
cnfr = true; return;
|
||||
}
|
||||
window.location.href = "/reset";
|
||||
window.location.href = getURL("/reset");
|
||||
}
|
||||
|
||||
var cnfrS = false;
|
||||
|
@ -27,7 +27,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -36,12 +37,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 1) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -35,7 +35,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -44,12 +45,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -54,7 +54,8 @@
|
||||
});
|
||||
}
|
||||
function S(){
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -63,12 +64,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -547,7 +547,8 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
}
|
||||
}
|
||||
function S(){
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -556,12 +557,12 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -65,7 +65,8 @@
|
||||
x.setAttribute("download","wled_" + x.getAttribute("download") + (sd=="WLED"?"":("_" +sd)));
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -74,12 +75,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Sync Settings</title>
|
||||
<script>var d=document;
|
||||
var loc = false, locip, locproto;
|
||||
var loc = false, locip, locproto = "http:";
|
||||
function gId(s){return d.getElementById(s);}
|
||||
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/");}
|
||||
@ -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 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(){
|
||||
locproto = "http:";
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -66,11 +66,11 @@
|
||||
}
|
||||
} else {
|
||||
// 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) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -33,7 +33,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -42,12 +43,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -186,7 +186,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -195,12 +196,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
@ -47,7 +47,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -56,12 +57,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
loc = true;
|
||||
locip = window.location.hostname+window.location.port+"/"+paths[0];
|
||||
locip = l.hostname+l.port+"/"+paths[0];
|
||||
}
|
||||
}
|
||||
ldS();
|
||||
|
@ -120,7 +120,8 @@
|
||||
});
|
||||
}
|
||||
function S() {
|
||||
if (window.location.protocol == "file:") {
|
||||
let l = window.location;
|
||||
if (l.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
@ -129,12 +130,12 @@
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let path = window.location.pathname;
|
||||
let path = l.pathname;
|
||||
let paths = path.slice(1,path.endsWith('/')?-1:undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
locproto = l.protocol;
|
||||
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
|
||||
|
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