move to goresources and add build scripts

This commit is contained in:
sentriz
2019-06-24 13:43:05 +01:00
parent 56b872a4b3
commit 895d27378f
34 changed files with 23289 additions and 229 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,132 @@
form input[type],
form select,
form textarea {
margin-bottom: 0;
}
form {
max-width: 400px;
margin-left: auto;
margin-right: 0;
display: flex;
flex-direction: column;
align-items: flex-end;
}
form input[type=password],
form input[type=text] {
margin-bottom: 0.25rem;
}
form input[type=submit] {
width: 8rem;
}
div {
margin: 0;
padding: 0;
}
body {
max-width: 800px;
margin: 0 auto;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-between;
line-height: 1rem;
}
.left-cut {
display: flex;
flex-direction: row-reverse;
overflow-x: hidden;
}
table#recent-folders {
line-height: 0.45rem;
overflow: hidden;
white-space: nowrap;
}
table#recent-folders td, th {
border: none;
margin: 0;
}
a,
a:visited {
color: #0064c1;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#content>* {
margin: 2rem 0;
}
#header {
border-bottom: 2px solid #0000001a;
padding-top: 3rem;
}
#header img {
max-width: 580px;
position: relative;
}
#footer {
text-align: right;
}
#flashes {
background-color: #fd1b1b1c;
border-right: 2px solid #fd1b1b1c;
border-bottom: 2px solid #fd1b1b1c;
}
.right {
text-align: right;
}
.light {
color: #00000082;
}
.mono {
font-family: monospace;
}
.pre {
white-space: pre;
}
.box {
background-color: #00000005;
border-right: 2px solid #0000000c;
border-bottom: 2px solid #0000000c;
}
.box-title {
margin-bottom: 0.5rem;
}
.padded {
padding: 1rem;
}
.side-padded {
padding: 0 1rem;
}
.angry {
background-color: #f4433669;
}
i.mdi {
font-size: 14px;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
{{ define "layout" }}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ template "title" }}</title>
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
<link rel="stylesheet" href="/admin/static/stylesheets/main.css">
<link rel="shortcut icon" href="/admin/static/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="/admin/static/images/favicon.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
</head>
<body>
<div>
<div id="header">
<img src="/admin/static/images/gonic.png">
</div>
<div id="content">
{{ if .Flashes }}
<div id="flashes" class="padded mono">
<i class="mdi mdi-alert-circle"></i> {{ index .Flashes 0 }}
</div>
{{ end }}
{{ template "content" . }}
</div>
</div>
<div id="footer" class="padded mono">
senan kelly, 2019
<span class="light">&#124;</span>
<a href="https://github.com/sentriz/gonic">github</a>
</div>
</body>
</html>
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-account-key"></i> changing account password
</div>
<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">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<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">
<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">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,15 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-account-plus"></i> creating new user
</div>
<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">
<input type="submit" value="create">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,15 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-account-remove"></i> deleting user {{ .SelectedUser.Name }}
</div>
<div class="right">
are you sure?
</div>
<form action="/admin/delete_user_do?user={{ .SelectedUser.Name }}" method="post">
<input type="submit" value="yes">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,79 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-chart-arc"></i> stats
</div>
<div class="right">
<span class="pre">artists: {{ printf "%7v" .ArtistCount }}</span><br/>
<span class="pre">albums: {{ printf "%7v" .AlbumCount }}</span><br/>
<span class="pre">tracks: {{ printf "%7v" .TrackCount }}</span>
</div>
</div>
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-lastfm"></i> last.fm
</div>
<div class="right">
{{ if .User.IsAdmin }}
<a href="/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/>
{{ 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/>
{{ end }}
{{ else if not .User.IsAdmin }}
<span class="light">api key not set. please ask your admin to set it</span>
{{ end }}
</div>
</div>
<div class="padded box mono">
{{ if .User.IsAdmin }}
{{/* admin panel to manage all users */}}
<div class="box-title">
<i class="mdi mdi-account-multiple"></i> users
</div>
<div class="right">
{{ range $user := .AllUsers }}
<i>{{ $user.Name }}</i>
<span class="light">{{ $user.CreatedAt.Format "jan 02, 2006" }}</span>
<span class="light">&#124;</span>
<a href="/admin/change_password?user={{ $user.Name }}">change password</a>
<span class="light">&#124;</span>
<a href="/admin/delete_user?user={{ $user.Name }}">delete</a><br/>
{{ end }}
<a href="/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="right">
<a href="/admin/change_own_password" class="button">change password</a>
</div>
{{ end }}
</div>
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-folder-multiple"></i> recent folders
</div>
<div class="left-cut">
<table id="recent-folders">
{{ range $folder := .RecentFolders }}
<tr>
<td><span>{{ $folder.RightPath }}</span></td>
<td><span class="light">{{ $folder.CreatedAt | humandate }}</span></td>
</tr>
{{ end }}
</table>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "title" }}gonic{{ end }}
{{ define "content" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-login-variant"></i> login
</div>
<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">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,18 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-key-change"></i> updating last.fm keys
</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

@@ -0,0 +1,12 @@
{{ define "title" }}home{{ end }}
{{ define "content" }}
<div class="side-padded light right mono">
welcome {{ .User.Name }}
&#124;
<a href="/admin/home">home</a>
&#124;
<a href="/admin/logout">logout <i class="mdi mdi-logout-variant"></i></a>
</div>
{{ template "user" . }}
{{ end }}