diff --git a/scripts/pi-hole/js/search.js b/scripts/pi-hole/js/search.js index b27110f6..cbbedd28 100644 --- a/scripts/pi-hole/js/search.js +++ b/scripts/pi-hole/js/search.js @@ -48,16 +48,19 @@ function eventsource(partial) { (numDomains > 0 ? ":" : ".") + "

"; for (const domain of res.domains) { + const color = domain.type === "deny" ? "red" : "green"; result += " - " + + "' target='_blank'>" + utils.escapeHtml(domain.domain) + - "
" + + "

" + domain.kind + " " + domain.type + - " domain
added: " + + " domain

added: " + utils.renderTimestamp(domain.date_added, "display") + "
last modified: " + utils.renderTimestamp(domain.date_modified, "display") + @@ -88,7 +91,7 @@ function eventsource(partial) { result += "Found " + numAdlists + - " adlist" + + " list" + (numAdlists !== 1 ? "s" : "") + " " + verb + @@ -99,12 +102,18 @@ function eventsource(partial) { "

"; for (const address of Object.keys(grouped)) { const adlist = grouped[address][0]; + const color = adlist.type === "block" ? "red" : "green"; result += " - " + utils.escapeHtml(address) + - "
added: " + + "
" + + adlist.type + + " list" + + "
added: " + utils.renderTimestamp(adlist.date_added, "display") + "
last modified: " + utils.renderTimestamp(adlist.date_modified, "display") + @@ -122,18 +131,50 @@ function eventsource(partial) { (adlist.comment !== null && adlist.comment.length > 0 ? '
comment: "' + utils.escapeHtml(adlist.comment) + '"' : "
no comment") + - "
"; + "
matching entries:
"; for (const adlists of grouped[address]) { result += - " - " + - utils.escapeHtml(adlists.domain) + - "
"; + " - " + utils.escapeHtml(adlists.domain) + "
"; } result += "
"; } - result += "Search took " + (1000 * data.took).toFixed(1) + " ms"; + result += "Number of results per type:
"; + result += + " - " + + data.search.results.domains.exact + + " exact domain matches
"; + result += + " - " + + data.search.results.domains.regex + + " regex domain matches
"; + result += + " - " + + data.search.results.gravity.allow + + " allowlist (antigravity) matches
"; + result += + " - " + + data.search.results.gravity.block + + " blocklist (gravity) matches
"; + + if ( + data.search.results.gravity.allow > data.search.parameters.N || + data.search.results.gravity.block > data.search.parameters.N || + data.search.results.domains.exact > data.search.parameters.N || + data.search.results.domains.regex > data.search.parameters.N + ) { + result += + "

Note: " + + "The number of results to return per type is limited to " + + data.search.parameters.N + + " entries.
There are " + + data.search.results.total + + " matching entries in total.
Consider " + + "using a more specific search term or increase N.
"; + } + + result += "
Search took " + (1000 * data.took).toFixed(1) + " ms"; ta.append(result); }) diff --git a/scripts/pi-hole/lua/sidebar.lp b/scripts/pi-hole/lua/sidebar.lp index 7f716635..9d09a02d 100644 --- a/scripts/pi-hole/lua/sidebar.lp +++ b/scripts/pi-hole/lua/sidebar.lp @@ -230,7 +230,7 @@
  • - Search Adlists + Search Lists
  • diff --git a/search.lp b/search.lp index 6377b373..cf89465b 100644 --- a/search.lp +++ b/search.lp @@ -11,7 +11,7 @@ mg.include('scripts/pi-hole/lua/header_authenticated.lp','r') ?>