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

@@ -22,7 +22,7 @@ mg.include('scripts/lua/header_authenticated.lp','r')
<div class="icon"> <div class="icon">
<i class="fas fa-globe-americas"></i> <i class="fas fa-globe-americas"></i>
</div> </div>
<a href="network.lp" class="small-box-footer" title="" id="total_clients"> <a href="network" class="small-box-footer" title="" id="total_clients">
<span id="active_clients">-</span> active clients <i class="fa fa-arrow-circle-right"></i> <span id="active_clients">-</span> active clients <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</div> </div>
@@ -38,7 +38,7 @@ mg.include('scripts/lua/header_authenticated.lp','r')
<div class="icon"> <div class="icon">
<i class="fas fa-hand-paper"></i> <i class="fas fa-hand-paper"></i>
</div> </div>
<a href="queries.lp?upstream=blocklist" class="small-box-footer" title=""> <a href="queries?upstream=blocklist" class="small-box-footer" title="">
List blocked queries <i class="fa fa-arrow-circle-right"></i> List blocked queries <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</div> </div>
@@ -54,7 +54,7 @@ mg.include('scripts/lua/header_authenticated.lp','r')
<div class="icon"> <div class="icon">
<i class="fas fa-chart-pie"></i> <i class="fas fa-chart-pie"></i>
</div> </div>
<a href="queries.lp" class="small-box-footer" title=""> <a href="queries" class="small-box-footer" title="">
List all queries <i class="fa fa-arrow-circle-right"></i> List all queries <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</div> </div>
@@ -70,7 +70,7 @@ mg.include('scripts/lua/header_authenticated.lp','r')
<div class="icon"> <div class="icon">
<i class="fas fa-list-alt"></i> <i class="fas fa-list-alt"></i>
</div> </div>
<a href="groups-lists.lp" class="small-box-footer" title=""> <a href="groups-lists" class="small-box-footer" title="">
Manage lists <i class="fa fa-arrow-circle-right"></i> Manage lists <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</div> </div>

View File

@@ -97,11 +97,11 @@ const htmlLegendPlugin = {
textLink.addEventListener("click", () => { textLink.addEventListener("click", () => {
if (chart.canvas.id === "queryTypePieChart") { 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") { } else if (chart.canvas.id === "forwardDestinationPieChart") {
// Encode the forward destination as it may contain an "#" character // Encode the forward destination as it may contain an "#" character
const upstream = encodeURIComponent(upstreams[item.text]); 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? // Do we want to start updating immediately?
// gravity.lp?go // gravity?go
var searchString = globalThis.location.search.substring(1); var searchString = globalThis.location.search.substring(1);
if (searchString.indexOf("go") !== -1) { if (searchString.indexOf("go") !== -1) {
$("#gravityBtn").prop("disabled", true); $("#gravityBtn").prop("disabled", true);

View File

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

View File

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

View File

@@ -163,7 +163,7 @@ $(function () {
// Only add IPs to the table if we have not reached the maximum // Only add IPs to the table if we have not reached the maximum
if (index < MAXIPDISPLAY) { 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) { for (const domain of res.domains) {
const color = domain.type === "deny" ? "red" : "green"; const color = domain.type === "deny" ? "red" : "green";
result += result +=
" - <a href='groups-domains.lp?domainid=" + " - <a href='groups-domains?domainid=" +
domain.id + domain.id +
"' target='_blank'><strong>" + "' target='_blank'><strong>" +
utils.escapeHtml(domain.domain) + utils.escapeHtml(domain.domain) +
@@ -118,7 +118,7 @@ function doSearch() {
const list = grouped[listId][0]; const list = grouped[listId][0];
const color = list.type === "block" ? "red" : "green"; const color = list.type === "block" ? "red" : "green";
result += result +=
" - <a href='groups-lists.lp?listid=" + " - <a href='groups-lists?listid=" +
list.id + list.id +
"' target='_blank'>" + "' target='_blank'>" +
utils.escapeHtml(list.address) + utils.escapeHtml(list.address) +