A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Added baseurl somewhere
Luca Cremaa07fbfd7b761
diff --git a/internal/assets/templates/document.html b/internal/assets/templates/document.htmlindex d126d8b..4d784bd 100644--- a/internal/assets/templates/document.html+++ b/internal/assets/templates/document.html@@ -11,12 +11,12 @@<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><meta name="apple-mobile-web-app-title" content="Glance"><meta name="theme-color" content="{{ if ne nil .App.Config.Theme.BackgroundColor }}{{ .App.Config.Theme.BackgroundColor }}{{ else }}hsl(240, 8%, 9%){{ end }}">- <link rel="apple-touch-icon" sizes="512x512" href="/static/app-icon.png">- <link rel="icon" type="image/png" sizes="50x50" href="/static/favicon.png">- <link rel="manifest" href="/static/manifest.json">- <link rel="icon" type="image/png" href="/static/favicon.png" />- <link rel="stylesheet" href="/static/main.css?v={{ .App.Config.Server.StartedAt.Unix }}">- <script async src="/static/main.js?v={{ .App.Config.Server.StartedAt.Unix }}"></script>+ <link rel="apple-touch-icon" sizes="512x512" href="{{ .App.Config.Server.BaseUrl }}/static/app-icon.png">+ <link rel="icon" type="image/png" sizes="50x50" href="{{ .App.Config.Server.BaseUrl }}/static/favicon.png">+ <link rel="manifest" href="{{ .App.Config.Server.BaseUrl }}/static/manifest.json">+ <link rel="icon" type="image/png" href="{{ .App.Config.Server.BaseUrl }}/static/favicon.png" />+ <link rel="stylesheet" href="{{ .App.Config.Server.BaseUrl }}/static/main.css?v={{ .App.Config.Server.StartedAt.Unix }}">+ <script async src="{{ .App.Config.Server.BaseUrl }}/static/main.js?v={{ .App.Config.Server.StartedAt.Unix }}"></script>{{ block "document-head-after" . }}{{ end }}</head><body>diff --git a/internal/glance/glance.go b/internal/glance/glance.goindex 653be75..8520012 100644--- a/internal/glance/glance.go+++ b/internal/glance/glance.go@@ -41,6 +41,7 @@ type Server struct {Host string `yaml:"host"`Port uint16 `yaml:"port"`AssetsPath string `yaml:"assets-path"`+ BaseUrl string `yaml:"base-url"`StartedAt time.Time `yaml:"-"`}@@ -194,10 +195,10 @@ func (a *Application) Serve() error {// TODO: add HTTPS supportmux := http.NewServeMux()- mux.HandleFunc("GET /{$}", a.HandlePageRequest)- mux.HandleFunc("GET /{page}", a.HandlePageRequest)- mux.HandleFunc("GET /api/pages/{page}/content/{$}", a.HandlePageContentRequest)- mux.Handle("GET /static/{path...}", http.StripPrefix("/static/", FileServerWithCache(http.FS(assets.PublicFS), 2*time.Hour)))+ mux.HandleFunc(fmt.Sprintf("GET %s/{$}", a.Config.Server.BaseUrl), a.HandlePageRequest)+ mux.HandleFunc(fmt.Sprintf("GET %s/{page}", a.Config.Server.BaseUrl), a.HandlePageRequest)+ mux.HandleFunc(fmt.Sprintf("GET %s/api/pages/{page}/content/{$}", a.Config.Server.BaseUrl), a.HandlePageContentRequest)+ mux.Handle(fmt.Sprintf("GET %s/static/{path...}", a.Config.Server.BaseUrl), http.StripPrefix(fmt.Sprintf("%s/static/", a.Config.Server.BaseUrl), FileServerWithCache(http.FS(assets.PublicFS), 2*time.Hour)))if a.Config.Server.AssetsPath != "" {absAssetsPath, err := filepath.Abs(a.Config.Server.AssetsPath)@@ -208,7 +209,7 @@ func (a *Application) Serve() error {slog.Info("Serving assets", "path", absAssetsPath)assetsFS := FileServerWithCache(http.Dir(a.Config.Server.AssetsPath), 2*time.Hour)- mux.Handle("/assets/{path...}", http.StripPrefix("/assets/", assetsFS))+ mux.Handle(fmt.Sprintf("%s/assets/{path...}", a.Config.Server.BaseUrl), http.StripPrefix("/assets/", assetsFS))}server := http.Server{