Skip to content

Commit

Permalink
Add Proxy info to relative URLs in warnings for proxied IPs
Browse files Browse the repository at this point in the history
Fixes #1609
  • Loading branch information
cpinkham committed Nov 19, 2023
1 parent 49ef39c commit 97f8dca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions www/multisync.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,17 @@ function isWLED(typeId) {
return false;
}

function proxyURLsInString(str, ip) {
if (!isProxied(ip))
return str;

var re = /(href=['"])([^:]*)\//;
if (re.test(str))
str = str.replace(re,"$1proxy/" + ip + "/$2/");

return str;
}

function isProxied(ip) {
return proxies.includes(ip);
}
Expand Down Expand Up @@ -580,6 +591,9 @@ function getFPPSystemStatus(ipAddresses, refreshing = false) {

var wHTML = "";
for(var i = 0; i < data.warnings.length; i++) {
if (isProxied(ip))
data.warnings[i] = proxyURLsInString(data.warnings[i], ip);

wHTML += "<span class='warning-text'>" + data.warnings[i] + "</span><br>";
}
$('#' + rowID + '_warningCell').html(wHTML);
Expand Down

0 comments on commit 97f8dca

Please sign in to comment.