support proxy prefix

This commit is contained in:
sentriz
2020-01-27 17:00:23 +00:00
parent 6ad284aa3e
commit 2e85c95018
19 changed files with 401 additions and 361 deletions

View File

@@ -3,7 +3,7 @@
<div class="box-title">
<i class="mdi mdi-account-key"></i> changing account password
</div>
<form action="/admin/change_own_password_do" method="post">
<form action="{{ path "/admin/change_own_password_do" }}" method="post">
<input type="password" id="password_one" name="password_one" placeholder="new password">
<input type="password" id="password_two" name="password_two" placeholder="verify new password">
<input type="submit" value="change">

View File

@@ -3,7 +3,7 @@
<div class="box-title">
<i class="mdi mdi-account-key"></i> changing {{ .SelectedUser.Name }}'s password
</div>
<form action="/admin/change_password_do?user={{ .SelectedUser.Name }}" method="post">
<form action="{{ printf "/admin/change_password_do?user=%s" .SelectedUser.Name | path }}" method="post">
<input type="password" id="password_one" name="password_one" placeholder="new password">
<input type="password" id="password_two" name="password_two" placeholder="verify new password">
<input type="submit" value="change">

View File

@@ -3,7 +3,7 @@
<div class="box-title">
<i class="mdi mdi-account-plus"></i> creating new user
</div>
<form action="/admin/create_user_do" method="post">
<form action="{{ path "/admin/create_user_do" }}" method="post">
<input type="text" id="username" name="username" placeholder="username">
<input type="password" id="password_one" name="password_one" placeholder="password">
<input type="password" id="password_two" name="password_two" placeholder="verify password">

View File

@@ -7,7 +7,7 @@
are you sure?<br/>
<span class="light">their plays, starred, etc. will also be deleted</span>
</div>
<form action="/admin/delete_user_do?user={{ .SelectedUser.Name }}" method="post">
<form action="{{ printf "/admin/delete_user_do?user=%s" .SelectedUser.Name | path }}" method="post">
<input type="submit" value="yes">
</form>
</div>

View File

@@ -24,17 +24,19 @@
<div class="text-right">
{{ if .User.IsAdmin }}
<p class="light">you can get an api key <a href="https://www.last.fm/api/account/create" target="_blank">here</a></p>
<a href="/admin/update_lastfm_api_key">update api key</a><br/>
<a href="{{ path "/admin/update_lastfm_api_key" }}">update api key</a><br/>
{{ end }}
{{ if .CurrentLastFMAPIKey }}
<span class="light">current status</span>
{{ if .User.LastFMSession }}
linked
<span class="light">&#124;</span>
<a href="/admin/unlink_lastfm_do">unlink</a><br/>
<a href="{{ path "/admin/unlink_lastfm_do" }}">unlink</a><br/>
{{ else }}
<span class="angry">unlinked</span>
<a href="https://www.last.fm/api/auth/?api_key={{ .CurrentLastFMAPIKey }}&cb={{ .RequestRoot }}/admin/link_lastfm_do">link</a><br/>
{{ $cbPath := path "/admin/link_lastfm_do" }}
{{ $cbURL := printf "%s%s" .RequestRoot $cbPath }}
<a href="https://www.last.fm/api/auth/?api_key={{ .CurrentLastFMAPIKey }}&cb={{ $cbURL }}">link</a><br/>
{{ end }}
{{ else if not .User.IsAdmin }}
<span class="light">api key not set. please ask your admin to set it</span>
@@ -52,11 +54,11 @@
<i>{{ $user.Name }}</i>
<span class="light no-small">{{ $user.CreatedAt.Format "jan 02, 2006" }}</span>
<span class="light">&#124;</span>
<a href="/admin/change_password?user={{ $user.Name }}">change password</a>
<a href="{{ printf "/admin/change_password?user=%s" $user.Name | path }}">change password</a>
<span class="light">&#124;</span>
<a href="/admin/delete_user?user={{ $user.Name }}">delete</a><br/>
<a href="{{ printf "/admin/delete_user?user=%s" $user.Name | path }}">delete</a><br/>
{{ end }}
<a href="/admin/create_user" class="button">create new</a>
<a href="{{ path "/admin/create_user" }}" class="button">create new</a>
</div>
{{ else }}
{{/* user panel to manage themselves */}}
@@ -64,7 +66,7 @@
<i class="mdi mdi-account"></i> your account
</div>
<div class="text-right">
<a href="/admin/change_own_password" class="button">change password</a>
<a href="{{ path "/admin/change_own_password" }}" class="button">change password</a>
</div>
{{ end }}
</div>
@@ -85,7 +87,7 @@
{{ end }}
</table>
{{- if not .IsScanning -}}
<a href="/admin/start_scan_do">start scan</a>
<a href="{{ path "/admin/start_scan_do" }}">start scan</a>
{{- if not .LastScanTime.IsZero -}}
<br>
<span class="light" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | humanDate }}</span>
@@ -113,7 +115,7 @@
<form
id="playlist-upload-form"
enctype="multipart/form-data"
action="/admin/upload_playlist_do"
action="{{ path "/admin/upload_playlist_do" }}"
method="post"
>
<label for="playlist-upload-input">

View File

@@ -3,7 +3,7 @@
<div class="box-title">
<i class="mdi mdi-login-variant"></i> login
</div>
<form action="/admin/login_do" method="post">
<form action="{{ path "/admin/login_do" }}" method="post">
<input type="text" id="username" name="username" placeholder="username">
<input type="password" id="password" name="password" placeholder="password">
<input type="submit" value="login">

View File

@@ -7,7 +7,7 @@
<span class="light">current key</span> <i>{{ default "not set" .CurrentLastFMAPIKey }}</i><br/>
<span class="light">current secret</span> <i>{{ default "not set" .CurrentLastFMAPISecret }}</i>
</div>
<form action="/admin/update_lastfm_api_key_do" method="post">
<form action="{{ path "/admin/update_lastfm_api_key_do" }}" method="post">
<input type="text" id="api_key" name="api_key" placeholder="new key">
<input type="text" id="secret" name="secret" placeholder="new secret">
<input type="submit" value="update">