From d60db93bf20fe41c6e50c64d5d36d2759213b9eb Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 14 Jan 2026 00:39:46 +0000 Subject: [PATCH] Make public report and sync share static assets It just seems useful --- {sync => htmlpage}/static/favicon.ico | Bin .../static/img/nidus-logo-256-transparent.png | Bin {public-report => htmlpage}/static/js/geocode.js | 0 {public-report => htmlpage}/static/js/location.js | 0 {public-report => htmlpage}/static/js/map.js | 0 .../static/vendor/css/bootstrap.min.css | 0 .../static/vendor/js/bootstrap.bundle.min.js | 0 .../static/vendor/js/bootstrap.min.js | 0 public-report/routes.go | 5 +---- sync/page.go | 3 --- sync/routes.go | 6 +----- 11 files changed, 2 insertions(+), 12 deletions(-) rename {sync => htmlpage}/static/favicon.ico (100%) rename {sync => htmlpage}/static/img/nidus-logo-256-transparent.png (100%) rename {public-report => htmlpage}/static/js/geocode.js (100%) rename {public-report => htmlpage}/static/js/location.js (100%) rename {public-report => htmlpage}/static/js/map.js (100%) rename {sync => htmlpage}/static/vendor/css/bootstrap.min.css (100%) rename {sync => htmlpage}/static/vendor/js/bootstrap.bundle.min.js (100%) rename {sync => htmlpage}/static/vendor/js/bootstrap.min.js (100%) diff --git a/sync/static/favicon.ico b/htmlpage/static/favicon.ico similarity index 100% rename from sync/static/favicon.ico rename to htmlpage/static/favicon.ico diff --git a/sync/static/img/nidus-logo-256-transparent.png b/htmlpage/static/img/nidus-logo-256-transparent.png similarity index 100% rename from sync/static/img/nidus-logo-256-transparent.png rename to htmlpage/static/img/nidus-logo-256-transparent.png diff --git a/public-report/static/js/geocode.js b/htmlpage/static/js/geocode.js similarity index 100% rename from public-report/static/js/geocode.js rename to htmlpage/static/js/geocode.js diff --git a/public-report/static/js/location.js b/htmlpage/static/js/location.js similarity index 100% rename from public-report/static/js/location.js rename to htmlpage/static/js/location.js diff --git a/public-report/static/js/map.js b/htmlpage/static/js/map.js similarity index 100% rename from public-report/static/js/map.js rename to htmlpage/static/js/map.js diff --git a/sync/static/vendor/css/bootstrap.min.css b/htmlpage/static/vendor/css/bootstrap.min.css similarity index 100% rename from sync/static/vendor/css/bootstrap.min.css rename to htmlpage/static/vendor/css/bootstrap.min.css diff --git a/sync/static/vendor/js/bootstrap.bundle.min.js b/htmlpage/static/vendor/js/bootstrap.bundle.min.js similarity index 100% rename from sync/static/vendor/js/bootstrap.bundle.min.js rename to htmlpage/static/vendor/js/bootstrap.bundle.min.js diff --git a/sync/static/vendor/js/bootstrap.min.js b/htmlpage/static/vendor/js/bootstrap.min.js similarity index 100% rename from sync/static/vendor/js/bootstrap.min.js rename to htmlpage/static/vendor/js/bootstrap.min.js diff --git a/public-report/routes.go b/public-report/routes.go index 17290814..67188698 100644 --- a/public-report/routes.go +++ b/public-report/routes.go @@ -1,8 +1,6 @@ package publicreport import ( - "net/http" - "github.com/Gleipnir-Technology/nidus-sync/htmlpage" "github.com/go-chi/chi/v5" ) @@ -24,7 +22,6 @@ func Router() chi.Router { r.Get("/search", getSearch) r.Get("/status", getStatus) r.Get("/status/{report_id}", getStatusByID) - localFS := http.Dir("./public-report/static") - htmlpage.FileServer(r, "/static", localFS, EmbeddedStaticFS, "static") + htmlpage.AddStaticRoute(r, "/static") return r } diff --git a/sync/page.go b/sync/page.go index c0d0e3de..1738e5b7 100644 --- a/sync/page.go +++ b/sync/page.go @@ -12,9 +12,6 @@ import ( //go:embed template/* var embeddedFiles embed.FS -//go:embed static/* -var EmbeddedStaticFS embed.FS - var components = [...]string{"header", "map"} func buildTemplate(files ...string) *htmlpage.BuiltTemplate { diff --git a/sync/routes.go b/sync/routes.go index 0a24a87f..369bedd2 100644 --- a/sync/routes.go +++ b/sync/routes.go @@ -1,8 +1,6 @@ package sync import ( - "net/http" - "github.com/Gleipnir-Technology/nidus-sync/api" "github.com/Gleipnir-Technology/nidus-sync/auth" "github.com/Gleipnir-Technology/nidus-sync/htmlpage" @@ -68,9 +66,7 @@ func Router() chi.Router { r.Method("GET", "/cell/{cell}", auth.NewEnsureAuth(getCellDetails)) r.Method("GET", "/settings", auth.NewEnsureAuth(getSettings)) r.Method("GET", "/source/{globalid}", auth.NewEnsureAuth(getSource)) - //r.Method("GET", "/vector-tiles/{org_id}/{tileset_id}/{zoom}/{x}/{y}.{format}", auth.NewEnsureAuth(getVectorTiles)) - localFS := http.Dir("./sync/static") - htmlpage.FileServer(r, "/static", localFS, EmbeddedStaticFS, "static") + htmlpage.AddStaticRoute(r, "/static") return r }