A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Auto detect favicon type and add fallback
Svilen Markov26ab9c7b0583
diff --git a/internal/glance/config.go b/internal/glance/config.goindex 318367c..7957b67 100644--- a/internal/glance/config.go+++ b/internal/glance/config.go@@ -50,6 +50,7 @@ type config struct {LogoText string `yaml:"logo-text"`LogoURL string `yaml:"logo-url"`FaviconURL string `yaml:"favicon-url"`+ FaviconType string `yaml:"-"`AppName string `yaml:"app-name"`AppIconURL string `yaml:"app-icon-url"`AppBackgroundColor string `yaml:"app-background-color"`diff --git a/internal/glance/glance.go b/internal/glance/glance.goindex c568be4..6f5beb2 100644--- a/internal/glance/glance.go+++ b/internal/glance/glance.go@@ -127,11 +127,17 @@ func newApplication(c *config) (*application, error) {config.Theme.CustomCSSFile = app.resolveUserDefinedAssetPath(config.Theme.CustomCSSFile)config.Branding.LogoURL = app.resolveUserDefinedAssetPath(config.Branding.LogoURL)- if config.Branding.FaviconURL == "" {- config.Branding.FaviconURL = app.StaticAssetPath("favicon.png")- } else {- config.Branding.FaviconURL = app.resolveUserDefinedAssetPath(config.Branding.FaviconURL)- }+ config.Branding.FaviconURL = ternary(+ config.Branding.FaviconURL == "",+ app.StaticAssetPath("favicon.svg"),+ app.resolveUserDefinedAssetPath(config.Branding.FaviconURL),+ )++ config.Branding.FaviconType = ternary(+ strings.HasSuffix(config.Branding.FaviconURL, ".svg"),+ "image/svg+xml",+ "image/png",+ )if config.Branding.AppName == "" {config.Branding.AppName = "Glance"diff --git a/internal/glance/templates/document.html b/internal/glance/templates/document.htmlindex ce2e9a6..91647f8 100644--- a/internal/glance/templates/document.html+++ b/internal/glance/templates/document.html@@ -21,7 +21,8 @@<meta name="theme-color" content="{{ .Request.Theme.BackgroundColorAsHex }}"><link rel="apple-touch-icon" sizes="512x512" href='{{ .App.Config.Branding.AppIconURL }}'><link rel="manifest" href='{{ .App.VersionedAssetPath "manifest.json" }}'>- <link rel="icon" type="image/png" href="{{ .App.Config.Branding.FaviconURL }}" />+ <link rel="icon" type="image/png" href='{{ .App.StaticAssetPath "favicon.png" }}' />+ <link rel="icon" type="{{ .App.Config.Branding.FaviconType }}" href="{{ .App.Config.Branding.FaviconURL }}" /><link rel="stylesheet" href='{{ .App.StaticAssetPath "css/bundle.css" }}'><script type="module" src='{{ .App.StaticAssetPath "js/main.js" }}'></script><style id="theme-style">