diff --git a/Makefile b/Makefile index f96321c..5c96c65 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ build: GOOS=linux GOARCH=amd64 go build -o $(EXEC) bundle: build - tar czf $(EXEC).tar.gz $(EXEC) admin/components/ admin/views/ admin/static/ views/ public/ schema-migration/ + tar czf $(EXEC).tar.gz $(EXEC) admin/static/ public/ clean: rm $(EXEC) $(EXEC).tar.gz diff --git a/admin/http.go b/admin/http.go index f65d8b9..23bdeae 100644 --- a/admin/http.go +++ b/admin/http.go @@ -3,13 +3,9 @@ package admin import ( "context" "database/sql" - "embed" "fmt" - "mime" "net/http" "os" - "path" - "path/filepath" "strings" "time" @@ -17,6 +13,7 @@ import ( "arimelody-web/controller" "arimelody-web/log" "arimelody-web/model" + "arimelody-web/view" "golang.org/x/crypto/bcrypt" ) @@ -58,7 +55,9 @@ func Handler(app *model.AppState) http.Handler { mux.Handle("/tracks", requireAccount(serveTracks(app))) mux.Handle("/tracks/", requireAccount(serveTracks(app))) - mux.Handle("/static/", staticHandler()) + mux.Handle("/static/", requireAccount( + http.StripPrefix("/static", + view.ServeFiles("./admin/static")))) mux.Handle("/", requireAccount(AdminIndexHandler(app))) @@ -484,6 +483,7 @@ func requireAccount(next http.Handler) http.HandlerFunc { }) } +/* //go:embed "static" var staticFS embed.FS @@ -502,6 +502,7 @@ func staticHandler() http.Handler { w.Write(file) }) } +*/ func enforceSession(app *model.AppState, next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/admin/static/admin.css b/admin/static/admin.css index 27cd867..8f983c7 100644 --- a/admin/static/admin.css +++ b/admin/static/admin.css @@ -94,8 +94,8 @@ @media (prefers-color-scheme: dark) { img.icon { - -webkit-filter: invert(1); - filter: invert(1); + -webkit-filter: invert(.9); + filter: invert(.9); } } @@ -217,13 +217,16 @@ nav .section-label { transform: translate(1px, 1px); } #toggle-nav img:hover { + -webkit-filter: invert(.9); filter: invert(.9); } @media (prefers-color-scheme: dark) { #toggle-nav img { + -webkit-filter: invert(.9); filter: invert(.9); } #toggle-nav img:hover { + -webkit-filter: none; filter: none; } } diff --git a/public/script/music-gateway.js b/public/script/music-gateway.js index 097a398..237868c 100644 --- a/public/script/music-gateway.js +++ b/public/script/music-gateway.js @@ -20,7 +20,6 @@ function update_extras_buttons() { const info_container = document.getElementById("info") info_container.addEventListener("scroll", update_extras_buttons); const info_rect = info_container.getBoundingClientRect(); - const info_y = info_rect.y; const font_size = parseFloat(getComputedStyle(document.documentElement).fontSize); let current = extras_pairs[0]; extras_pairs.forEach(pair => { @@ -53,7 +52,7 @@ function bind_go_back_btn() { function bind_share_btn() { const share_btn = document.getElementById("share"); if (navigator.clipboard === undefined) { - share_btn.onclick = event => { + share_btn.onclick = () => { console.error("clipboard is not supported by this browser!"); }; return; diff --git a/view/index.go b/view/index.go index fabbba4..0b334ef 100644 --- a/view/index.go +++ b/view/index.go @@ -38,6 +38,7 @@ func IndexHandler(app *model.AppState) http.Handler { return } - ServeEmbedFS(app.PublicFS, "public").ServeHTTP(w, r) + http.FileServer(http.Dir("./public")).ServeHTTP(w, r) + //ServeEmbedFS(app.PublicFS, "public").ServeHTTP(w, r) }) }