From 87acf0aefb9bad4b8f6be79d21ba3b1099d059ce Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Mon, 4 Oct 2021 13:03:26 +1030 Subject: [PATCH] Rework to use golang 1.16 embed package instead of go-bindata. Rework templates to be less insane --- .gitignore | 1 - build-release.pl | 1 - dau.go | 2 -- go.mod | 2 +- {data => web/data}/config.html | 5 ++- {data => web/data}/dau.css | 0 {data => web/data}/index.html | 6 +++- {data => web/data}/logs.html | 8 +++++ {data => web/data}/uploads.html | 6 ++++ {data => web/data}/wrapper.tmpl | 8 ++++- web/server.go | 62 +++++++++++++++++++-------------- 11 files changed, 66 insertions(+), 35 deletions(-) rename {data => web/data}/config.html (98%) rename {data => web/data}/dau.css (100%) rename {data => web/data}/index.html (83%) rename {data => web/data}/logs.html (95%) rename {data => web/data}/uploads.html (94%) rename {data => web/data}/wrapper.tmpl (96%) diff --git a/.gitignore b/.gitignore index bf7c1eb..f4c8532 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ dist release discord-auto-upload discord-auto-upload.exe -assets *.png *.jpg .DS_Store diff --git a/build-release.pl b/build-release.pl index 38d2528..935a23e 100755 --- a/build-release.pl +++ b/build-release.pl @@ -33,7 +33,6 @@ foreach my $type (keys %build) { add_extras(); -system(qw{go generate}); foreach my $type (keys %build) { local $ENV{GOOS} = $build{$type}->{env}->{GOOS}; local $ENV{GOARCH} = $build{$type}->{env}->{GOARCH}; diff --git a/dau.go b/dau.go index 51c4b4c..a8bb803 100644 --- a/dau.go +++ b/dau.go @@ -1,7 +1,5 @@ package main -//go:generate go-bindata -pkg assets -o assets/static.go -prefix data/ data - import ( "encoding/json" "fmt" diff --git a/go.mod b/go.mod index 5ba2837..1057250 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tardisx/discord-auto-upload -go 1.15 +go 1.16 require ( github.com/fogleman/gg v1.3.0 diff --git a/data/config.html b/web/data/config.html similarity index 98% rename from data/config.html rename to web/data/config.html index 6a7cf8e..a687ef8 100644 --- a/data/config.html +++ b/web/data/config.html @@ -1,3 +1,4 @@ +{{ define "content" }}

Config

@@ -99,8 +100,9 @@
+{{ end }} - +{{ define "js" }} +{{ end }} diff --git a/data/dau.css b/web/data/dau.css similarity index 100% rename from data/dau.css rename to web/data/dau.css diff --git a/data/index.html b/web/data/index.html similarity index 83% rename from data/index.html rename to web/data/index.html index c7481d6..987749e 100644 --- a/data/index.html +++ b/web/data/index.html @@ -1,4 +1,4 @@ - +{{ define "content" }}

Discord Auto Upload

Hey look, it's DAU :-)

@@ -6,3 +6,7 @@ Learn more

+{{ end }} + +{{ define "js" }} +{{ end }} \ No newline at end of file diff --git a/data/logs.html b/web/data/logs.html similarity index 95% rename from data/logs.html rename to web/data/logs.html index 6d5c506..b0bb397 100644 --- a/data/logs.html +++ b/web/data/logs.html @@ -1,3 +1,4 @@ +{{ define "content" }}

Logs

@@ -21,6 +22,10 @@
+{{ end }} + +{{ define "js" }} + + + +{{ end }} \ No newline at end of file diff --git a/data/uploads.html b/web/data/uploads.html similarity index 94% rename from data/uploads.html rename to web/data/uploads.html index 0f40221..8444684 100644 --- a/data/uploads.html +++ b/web/data/uploads.html @@ -1,3 +1,5 @@ +{{ define "content" }} +

Uploads

Discord-auto-upload uploads

@@ -12,6 +14,9 @@
+{{ end }} + +{{ define "js" }} +{{ end }} diff --git a/data/wrapper.tmpl b/web/data/wrapper.tmpl similarity index 96% rename from data/wrapper.tmpl rename to web/data/wrapper.tmpl index e46a36c..d6a0e43 100644 --- a/data/wrapper.tmpl +++ b/web/data/wrapper.tmpl @@ -1,3 +1,5 @@ +{{ define "layout" }} + @@ -46,7 +48,8 @@ -{{.Body}} +{{ template "content" . }} +