Make public report and sync share static assets
It just seems useful
This commit is contained in:
parent
81dabdf097
commit
d60db93bf2
11 changed files with 2 additions and 12 deletions
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
|
@ -1,8 +1,6 @@
|
||||||
package publicreport
|
package publicreport
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
@ -24,7 +22,6 @@ func Router() chi.Router {
|
||||||
r.Get("/search", getSearch)
|
r.Get("/search", getSearch)
|
||||||
r.Get("/status", getStatus)
|
r.Get("/status", getStatus)
|
||||||
r.Get("/status/{report_id}", getStatusByID)
|
r.Get("/status/{report_id}", getStatusByID)
|
||||||
localFS := http.Dir("./public-report/static")
|
htmlpage.AddStaticRoute(r, "/static")
|
||||||
htmlpage.FileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ import (
|
||||||
//go:embed template/*
|
//go:embed template/*
|
||||||
var embeddedFiles embed.FS
|
var embeddedFiles embed.FS
|
||||||
|
|
||||||
//go:embed static/*
|
|
||||||
var EmbeddedStaticFS embed.FS
|
|
||||||
|
|
||||||
var components = [...]string{"header", "map"}
|
var components = [...]string{"header", "map"}
|
||||||
|
|
||||||
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package sync
|
package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/api"
|
"github.com/Gleipnir-Technology/nidus-sync/api"
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
"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", "/cell/{cell}", auth.NewEnsureAuth(getCellDetails))
|
||||||
r.Method("GET", "/settings", auth.NewEnsureAuth(getSettings))
|
r.Method("GET", "/settings", auth.NewEnsureAuth(getSettings))
|
||||||
r.Method("GET", "/source/{globalid}", auth.NewEnsureAuth(getSource))
|
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.AddStaticRoute(r, "/static")
|
||||||
htmlpage.FileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue