Show X-Forwarded-For information also in the top menu

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-07-27 10:42:57 +02:00
parent e2aeeb1bdf
commit eb8f820748
2 changed files with 22 additions and 4 deletions

View File

@@ -714,6 +714,7 @@ function addAdvancedInfo() {
const advancedInfoTarget = $("#advanced-info");
const isTLS = advancedInfoSource.data("tls");
const clientIP = advancedInfoSource.data("client-ip");
const XForwardedFor = atob(advancedInfoSource.data("xff"));
const starttime = parseFloat(advancedInfoSource.data("starttime"));
const endtime = parseFloat(advancedInfoSource.data("endtime"));
const totaltime = 1e3 * (endtime - starttime);
@@ -727,11 +728,18 @@ function addAdvancedInfo() {
(isTLS ? "" : "-open") +
'" title="Your connection is ' +
(isTLS ? "" : "NOT ") +
'end-to-end encrypted (TLS/SSL)"></i>&nbsp;' +
clientIP +
"<br>"
'end-to-end encrypted (TLS/SSL)"></i>&nbsp;<span id="client-id"></span><br>'
);
// Add client IP info
$("#client-id").text(XForwardedFor ? XForwardedFor : clientIP);
if (XForwardedFor) {
// If X-Forwarded-For is set, show the X-Forwarded-For in italics and add
// the real client IP as tooltip
$("#client-id").css("font-style", "italic");
$("#client-id").prop("title", "Original remote address: " + clientIP);
}
// Add render time info
advancedInfoTarget.append(
"Render time: " + (totaltime > 0.5 ? totaltime.toFixed(1) : totaltime.toFixed(3)) + " ms"