mirror of
https://github.com/pi-hole/web.git
synced 2026-02-15 07:25:39 +00:00
Include the upstream DNS server name to the link, when needed
The link must send the "upstream" parameter in exactly the same format used by the "suggestions" API. The format is: "upstream=<IP>#<port> (<servername>)". This will ensure that when a link is clicked, the correct server name will be highlighted in the SELECT element on the queries.lp page and no other OPTION element will be created. Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
@@ -100,10 +100,14 @@ globalThis.htmlLegendPlugin = {
|
||||
// Encode the forward destination as it may contain an "#" character
|
||||
link.href = `queries?upstream=${encodeURIComponent(upstreamIPs[item.index])}`;
|
||||
|
||||
// If server name and IP are different, replace the title tooltip
|
||||
// including the upstream IP to the text
|
||||
// If server name and IP are different:
|
||||
if (item.text !== upstreamIPs[item.index]) {
|
||||
// replace the title tooltip to include the upstream IP to the text ...
|
||||
link.title = `List ${item.text} (${upstreamIPs[item.index]}) queries`;
|
||||
|
||||
// ... and include the server name (without port) to the querystring, to match
|
||||
// the text used on the SELECT element (sent by suggestions API endpoint)
|
||||
link.href += ` (${item.text.split("#")[0]})`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user