move to goresources and add build scripts
This commit is contained in:
2
_build_tags
Normal file
2
_build_tags
Normal file
@@ -0,0 +1,2 @@
|
||||
sqlite_foreign_keys
|
||||
sqlite_vacuum_incr
|
||||
7
_do_build_scanner
Executable file
7
_do_build_scanner
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
GO111MODULES=on
|
||||
|
||||
go build \
|
||||
-tags "$(tr '\n' ' ' < _build_tags)" \
|
||||
cmd/scanner/main.go
|
||||
8
_do_build_server
Executable file
8
_do_build_server
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
GO111MODULES=on
|
||||
|
||||
./_do_compile_assets
|
||||
go build \
|
||||
-tags "$(tr '\n' ' ' < _build_tags) embed" \
|
||||
cmd/server/main.go
|
||||
14
_do_compile_assets
Executable file
14
_do_compile_assets
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
shopt -s globstar
|
||||
|
||||
server_base_dir=server
|
||||
assets_name=assets
|
||||
|
||||
resources \
|
||||
-declare \
|
||||
-var $(sed -E 's/(^|_)([a-z])/\U\2/g' <<< $assets_name) \
|
||||
-package ${assets_name}_compiled \
|
||||
-output "$server_base_dir/${assets_name}_compiled/${assets_name}_compiled.go" \
|
||||
-trim "$server_base_dir/${assets_name}_src/" \
|
||||
"$server_base_dir/${assets_name}_src/"**
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
test_data_path="server/handler/test_data"
|
||||
test_listen_addr="localhost:9353"
|
||||
test_data_path=server/handler/test_data
|
||||
test_listen_addr=localhost:9353
|
||||
test_music_path=~/music
|
||||
test_db_path="$test_data_path/db"
|
||||
test_db_path=$test_data_path/db
|
||||
|
||||
if [[ "$1" == "--scan" ]]; then
|
||||
echo -e "\e[91mwarning: \e[39mthe --scan option was passed"
|
||||
@@ -11,7 +11,7 @@ if [[ "$1" == "--scan" ]]; then
|
||||
echo "- the test json will likely change a lot"
|
||||
echo "- make sure you carefully read the diff of old and new json after this script"
|
||||
rm "$test_db_path" 2>/dev/null
|
||||
go run cmd/scanner/main.go \
|
||||
./_do_run_scanner \
|
||||
-music-path "$test_music_path" \
|
||||
-db-path "$test_db_path"
|
||||
fi
|
||||
@@ -19,7 +19,7 @@ fi
|
||||
# start server in fd 3
|
||||
mkdir "$test_music_path" 2>/dev/null
|
||||
exec 3< <(
|
||||
go run cmd/server/main.go \
|
||||
./_do_run_server \
|
||||
-music-path "$test_music_path" \
|
||||
-db-path "$test_db_path" \
|
||||
-listen-addr "$test_listen_addr" \
|
||||
8
_do_run_scanner
Executable file
8
_do_run_scanner
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
GO111MODULES=on
|
||||
|
||||
go run \
|
||||
-tags "$(tr '\n' ' ' < _build_tags)" \
|
||||
cmd/scanner/main.go \
|
||||
$@
|
||||
8
_do_run_server
Executable file
8
_do_run_server
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
GO111MODULES=on
|
||||
|
||||
go run \
|
||||
-tags "$(tr '\n' ' ' < _build_tags)" \
|
||||
cmd/server/main.go \
|
||||
$@
|
||||
8
go.mod
8
go.mod
@@ -3,11 +3,9 @@ module github.com/sentriz/gonic
|
||||
require (
|
||||
cloud.google.com/go v0.37.1 // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190315220205-a8ed825ac853 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.4.1 // indirect
|
||||
github.com/gobuffalo/genny v0.1.1 // indirect
|
||||
github.com/gobuffalo/gogen v0.1.1 // indirect
|
||||
github.com/gobuffalo/packr/v2 v2.2.0
|
||||
github.com/gofrs/uuid v3.2.0+incompatible // indirect
|
||||
github.com/gorilla/securecookie v1.1.1
|
||||
github.com/gorilla/sessions v1.1.3
|
||||
@@ -19,13 +17,11 @@ require (
|
||||
github.com/lib/pq v1.0.0 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.10.0 // indirect
|
||||
github.com/nicksellen/audiotags v0.0.0-20160226222119-94015fa599bd
|
||||
github.com/omeid/go-resources v0.0.0-20190324090249-46f4269d8abd
|
||||
github.com/peterbourgon/ff v1.2.0
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be
|
||||
github.com/wader/gormstore v0.0.0-20190302154359-acb787ba3755
|
||||
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd // indirect
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect
|
||||
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b // indirect
|
||||
google.golang.org/appengine v1.5.0 // indirect
|
||||
)
|
||||
|
||||
81
go.sum
81
go.sum
@@ -15,11 +15,12 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190315220205-a8ed825ac853 h1:tTngnoO/B6HQnJ+pK8tN7kEAhmhIfaJOutqq/A4/JTM=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190315220205-a8ed825ac853/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
@@ -30,41 +31,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
|
||||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
||||
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
|
||||
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
|
||||
github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
|
||||
github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
|
||||
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
|
||||
github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs=
|
||||
github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
|
||||
github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
|
||||
github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk=
|
||||
github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e h1:JbHBQOMhE0wmpSuejnSkdnL2rULqQTwEGgVe85o7+No=
|
||||
github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28=
|
||||
github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo=
|
||||
github.com/gobuffalo/genny v0.1.1 h1:iQ0D6SpNXIxu52WESsD+KoQ7af2e3nCfnSBoSF/hKe0=
|
||||
github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk=
|
||||
github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw=
|
||||
github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5 h1:f3Fpd5AqsFuTHUEhUeEMIFJkX8FpVnzdW+GpYxIyXkA=
|
||||
github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360=
|
||||
github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg=
|
||||
github.com/gobuffalo/gogen v0.1.1 h1:dLg+zb+uOyd/mKeQUYIbwbNmfRsr9hd/WtYWepmayhI=
|
||||
github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE=
|
||||
github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2 h1:8thhT+kUJMTMy3HlX4+y9Da+BNJck+p109tqqKp7WDs=
|
||||
github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8=
|
||||
github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
|
||||
github.com/gobuffalo/mapi v1.0.2 h1:fq9WcL1BYrm36SzK6+aAnZ8hcp+SrmnDyAxhNx8dvJk=
|
||||
github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
|
||||
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0 h1:P6naWPiHm/7R3eYx/ub3VhaW9G+1xAMJ6vzACePaGPI=
|
||||
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
|
||||
github.com/gobuffalo/packd v0.1.0 h1:4sGKOD8yaYJ+dek1FDkwcxCHA40M4kfKgFHx8N2kwbU=
|
||||
github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
|
||||
github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
|
||||
github.com/gobuffalo/packr/v2 v2.2.0 h1:Ir9W9XIm9j7bhhkKE9cokvtTl1vBm62A/fene/ZCj6A=
|
||||
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
|
||||
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754 h1:tpom+2CJmpzAWj5/VEHync2rJGi+epHNIeRSWjzGA+4=
|
||||
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
||||
@@ -95,7 +61,6 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jinzhu/gorm v1.9.2 h1:lCvgEaqe/HVE+tjAR2mt4HbbHAZsQOv3XAZiEZV37iw=
|
||||
github.com/jinzhu/gorm v1.9.2/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
|
||||
@@ -103,8 +68,6 @@ github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a h1:eeaG9XMUvRBYX
|
||||
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.0.0 h1:6WV8LvwPpDhKjo5U9O6b4+xdG/jTXNPwlDme/MTo8Ns=
|
||||
github.com/jinzhu/now v1.0.0/go.mod h1:oHTiXerJ20+SfYcrdlBO7rzZRJWGwSTQ0iUY2jI6Gfc=
|
||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/josephburnett/jd v0.0.0-20190523064723-9cd4cea55d7d h1:PYUR84NZE+Tm2jkGt85mUFVyXv27rDhLpLa3WBhJOog=
|
||||
github.com/josephburnett/jd v0.0.0-20190523064723-9cd4cea55d7d/go.mod h1:aeV+6oc13ogwzcRNHBe4vbyLmoQxMfEDoqyqCU9oE30=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
@@ -114,25 +77,18 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR
|
||||
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 h1:JgVTCPf0uBVcUSWpyXmGpgOc62nK5HWUBKAGc3Qqa5k=
|
||||
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
|
||||
github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
|
||||
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
|
||||
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
|
||||
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nicksellen/audiotags v0.0.0-20160226222119-94015fa599bd h1:xKn/gU8lZupoZt/HE7a/R3aH93iUO6JwyRsYelQUsRI=
|
||||
github.com/nicksellen/audiotags v0.0.0-20160226222119-94015fa599bd/go.mod h1:B6icauz2l4tkYQxmDtCH4qmNWz/evSW5CsOqp6IE5IE=
|
||||
github.com/omeid/go-resources v0.0.0-20190324090249-46f4269d8abd h1:VxcHM9xpZ4BHxQPYWAavsxPciBZITxmnGNyIO7hsUfk=
|
||||
github.com/omeid/go-resources v0.0.0-20190324090249-46f4269d8abd/go.mod h1:SIESmZeFlCKsQZcd2NEiX8spNNmCWB1V/RbM/eBKDfo=
|
||||
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||
github.com/peterbourgon/ff v1.2.0 h1:wGn2NwdHk8MTlRQpnXnO91UKegxt5DvlwR/bTK/L2hc=
|
||||
@@ -154,23 +110,9 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHVHGom5hKW5VXNc2xZIkfCKP8iaqOyYtUQ=
|
||||
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDFMn7db1kT65GmV94GzpX9Qdi7N/pQlwb+AN8wh+Q=
|
||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/wader/gormstore v0.0.0-20190302154359-acb787ba3755 h1:pNaEDfvqe9W2h4D+xm5f+lnZdao3Rob6O0b8SovpGbE=
|
||||
github.com/wader/gormstore v0.0.0-20190302154359-acb787ba3755/go.mod h1:PbEnTGtqU8NGCALR62gu2+eQYO8zQDEvaMJiPaj5Hic=
|
||||
@@ -181,7 +123,6 @@ golang.org/x/build v0.0.0-20190314133821-5284462c4bec/go.mod h1:atTaCNAy0f16Ah5a
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd h1:sMHc2rZHuzQmrbVoSpt9HgerkXPyIeCSO6k0zUMGfFk=
|
||||
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@@ -210,10 +151,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190412183630-56d357773e84 h1:IqXQ59gzdXv58Jmm2xn0tSOR9i6HqroaOFRQ3wR/dJQ=
|
||||
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -222,11 +159,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -238,11 +171,6 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138 h1:H3uGjxCR/6Ds0Mjgyp7LMK81+LvmbvWWEnJhzk1Pi9E=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b h1:NVD8gBK33xpdqCaZVVtd6OFJp+3dxkXuz7+U7KaVN6s=
|
||||
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
@@ -265,7 +193,6 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
|
||||
23039
server/assets_compiled/assets_compiled.go
Normal file
23039
server/assets_compiled/assets_compiled.go
Normal file
File diff suppressed because it is too large
Load Diff
9
server/assets_dev.go
Normal file
9
server/assets_dev.go
Normal file
@@ -0,0 +1,9 @@
|
||||
// +build !embed
|
||||
|
||||
package server
|
||||
|
||||
import "github.com/omeid/go-resources/live"
|
||||
|
||||
var (
|
||||
assets = live.Dir("./assets_src")
|
||||
)
|
||||
9
server/assets_prod.go
Normal file
9
server/assets_prod.go
Normal file
@@ -0,0 +1,9 @@
|
||||
// +build embed
|
||||
|
||||
package server
|
||||
|
||||
import "github.com/sentriz/gonic/server/assets_compiled"
|
||||
|
||||
var (
|
||||
assets = assets_compiled.Assets
|
||||
)
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 236 KiB After Width: | Height: | Size: 236 KiB |
@@ -34,6 +34,24 @@ body {
|
||||
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,
|
||||
@@ -5,7 +5,6 @@
|
||||
<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/awsm.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">
|
||||
@@ -61,4 +61,19 @@
|
||||
</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 }}
|
||||
@@ -53,6 +53,11 @@ func (c *Controller) ServeHome(w http.ResponseWriter, r *http.Request) {
|
||||
c.DB.Table("albums").Count(&data.AlbumCount)
|
||||
c.DB.Table("tracks").Count(&data.TrackCount)
|
||||
c.DB.Find(&data.AllUsers)
|
||||
c.DB.
|
||||
Where("tag_artist_id IS NOT NULL").
|
||||
Order("updated_at DESC").
|
||||
Limit(8).
|
||||
Find(&data.RecentFolders)
|
||||
data.CurrentLastFMAPIKey = c.GetSetting("lastfm_api_key")
|
||||
scheme := firstExisting(
|
||||
"http", // fallback
|
||||
|
||||
@@ -11,16 +11,17 @@ import (
|
||||
)
|
||||
|
||||
type templateData struct {
|
||||
Flashes []interface{}
|
||||
User *model.User
|
||||
SelectedUser *model.User
|
||||
AlbumCount int
|
||||
AllUsers []*model.User
|
||||
ArtistCount int
|
||||
AlbumCount int
|
||||
TrackCount int
|
||||
CurrentLastFMAPIKey string
|
||||
CurrentLastFMAPISecret string
|
||||
Flashes []interface{}
|
||||
RecentFolders []*model.Album
|
||||
RequestRoot string
|
||||
SelectedUser *model.User
|
||||
TrackCount int
|
||||
User *model.User
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, r *http.Request,
|
||||
|
||||
@@ -5,20 +5,11 @@
|
||||
"albumList": {
|
||||
"album": [
|
||||
{
|
||||
"id": 7,
|
||||
"coverArt": 7,
|
||||
"artist": "A Certain Ratio",
|
||||
"title": "(1994) The Graveyard and the Ballroom",
|
||||
"parent": 6,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"coverArt": 3,
|
||||
"artist": "Jah Wobble, The Edge, Holger Czukay",
|
||||
"title": "(1983) Snake Charmer",
|
||||
"parent": 2,
|
||||
"id": 11,
|
||||
"coverArt": 11,
|
||||
"artist": "13th Floor Lowervators",
|
||||
"title": "(1966) The Psychedelic Sounds of the 13th Floor Elevators",
|
||||
"parent": 9,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
@@ -32,38 +23,11 @@
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"coverArt": 19,
|
||||
"artist": "Swell Maps",
|
||||
"title": "(1979) A Trip to Marineville",
|
||||
"parent": 17,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"coverArt": 18,
|
||||
"artist": "Swell Maps",
|
||||
"title": "(1980) Jane From Occupied Europe",
|
||||
"parent": 17,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"coverArt": 8,
|
||||
"artist": "A Certain Ratio",
|
||||
"title": "(1981) To Each.",
|
||||
"parent": 6,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"coverArt": 11,
|
||||
"artist": "13th Floor Lowervators",
|
||||
"title": "(1966) The Psychedelic Sounds of the 13th Floor Elevators",
|
||||
"parent": 9,
|
||||
"id": 3,
|
||||
"coverArt": 3,
|
||||
"artist": "Jah Wobble, The Edge, Holger Czukay",
|
||||
"title": "(1983) Snake Charmer",
|
||||
"parent": 2,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
@@ -77,11 +41,20 @@
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"coverArt": 21,
|
||||
"artist": "Ten Years After",
|
||||
"title": "(1967) Ten Years After",
|
||||
"parent": 20,
|
||||
"id": 8,
|
||||
"coverArt": 8,
|
||||
"artist": "A Certain Ratio",
|
||||
"title": "(1981) To Each.",
|
||||
"parent": 6,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"coverArt": 19,
|
||||
"artist": "Swell Maps",
|
||||
"title": "(1979) A Trip to Marineville",
|
||||
"parent": 17,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
@@ -93,6 +66,33 @@
|
||||
"parent": 9,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"coverArt": 18,
|
||||
"artist": "Swell Maps",
|
||||
"title": "(1980) Jane From Occupied Europe",
|
||||
"parent": 17,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"coverArt": 7,
|
||||
"artist": "A Certain Ratio",
|
||||
"title": "(1994) The Graveyard and the Ballroom",
|
||||
"parent": 6,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"coverArt": 21,
|
||||
"artist": "Ten Years After",
|
||||
"title": "(1967) Ten Years After",
|
||||
"parent": 20,
|
||||
"isDir": true,
|
||||
"created": "0001-01-01T00:00:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"albumList2": {
|
||||
"album": [
|
||||
{
|
||||
"id": 3,
|
||||
"coverArt": 3,
|
||||
"artistId": 1,
|
||||
"artist": "Jah Wobble, The Edge & Holger Czukay",
|
||||
"name": "Snake Charmer",
|
||||
"created": "2019-06-10T17:06:25.998358476+01:00"
|
||||
"id": 5,
|
||||
"coverArt": 5,
|
||||
"artistId": 2,
|
||||
"artist": "Dead Moon",
|
||||
"name": "Unknown Passage",
|
||||
"created": "2019-06-10T17:06:26.000595013+01:00"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
@@ -20,21 +20,6 @@
|
||||
"name": "Easter Everywhere",
|
||||
"created": "2019-06-10T17:06:26.01139089+01:00"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"coverArt": 7,
|
||||
"artistId": 3,
|
||||
"artist": "A Certain Ratio",
|
||||
"name": "The Graveyard and the Ballroom",
|
||||
"created": "2019-06-10T17:06:26.003805335+01:00"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"artistId": 3,
|
||||
"artist": "A Certain Ratio",
|
||||
"name": "To Each...",
|
||||
"created": "2019-06-10T17:06:26.00810814+01:00"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"coverArt": 11,
|
||||
@@ -44,28 +29,12 @@
|
||||
"created": "2019-06-10T17:06:26.015039416+01:00"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"coverArt": 5,
|
||||
"artistId": 2,
|
||||
"artist": "Dead Moon",
|
||||
"name": "Unknown Passage",
|
||||
"created": "2019-06-10T17:06:26.000595013+01:00"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"coverArt": 15,
|
||||
"artistId": 5,
|
||||
"artist": "Anikas",
|
||||
"name": "Anika",
|
||||
"created": "2019-06-10T17:06:26.028934348+01:00"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"coverArt": 21,
|
||||
"artistId": 7,
|
||||
"artist": "Ten Years After",
|
||||
"name": "Ten Years After",
|
||||
"created": "2019-06-10T17:06:26.041345532+01:00"
|
||||
"id": 3,
|
||||
"coverArt": 3,
|
||||
"artistId": 1,
|
||||
"artist": "Jah Wobble, The Edge & Holger Czukay",
|
||||
"name": "Snake Charmer",
|
||||
"created": "2019-06-10T17:06:25.998358476+01:00"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
@@ -75,6 +44,22 @@
|
||||
"name": "A Trip to Marineville",
|
||||
"created": "2019-06-10T17:06:26.036222364+01:00"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"coverArt": 7,
|
||||
"artistId": 3,
|
||||
"artist": "A Certain Ratio",
|
||||
"name": "The Graveyard and the Ballroom",
|
||||
"created": "2019-06-10T17:06:26.003805335+01:00"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"coverArt": 15,
|
||||
"artistId": 5,
|
||||
"artist": "Anikas",
|
||||
"name": "Anika",
|
||||
"created": "2019-06-10T17:06:26.028934348+01:00"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"coverArt": 18,
|
||||
@@ -82,6 +67,21 @@
|
||||
"artist": "Swell Maps",
|
||||
"name": "Jane From Occupied Europe",
|
||||
"created": "2019-06-10T17:06:26.031594709+01:00"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"coverArt": 21,
|
||||
"artistId": 7,
|
||||
"artist": "Ten Years After",
|
||||
"name": "Ten Years After",
|
||||
"created": "2019-06-10T17:06:26.041345532+01:00"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"artistId": 3,
|
||||
"artist": "A Certain Ratio",
|
||||
"name": "To Each...",
|
||||
"created": "2019-06-10T17:06:26.00810814+01:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "2019-06-10T17:06:25.998787704+01:00",
|
||||
"duration": 372,
|
||||
"id": 1,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/01.05 Snake Charmer.flac",
|
||||
@@ -39,7 +38,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "2019-06-10T17:06:25.999138309+01:00",
|
||||
"duration": 331,
|
||||
"id": 2,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/03.05 It Was a Camel.flac",
|
||||
@@ -59,7 +57,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "2019-06-10T17:06:25.999449918+01:00",
|
||||
"duration": 523,
|
||||
"id": 3,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/02.05 Hold On to Your Dreams.flac",
|
||||
@@ -79,7 +76,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "2019-06-10T17:06:25.999768289+01:00",
|
||||
"duration": 418,
|
||||
"id": 4,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/05.05 Snake Charmer (reprise).flac",
|
||||
@@ -99,7 +95,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "2019-06-10T17:06:26.000111656+01:00",
|
||||
"duration": 227,
|
||||
"id": 5,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/04.05 Sleazy.flac",
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 372,
|
||||
"id": 1,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/01.05 Snake Charmer.flac",
|
||||
@@ -32,7 +31,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 523,
|
||||
"id": 3,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/02.05 Hold On to Your Dreams.flac",
|
||||
@@ -50,7 +48,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 331,
|
||||
"id": 2,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/03.05 It Was a Camel.flac",
|
||||
@@ -68,7 +65,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 227,
|
||||
"id": 5,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/04.05 Sleazy.flac",
|
||||
@@ -86,7 +82,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 3,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 418,
|
||||
"id": 4,
|
||||
"parent": 3,
|
||||
"path": "Jah Wobble, The Edge, Holger Czukay/(1983) Snake Charmer/05.05 Snake Charmer (reprise).flac",
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 7,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 332,
|
||||
"id": 15,
|
||||
"parent": 7,
|
||||
"path": "A Certain Ratio/(1994) The Graveyard and the Ballroom/13.14 Flight.flac",
|
||||
@@ -46,7 +45,6 @@
|
||||
"contentType": "audio/mpeg",
|
||||
"coverArt": 11,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 154,
|
||||
"id": 49,
|
||||
"parent": 11,
|
||||
"path": "13th Floor Lowervators/(1966) The Psychedelic Sounds of the 13th Floor Elevators/13.21 Before You Accuse Me.mp3",
|
||||
@@ -64,7 +62,6 @@
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": 18,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 220,
|
||||
"id": 85,
|
||||
"parent": 18,
|
||||
"path": "Swell Maps/(1980) Jane From Occupied Europe/13.16 Blenheim Shots.flac",
|
||||
@@ -82,7 +79,6 @@
|
||||
"contentType": "audio/mpeg",
|
||||
"coverArt": 19,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 463,
|
||||
"id": 102,
|
||||
"parent": 19,
|
||||
"path": "Swell Maps/(1979) A Trip to Marineville/d01 13.14 Adventuring Into Basketry.mp3",
|
||||
@@ -100,7 +96,6 @@
|
||||
"contentType": "audio/ogg",
|
||||
"coverArt": 21,
|
||||
"created": "0001-01-01T00:00:00Z",
|
||||
"duration": 433,
|
||||
"id": 115,
|
||||
"parent": 21,
|
||||
"path": "Ten Years After/(1967) Ten Years After/13.15 Spider in My Web.ogg",
|
||||
|
||||
@@ -6,24 +6,30 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gobuffalo/packr/v2"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/gorilla/securecookie"
|
||||
"github.com/wader/gormstore"
|
||||
)
|
||||
|
||||
func extendFromBox(tmpl *template.Template, box *packr.Box, key string) *template.Template {
|
||||
strT, err := box.FindString(key)
|
||||
if err != nil {
|
||||
log.Fatalf("error when reading template from box: %v", err)
|
||||
var (
|
||||
tmplFuncMap = template.FuncMap{
|
||||
"humandate": humanize.Time,
|
||||
}
|
||||
)
|
||||
|
||||
func extendFrom(tmpl *template.Template, key string) *template.Template {
|
||||
strT, ok := assets.String(key)
|
||||
if !ok {
|
||||
log.Fatalf("error when reading %q from assets", key)
|
||||
}
|
||||
if tmpl == nil {
|
||||
tmpl = template.New("layout")
|
||||
tmpl = template.New("layout").Funcs(tmplFuncMap)
|
||||
} else {
|
||||
tmpl = template.Must(tmpl.Clone())
|
||||
}
|
||||
newT, err := tmpl.Parse(strT)
|
||||
if err != nil {
|
||||
log.Fatalf("error when parsing template template: %v", err)
|
||||
log.Fatalf("error when parsing template: %v", err)
|
||||
}
|
||||
return newT
|
||||
}
|
||||
@@ -34,22 +40,21 @@ func (s *Server) SetupAdmin() {
|
||||
sessionKey = securecookie.GenerateRandomKey(32)
|
||||
s.SetSetting("session_key", string(sessionKey))
|
||||
}
|
||||
// create gormstore (and cleanup) for backend sessions
|
||||
s.SessDB = gormstore.New(s.DB, sessionKey)
|
||||
go s.SessDB.PeriodicCleanup(1*time.Hour, nil)
|
||||
// using packr to bundle templates and static files
|
||||
box := packr.New("templates", "./templates")
|
||||
layoutT := extendFromBox(nil, box, "layout.tmpl")
|
||||
userT := extendFromBox(layoutT, box, "user.tmpl")
|
||||
go s.SessDB.PeriodicCleanup(time.Hour, nil)
|
||||
//
|
||||
layoutT := extendFrom(nil, "/templates/layout.tmpl")
|
||||
userT := extendFrom(layoutT, "/templates/user.tmpl")
|
||||
s.Templates = map[string]*template.Template{
|
||||
"login": extendFromBox(layoutT, box, "pages/login.tmpl"),
|
||||
"home": extendFromBox(userT, box, "pages/home.tmpl"),
|
||||
"change_own_password": extendFromBox(userT, box, "pages/change_own_password.tmpl"),
|
||||
"change_password": extendFromBox(userT, box, "pages/change_password.tmpl"),
|
||||
"delete_user": extendFromBox(userT, box, "pages/delete_user.tmpl"),
|
||||
"create_user": extendFromBox(userT, box, "pages/create_user.tmpl"),
|
||||
"update_lastfm_api_key": extendFromBox(userT, box, "pages/update_lastfm_api_key.tmpl"),
|
||||
"login": extendFrom(layoutT, "/templates/pages/login.tmpl"),
|
||||
"home": extendFrom(userT, "/templates/pages/home.tmpl"),
|
||||
"change_own_password": extendFrom(userT, "/templates/pages/change_own_password.tmpl"),
|
||||
"change_password": extendFrom(userT, "/templates/pages/change_password.tmpl"),
|
||||
"delete_user": extendFrom(userT, "/templates/pages/delete_user.tmpl"),
|
||||
"create_user": extendFrom(userT, "/templates/pages/create_user.tmpl"),
|
||||
"update_lastfm_api_key": extendFrom(userT, "/templates/pages/update_lastfm_api_key.tmpl"),
|
||||
}
|
||||
//
|
||||
withPublicWare := newChain(
|
||||
s.WithLogging,
|
||||
s.WithSession,
|
||||
@@ -62,16 +67,21 @@ func (s *Server) SetupAdmin() {
|
||||
withUserWare,
|
||||
s.WithAdminSession,
|
||||
)
|
||||
server := http.FileServer(packr.New("static", "./static"))
|
||||
s.mux.Handle("/admin/static/", http.StripPrefix("/admin/static/", server))
|
||||
// begin static server
|
||||
s.mux.Handle("/admin/static/", http.StripPrefix("/admin",
|
||||
http.FileServer(assets),
|
||||
))
|
||||
// begin public routes (creates new session)
|
||||
s.mux.HandleFunc("/admin/login", withPublicWare(s.ServeLogin))
|
||||
s.mux.HandleFunc("/admin/login_do", withPublicWare(s.ServeLoginDo))
|
||||
// begin user routes (if session is valid)
|
||||
s.mux.HandleFunc("/admin/logout", withUserWare(s.ServeLogout))
|
||||
s.mux.HandleFunc("/admin/home", withUserWare(s.ServeHome))
|
||||
s.mux.HandleFunc("/admin/change_own_password", withUserWare(s.ServeChangeOwnPassword))
|
||||
s.mux.HandleFunc("/admin/change_own_password_do", withUserWare(s.ServeChangeOwnPasswordDo))
|
||||
s.mux.HandleFunc("/admin/link_lastfm_do", withUserWare(s.ServeLinkLastFMDo))
|
||||
s.mux.HandleFunc("/admin/unlink_lastfm_do", withUserWare(s.ServeUnlinkLastFMDo))
|
||||
// begin admin routes (if session is valid, and is admin)
|
||||
s.mux.HandleFunc("/admin/change_password", withAdminWare(s.ServeChangePassword))
|
||||
s.mux.HandleFunc("/admin/change_password_do", withAdminWare(s.ServeChangePasswordDo))
|
||||
s.mux.HandleFunc("/admin/delete_user", withAdminWare(s.ServeDeleteUser))
|
||||
|
||||
Reference in New Issue
Block a user