add basic lastfm hook

This commit is contained in:
sentriz
2019-04-17 21:36:40 +01:00
parent 9f6cd20f5a
commit 4cd9c0c39c
17 changed files with 199 additions and 33 deletions

View File

@@ -3,9 +3,9 @@
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>changing account password</u></span>
<u>changing account password</u>
</div>
<form id="login-form" action="/admin/change_own_password_do" method="post">
<form action="/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,9 +3,9 @@
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>changing {{ .SelectedUser.Name }}'s password</u></span>
<u>changing {{ .SelectedUser.Name }}'s password</u>
</div>
<form id="login-form" action="/admin/change_password_do?user={{ .SelectedUser.Name }}" method="post">
<form action="/admin/change_password_do?user={{ .SelectedUser.Name }}" 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,9 +3,9 @@
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>create new user</u></span>
<u>create new user</u>
</div>
<form id="login-form" action="/admin/create_user_do" method="post">
<form action="/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

@@ -3,7 +3,7 @@
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>stats</u></span>
<u>stats</u>
</div>
<div class="right">
<span class="pre">artists: {{ printf "%7v" .ArtistCount }}</span><br/>
@@ -13,32 +13,32 @@
</div>
<div class="padded box mono">
<div class="box-title">
<span><u>last fm</u></span>
<u>last.fm</u>
</div>
<div class="right">
<span class="pre">unlinked</span><br/>
<a href="/admin/update_lastfm_api_key">update last.fm api key</a><br/>
<a href="https://www.last.fm/api/auth/?api_key={{ .CurrentLastFMAPIKey }}&cb={{ .RequestRoot }}/admin/link_lastfm_callback">link account</a><br/>
</div>
</div>
<div class="padded box mono">
{{ if .User.IsAdmin }}
{{/* admin panel to manage all users */}}
<div class="box-title">
<span><u>users</u></span>
<u>users</u>
</div>
<div class="right">
{{ range $user := .AllUsers }}
<span class="pre">{{ $user.Name }} <span class="light">created</span> <u>{{ $user.CreatedAt.Format "Jan 02, 2006" }}</u> <a href="/admin/change_password?user={{ $user.Name }}">change password</a></span><br/>
{{ $user.Name }} <span class="light">created</span> <u>{{ $user.CreatedAt.Format "Jan 02, 2006" }}</u> <a href="/admin/change_password?user={{ $user.Name }}">change password</a><br/>
{{ end }}
<br>
<a href="/admin/create_user" class="button">create new</a>
</div>
{{ else }}
{{/* user panel to manage themselves */}}
<div class="box-title">
<span><u>your account</u></span>
<u>your account</u>
</div>
<div class="right">
<a href="/admin/change_own_password" class="button">change password</a>
<a href="/admin/change_own_password" class="button">change password</a>
</div>
{{ end }}
</div>

View File

@@ -3,9 +3,9 @@
{{ define "content" }}
<div class="padded box mono">
<div class="box-title">
<span><u>please login</u></span>
<u>please login</u>
</div>
<form id="login-form" action="/admin/login_do" method="post">
<form action="/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

@@ -0,0 +1,18 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<u>updating last.fm api key</u>
</div>
<div class="right">
<span class="light">current key</span> <i>{{ if .CurrentLastFMAPIKey }}{{ .CurrentLastFMAPIKey }}{{ else }}not set{{ end }}</i><br/>
<span class="light">current secret</span> <i>{{ if .CurrentLastFMAPISecret }}{{ .CurrentLastFMAPISecret }}{{ else }}not set{{ end }}</i>
</div>
<form action="/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">
</form>
</div>
{{ end }}

View File

@@ -2,7 +2,7 @@
{{ define "content" }}
<div class="light right">
<span>welcome <u>{{ .User.Name }}</u> &#124; <a href="/admin/home">home</a> &#124; <a href="/admin/logout">logout</a></span>
welcome <u>{{ .User.Name }}</u> &#124; <a href="/admin/home">home</a> &#124; <a href="/admin/logout">logout</a>
</div>
{{ template "user" . }}
{{ end }}