188 lines
8.1 KiB
Cheetah
188 lines
8.1 KiB
Cheetah
{{ define "user" }}
|
|
<div class="padded box">
|
|
<div class="box-title">
|
|
<i class="mdi mdi-chart-arc"></i> stats
|
|
</div>
|
|
<div class="block-right">
|
|
<table id="stats" class="text-right">
|
|
<tr>
|
|
<td>artists:</td> <td>{{ .ArtistCount }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>albums:</td> <td>{{ .AlbumCount }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>tracks:</td> <td>{{ .TrackCount }}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="padded box">
|
|
<div class="box-title">
|
|
<i class="mdi mdi-lastfm"></i> last.fm
|
|
</div>
|
|
<div class="box-description text-light">
|
|
<p>gonic can scrobble to <a href="https://www.last.fm/" target="_blank">last.fm</a> for any user (but the admin must set a global api key)</p>
|
|
</div>
|
|
<div class="text-right">
|
|
{{ if .CurrentLastFMAPIKey }}
|
|
<span class="text-light">current status</span>
|
|
{{ if .User.LastFMSession }}
|
|
linked
|
|
<span class="text-light">|</span>
|
|
<form action="{{ path "/admin/unlink_lastfm_do" }}" method="post">
|
|
<input type="submit" value="unlink">
|
|
</form>
|
|
{{ else }}
|
|
<span class="angry">unlinked</span>
|
|
{{ $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>
|
|
{{ end }}
|
|
{{ else }}
|
|
<p class="text-light">api key not set</p>
|
|
{{ if not .User.IsAdmin }}
|
|
<p class="text-light">please ask your admin to set it</p>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ if .User.IsAdmin }}
|
|
<p><a href="{{ path "/admin/update_lastfm_api_key" }}">update api key…</a></p>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
<div class="padded box">
|
|
{{ if .User.IsAdmin }}
|
|
{{/* admin panel to manage all users */}}
|
|
<div class="box-title">
|
|
<i class="mdi mdi-account-multiple"></i> users
|
|
</div>
|
|
<div class="text-right">
|
|
{{ range $user := .AllUsers }}
|
|
<i>{{ $user.Name }}</i>
|
|
<span class="text-light no-small">{{ $user.CreatedAt | date }}</span>
|
|
<span class="text-light">|</span>
|
|
<a href="{{ printf "/admin/change_username?user=%s" $user.Name | path }}">username…</a>
|
|
<span class="text-light">|</span>
|
|
<a href="{{ printf "/admin/change_password?user=%s" $user.Name | path }}">password…</a>
|
|
<span class="text-light">|</span>
|
|
{{ if $user.IsAdmin }}
|
|
<span class="text-light">delete…</span>
|
|
{{ else }}
|
|
<a href="{{ printf "/admin/delete_user?user=%s" $user.Name | path }}">delete…</a>
|
|
{{ end }}
|
|
<br/>
|
|
{{ end }}
|
|
<a href="{{ path "/admin/create_user" }}" class="button">create new…</a>
|
|
</div>
|
|
{{ else }}
|
|
{{/* user panel to manage themselves */}}
|
|
<div class="box-title">
|
|
<i class="mdi mdi-account"></i> your account
|
|
</div>
|
|
<div class="text-right">
|
|
<a href="{{ path "/admin/change_own_username" }}" class="button">change username…</a>
|
|
<span class="text-light">|</span>
|
|
<a href="{{ path "/admin/change_own_password" }}" class="button">change password…</a>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<div class="padded box">
|
|
<div class="box-title">
|
|
<i class="mdi mdi-folder-multiple"></i> recent folders
|
|
</div>
|
|
<div class="block-right text-right">
|
|
{{ if eq (len .RecentFolders) 0 }}
|
|
<span class="text-light">no folders yet</span>
|
|
{{ end }}
|
|
<table id="recent-folders">
|
|
<colgroup>
|
|
<col width="80%" />
|
|
<col width="0%" />
|
|
</colgroup>
|
|
{{ range $folder := .RecentFolders }}
|
|
<tr>
|
|
<td class="text-right text-trunc">{{ $folder.RightPath }}</td>
|
|
<td><span class="text-light" title="{{ $folder.ModifiedAt }}">{{ $folder.ModifiedAt | dateHuman }}</span></td>
|
|
</tr>
|
|
{{ end }}
|
|
</table>
|
|
{{- if and (not .IsScanning) (.User.IsAdmin) -}}
|
|
{{- if not .LastScanTime.IsZero -}}
|
|
<p class="text-light" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | dateHuman }}</p>
|
|
{{ end }}
|
|
<form action="{{ path "/admin/start_scan_inc_do" }}" method="post">
|
|
<input type="submit" title="start a incremental scan" value="scan now"><br/>
|
|
</form>
|
|
<form action="{{ path "/admin/start_scan_full_do" }}" method="post">
|
|
<input type="submit" title="start a full scan (takes longer, and shouldn't usually be necessary)" value="scan full (!)">
|
|
</form>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
<div class="padded box">
|
|
<div class="box-title">
|
|
<i class="mdi mdi-file-music"></i> transcoding device profiles
|
|
</div>
|
|
<div class="box-description text-light">
|
|
<p>you can find your device's client name in the gonic logs.</p>
|
|
<p>some common client names are <span class="text-emp">DSub</span>, <span class="text-emp">Jamstash</span>, <span class="text-emp">Soundwaves</span>, or use <span class="text-emp">*</span> as fallback rule for any client</p>
|
|
</div>
|
|
<div class="block-right">
|
|
<table id="transcode-preferences">
|
|
{{ range $pref := .TranscodePreferences }}
|
|
<tr>
|
|
{{ $formSuffix := kebabcase $pref.Client }}
|
|
<form id="transcode-pref-{{ $formSuffix }}" action="{{ printf "/admin/delete_transcode_pref_do?client=%s" $pref.Client | path }}" method="post"></form>
|
|
<td>{{ $pref.Client }}</td>
|
|
<td>{{ $pref.Profile }}</td>
|
|
<td><input form="transcode-pref-{{ $formSuffix }}" type="submit" value="delete"></td>
|
|
</tr>
|
|
{{ end }}
|
|
<tr>
|
|
<form id="transcode-pref-add" action="{{ path "/admin/create_transcode_pref_do" }}" method="post"></form>
|
|
<td><input form="transcode-pref-add" type="text" name="client" placeholder="client name"></td>
|
|
<td><select form="transcode-pref-add" name="profile">
|
|
{{ range $profile := .TranscodeProfiles }}
|
|
<option value="{{ $profile }}">{{ $profile }}</option>
|
|
{{ end }}
|
|
</select></td>
|
|
<td><input form="transcode-pref-add" type="submit" value="save"></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="padded box">
|
|
<div class="box-title">
|
|
<i class="mdi mdi-playlist-music"></i> playlists
|
|
</div>
|
|
<div class="block-right text-right">
|
|
{{ if eq (len .Playlists) 0 }}
|
|
<span class="text-light">no playlists yet</span>
|
|
{{ end }}
|
|
<table id="recent-playlists">
|
|
{{ range $i, $playlist := .Playlists }}
|
|
<tr>
|
|
<form id="recent-playlists-{{ $i }}" action="{{ printf "/admin/delete_playlist_do?id=%d" $playlist.ID | path }}" method="post"></form>
|
|
<td class="text-right">{{ $playlist.Name }}</td>
|
|
<td><span class="text-light">({{ $playlist.TrackCount }} tracks)</span></td>
|
|
<td class="no-small"><span class="text-light" title="{{ $playlist.CreatedAt }}">{{ $playlist.CreatedAt | dateHuman }}</span></td>
|
|
<td><input form="recent-playlists-{{ $i }}" type="submit" value="delete"></td>
|
|
</tr>
|
|
{{ end }}
|
|
</table>
|
|
<form
|
|
id="playlist-upload-form"
|
|
enctype="multipart/form-data"
|
|
action="{{ path "/admin/upload_playlist_do" }}"
|
|
method="post"
|
|
>
|
|
<div style="position: relative;">
|
|
<input id="playlist-upload-input" style="position: absolute; opacity: 0;" name="playlist-files" type="file" multiple />
|
|
<input type="button" value="upload m3u8">
|
|
</div>
|
|
</form>
|
|
<script src="{{ path "/admin/static/playlist-upload.js" }}"></script>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|