Use pretty URLs when possible (#3351)

This commit is contained in:
Adam Warner
2025-03-29 10:45:09 +00:00
committed by GitHub
7 changed files with 15 additions and 15 deletions

View File

@@ -97,11 +97,11 @@ const htmlLegendPlugin = {
textLink.addEventListener("click", () => {
if (chart.canvas.id === "queryTypePieChart") {
globalThis.location.href = "queries.lp?type=" + item.text;
globalThis.location.href = "queries?type=" + item.text;
} else if (chart.canvas.id === "forwardDestinationPieChart") {
// Encode the forward destination as it may contain an "#" character
const upstream = encodeURIComponent(upstreams[item.text]);
globalThis.location.href = "queries.lp?upstream=" + upstream;
globalThis.location.href = "queries?upstream=" + upstream;
}
});
}

View File

@@ -68,7 +68,7 @@ $(function () {
});
// Do we want to start updating immediately?
// gravity.lp?go
// gravity?go
var searchString = globalThis.location.search.substring(1);
if (searchString.indexOf("go") !== -1) {
$("#gravityBtn").prop("disabled", true);

View File

@@ -305,7 +305,7 @@ function updateTopClientsTable(blocked) {
let clientname = client.name;
if (clientname.length === 0) clientname = client.ip;
url =
'<a href="queries.lp?client_ip=' +
'<a href="queries?client_ip=' +
encodeURIComponent(client.ip) +
(blocked ? "&upstream=blocklist" : "") +
'">' +
@@ -366,7 +366,7 @@ function updateTopDomainsTable(blocked) {
// Substitute "." for empty domain lookups
urlText = domain === "" ? "." : domain;
url =
'<a href="queries.lp?domain=' +
'<a href="queries?domain=' +
domain +
(blocked ? "&upstream=blocklist" : "&upstream=permitted") +
'">' +
@@ -797,7 +797,7 @@ $(function () {
//get value by index
var from = label / 1000 - 300;
var until = label / 1000 + 300;
globalThis.location.href = "queries.lp?from=" + from + "&until=" + until;
globalThis.location.href = "queries?from=" + from + "&until=" + until;
}
return false;
@@ -820,7 +820,7 @@ $(function () {
//get value by index
var from = label / 1000 - 300;
var until = label / 1000 + 300;
globalThis.location.href = "queries.lp?from=" + from + "&until=" + until;
globalThis.location.href = "queries?from=" + from + "&until=" + until;
}
return false;

View File

@@ -16,7 +16,7 @@ function redirect() {
// If DNS failure: send to Pi-hole diagnosis messages page
if ($("#dns-failure-label").is(":visible")) {
target = "messages.lp";
target = "messages";
}
// Redirect to target

View File

@@ -163,7 +163,7 @@ $(function () {
// Only add IPs to the table if we have not reached the maximum
if (index < MAXIPDISPLAY) {
ips.push('<a href="queries.lp?client_ip=' + ip.ip + '">' + iptext + "</a>");
ips.push('<a href="queries?client_ip=' + ip.ip + '">' + iptext + "</a>");
}
}

View File

@@ -64,7 +64,7 @@ function doSearch() {
for (const domain of res.domains) {
const color = domain.type === "deny" ? "red" : "green";
result +=
" - <a href='groups-domains.lp?domainid=" +
" - <a href='groups-domains?domainid=" +
domain.id +
"' target='_blank'><strong>" +
utils.escapeHtml(domain.domain) +
@@ -118,7 +118,7 @@ function doSearch() {
const list = grouped[listId][0];
const color = list.type === "block" ? "red" : "green";
result +=
" - <a href='groups-lists.lp?listid=" +
" - <a href='groups-lists?listid=" +
list.id +
"' target='_blank'>" +
utils.escapeHtml(list.address) +