export/import/reset prefs

This commit is contained in:
Laptop
2024-12-09 21:39:16 +02:00
parent a46081d724
commit bcb9a4ccc7
2 changed files with 85 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ templ sel(name string, options []option, selected string) {
templ Preferences(prefs cfg.Preferences) {
<h1>Preferences</h1>
<form method="post">
<form method="post" autocomplete="off">
<label>
Parse descriptions:
@checkbox("ParseDescriptions", *prefs.ParseDescriptions)
@@ -89,4 +89,16 @@ templ Preferences(prefs cfg.Preferences) {
<br/>
<p>These preferences get saved in a cookie.</p>
</form>
<h1>Management</h1>
<h2>Preferences</h2>
<div style="display: flex; gap: 1rem;">
<a class="btn" href="/_/preferences/export" download="soundcloak_preferences.json">Export</a>
<a class="btn" href="/_/preferences/reset">Reset</a>
</div>
<br>
<form method="post" action="/_/preferences/import" autocomplete="off" style="display: grid; gap: 1rem;" enctype="multipart/form-data">
<input class="btn" type="file" autocomplete="off" name="prefs" />
<input type="submit" value="Import" class="btn"/>
</form>
}