mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
feat: Do not push query strings to URL #155
Slightly increase user browsing privacy by not pushing query strings to browser URL. By using this method, the browser history stay on the main page and filter query strings not recorded. Note: This approach is experimental. Only tested on Firefox and Chromium browser.
This commit is contained in:
parent
c1c72274cf
commit
98dcdfa94a
4 changed files with 28 additions and 28 deletions
|
@ -17,7 +17,7 @@ templ DtRowPerPage(url, hxTarget string, rowsPerPage int, q interface{}) {
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", url, paging.EncodedQuery(q, []string{"limit"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -43,7 +43,7 @@ templ DtRefreshInterval(url, hxTarget, interval string, q interface{}) {
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", url, paging.EncodedQuery(q, []string{"refresh"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -92,7 +92,7 @@ templ DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q int
|
|||
<th
|
||||
scope="col"
|
||||
class="cursor-pointer"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
hx-get={ fmt.Sprintf("%s?sort_by=%s&sort_direction=desc&%s", url, expectedSort, paging.EncodedQuery(q, []string{"sort_by", "sort_direction"})) }
|
||||
|
@ -101,7 +101,7 @@ templ DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q int
|
|||
<th
|
||||
scope="col"
|
||||
class="cursor-pointer"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
hx-get={ string(templ.URL(fmt.Sprintf("%s?sort_by=%s&sort_direction=asc&%s", url, expectedSort, paging.EncodedQuery(q, []string{"sort_by", "sort_direction"})))) }
|
||||
|
@ -110,7 +110,7 @@ templ DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q int
|
|||
<th
|
||||
scope="col"
|
||||
class="cursor-pointer"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
hx-get={ string(templ.URL(fmt.Sprintf("%s?sort_by=%s&sort_direction=desc&%s", url, expectedSort, paging.EncodedQuery(q, []string{"sort_by", "sort_direction"})))) }
|
||||
|
@ -147,7 +147,7 @@ templ DtPagination(url, hxTarget string, q interface{}, p paging.Pagination) {
|
|||
} else {
|
||||
<button
|
||||
hx-get={ fmt.Sprintf("%s?%s&page=%d", url, paging.EncodedQuery(q, []string{"page"}), page) }
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target={ hxTarget }
|
||||
hx-swap="outerHTML"
|
||||
>{ fmt.Sprintf("%d", page) }</button>
|
||||
|
|
|
@ -50,7 +50,7 @@ func DtRowPerPage(url, hxTarget string, rowsPerPage int, q interface{}) templ.Co
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ func DtRefreshInterval(url, hxTarget, interval string, q interface{}) templ.Comp
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ func DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q inte
|
|||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if expectedSort == sortBy && sortDir == "asc" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ func DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q inte
|
|||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else if expectedSort == sortBy && sortDir == "desc" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ func DtThSort(url, hxTarget, title, expectedSort, sortBy, sortDir string, q inte
|
|||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"cursor-pointer\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ func DtPagination(url, hxTarget string, q interface{}, p paging.Pagination) temp
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"true\" hx-target=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"false\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
class="frameless"
|
||||
placeholder="Filter Host / IP"
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"host"})) }
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-trigger="keyup changed delay:0.4s"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
|
@ -126,7 +126,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"nettype"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -144,7 +144,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"protocol"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -162,7 +162,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"cc"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -184,7 +184,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"status"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -203,7 +203,7 @@ templ TableNodes(data monero.Nodes, countries []monero.Countries, q monero.Query
|
|||
checked?={ q.CORS == "on" }
|
||||
hx-get={ fmt.Sprintf("%s?%s", "/remote-nodes", paging.EncodedQuery(q, []string{"cors"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_nodes"
|
||||
hx-swap="outerHTML"
|
||||
class="shrink-0 mt-0.5 text-orange-400 bg-neutral-800 border-neutral-700 rounded focus:ring-0 checked:bg-orange-400 checked:border-orange-400 focus:ring-offset-orange-500"
|
||||
|
@ -370,7 +370,7 @@ templ TableLogs(hxPath string, data monero.FetchLogs, q monero.QueryLogs, p pagi
|
|||
autocomplete="off"
|
||||
hx-get={ fmt.Sprintf("%s?%s", hxPath, paging.EncodedQuery(q, []string{"status"})) }
|
||||
hx-trigger="change"
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-target="#tbl_logs"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
@ -389,7 +389,7 @@ templ TableLogs(hxPath string, data monero.FetchLogs, q monero.QueryLogs, p pagi
|
|||
class="frameless"
|
||||
placeholder="Filter reason"
|
||||
hx-get={ fmt.Sprintf("%s?%s", hxPath, paging.EncodedQuery(q, []string{"failed_reason"})) }
|
||||
hx-push-url="true"
|
||||
hx-push-url="false"
|
||||
hx-trigger="keyup changed delay:0.4s"
|
||||
hx-target="#tbl_logs"
|
||||
hx-swap="outerHTML"
|
||||
|
|
|
@ -160,7 +160,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"true\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"></td><td><select id=\"nettype\" name=\"nettype\" class=\"frameless\" autocomplete=\"off\" hx-get=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"false\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"></td><td><select id=\"nettype\" name=\"nettype\" class=\"frameless\" autocomplete=\"off\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> ")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> ")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"any\">ANY</option> ")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"any\">ANY</option> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ func TableNodes(data monero.Nodes, countries []monero.Countries, q monero.QueryN
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\" class=\"shrink-0 mt-0.5 text-orange-400 bg-neutral-800 border-neutral-700 rounded focus:ring-0 checked:bg-orange-400 checked:border-orange-400 focus:ring-offset-orange-500\"> <label for=\"cors\" class=\"text-sm ms-3 text-neutral-400\">CORS</label></div></td></tr></thead> <tbody>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\" class=\"shrink-0 mt-0.5 text-orange-400 bg-neutral-800 border-neutral-700 rounded focus:ring-0 checked:bg-orange-400 checked:border-orange-400 focus:ring-offset-orange-500\"> <label for=\"cors\" class=\"text-sm ms-3 text-neutral-400\">CORS</label></div></td></tr></thead> <tbody>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -825,7 +825,7 @@ func TableLogs(hxPath string, data monero.FetchLogs, q monero.QueryLogs, p pagin
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"change\" hx-push-url=\"false\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ func TableLogs(hxPath string, data monero.FetchLogs, q monero.QueryLogs, p pagin
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"true\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\"></td></tr></thead> <tbody>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"false\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\"></td></tr></thead> <tbody>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue