mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
Cleanup cookie settings page
This commit is contained in:
@@ -162,29 +162,29 @@
|
||||
|
||||
<!-- End of general settings -->
|
||||
<h2>Current cookie values</h2>
|
||||
<div>
|
||||
<h3>Cookie list</h3>
|
||||
</div>
|
||||
{{- range k, v := CookieList }}
|
||||
|
||||
{{- range CookieListOrdered }}
|
||||
<div class="settings-set-cookie">
|
||||
<h3>{{k}}</h3>
|
||||
<h3>{{.k}}</h3>
|
||||
<form action="/settings/set-cookie" method="post">
|
||||
<input type="hidden" name="key" value="{{k}}" />
|
||||
<input type="text" name="value" value="{{v}}" />
|
||||
<input type="hidden" name="key" value="{{.k}}" />
|
||||
<input type="text" name="value" value="{{.v}}" />
|
||||
<input type="submit" value="Set" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{{- end }}
|
||||
<div>
|
||||
|
||||
<h3>Raw settings</h3>
|
||||
<div>
|
||||
<h3>Batch operation</h3>
|
||||
<p>
|
||||
You can save your current cookie values to quickly set your settings on other compatible instances, or if the current instance's cookies went expired.
|
||||
</p>
|
||||
<p>Invalid values will be ignored.</p>
|
||||
<form action="/settings/raw" method="post">
|
||||
<textarea name="raw" rows="10" cols="80">{{range k, v := CookieList}} {{k}}={{v}}{{end}}
|
||||
<textarea name="raw" rows="10" cols="80">
|
||||
{{- range CookieListOrdered -}}
|
||||
{{.k}}={{.v}}
|
||||
{{end -}}
|
||||
</textarea>
|
||||
<input type="submit" value="Set raw settings" />
|
||||
</form>
|
||||
|
||||
@@ -55,9 +55,11 @@ func GetTemplatingVariables(r *http.Request) jet.VarMap {
|
||||
pageURL := r.URL.String()
|
||||
|
||||
cookies := map[string]string{}
|
||||
cookies_ordered := []struct{k string; v string}{}
|
||||
for _, name := range session.AllCookieNames {
|
||||
value := session.GetCookie(r, name)
|
||||
cookies[string(name)] = value
|
||||
cookies_ordered = append(cookies_ordered, struct{k string; v string}{string(name), value})
|
||||
}
|
||||
|
||||
queries := make(map[string]string)
|
||||
@@ -71,5 +73,6 @@ func GetTemplatingVariables(r *http.Request) jet.VarMap {
|
||||
Set("PageURL", pageURL).
|
||||
Set("LoggedIn", token != "").
|
||||
Set("Queries", queries).
|
||||
Set("CookieList", cookies)
|
||||
Set("CookieList", cookies).
|
||||
Set("CookieListOrdered", cookies_ordered)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user