diff --git a/internal/assets/static/icons/dockerhub.svg b/internal/assets/static/icons/dockerhub.svg
new file mode 100644
index 0000000..8669c00
--- /dev/null
+++ b/internal/assets/static/icons/dockerhub.svg
@@ -0,0 +1 @@
+
diff --git a/internal/assets/static/icons/github.svg b/internal/assets/static/icons/github.svg
new file mode 100644
index 0000000..6cf48c8
--- /dev/null
+++ b/internal/assets/static/icons/github.svg
@@ -0,0 +1 @@
+
diff --git a/internal/assets/static/icons/gitlab.svg b/internal/assets/static/icons/gitlab.svg
new file mode 100644
index 0000000..42e4c97
--- /dev/null
+++ b/internal/assets/static/icons/gitlab.svg
@@ -0,0 +1 @@
+
diff --git a/internal/assets/static/main.css b/internal/assets/static/main.css
index 081c64a..ddad6e0 100644
--- a/internal/assets/static/main.css
+++ b/internal/assets/static/main.css
@@ -709,6 +709,7 @@ kbd:active {
width: 16px;
height: 16px;
flex-shrink: 0;
+ opacity: 0.4;
}
.market-chart {
@@ -887,6 +888,7 @@ kbd:active {
background-color: var(--color-widget-background-highlight);
border-radius: var(--border-radius);
padding: 0.5rem;
+ opacity: 0.7;
}
.bookmarks-icon {
@@ -895,10 +897,6 @@ kbd:active {
opacity: 0.8;
}
-.simple-icon {
- opacity: 0.7;
-}
-
:root:not(.light-scheme) .simple-icon {
filter: invert(1);
}
@@ -1073,6 +1071,10 @@ kbd:active {
transition: filter 0.3s, opacity 0.3s;
}
+.monitor-site-icon.simple-icon {
+ opacity: 0.7;
+}
+
.monitor-site:hover .monitor-site-icon {
filter: grayscale(0);
opacity: 1;
diff --git a/internal/assets/templates/releases.html b/internal/assets/templates/releases.html
index 13e6a0d..7cd89f7 100644
--- a/internal/assets/templates/releases.html
+++ b/internal/assets/templates/releases.html
@@ -7,16 +7,7 @@
{{ .Name }}
{{ if $.ShowSourceIcon }}
- {{/* TODO: add the icons as assets and link to them here instead of hardcoding */}}
-
+

{{ end }}
diff --git a/internal/feed/primitives.go b/internal/feed/primitives.go
index 4b623ec..ebf7361 100644
--- a/internal/feed/primitives.go
+++ b/internal/feed/primitives.go
@@ -41,12 +41,13 @@ type Weather struct {
}
type AppRelease struct {
- Source ReleaseSource
- Name string
- Version string
- NotesUrl string
- TimeReleased time.Time
- Downvotes int
+ Source ReleaseSource
+ SourceIconURL string
+ Name string
+ Version string
+ NotesUrl string
+ TimeReleased time.Time
+ Downvotes int
}
type AppReleases []AppRelease
diff --git a/internal/glance/glance.go b/internal/glance/glance.go
index a88effb..628b546 100644
--- a/internal/glance/glance.go
+++ b/internal/glance/glance.go
@@ -134,6 +134,10 @@ func NewApplication(config *Config) (*Application, error) {
app.Config.Server.AssetsHash = assets.PublicFSHash
app.slugToPage[""] = &config.Pages[0]
+ providers := &widget.Providers{
+ AssetResolver: app.AssetPath,
+ }
+
for p := range config.Pages {
if config.Pages[p].Slug == "" {
config.Pages[p].Slug = titleToSlug(config.Pages[p].Title)
@@ -145,6 +149,8 @@ func NewApplication(config *Config) (*Application, error) {
for w := range config.Pages[p].Columns[c].Widgets {
widget := config.Pages[p].Columns[c].Widgets[w]
app.widgetByID[widget.GetID()] = widget
+
+ widget.SetProviders(providers)
}
}
}
diff --git a/internal/widget/releases.go b/internal/widget/releases.go
index f32e581..c7831cb 100644
--- a/internal/widget/releases.go
+++ b/internal/widget/releases.go
@@ -87,6 +87,10 @@ func (widget *Releases) Update(ctx context.Context) {
releases = releases[:widget.Limit]
}
+ for i := range releases {
+ releases[i].SourceIconURL = widget.Providers.AssetResolver("icons/" + string(releases[i].Source) + ".svg")
+ }
+
widget.Releases = releases
}
diff --git a/internal/widget/widget.go b/internal/widget/widget.go
index a08eeed..077dbe6 100644
--- a/internal/widget/widget.go
+++ b/internal/widget/widget.go
@@ -111,6 +111,7 @@ func (w *Widgets) UnmarshalYAML(node *yaml.Node) error {
type Widget interface {
Initialize() error
RequiresUpdate(*time.Time) bool
+ SetProviders(*Providers)
Update(context.Context)
Render() template.HTML
GetType() string
@@ -130,6 +131,7 @@ const (
type widgetBase struct {
ID uint64 `yaml:"-"`
+ Providers *Providers `yaml:"-"`
Type string `yaml:"type"`
Title string `yaml:"title"`
TitleURL string `yaml:"title-url"`
@@ -146,6 +148,10 @@ type widgetBase struct {
HideHeader bool `yaml:"-"`
}
+type Providers struct {
+ AssetResolver func(string) string
+}
+
func (w *widgetBase) RequiresUpdate(now *time.Time) bool {
if w.cacheType == cacheTypeInfinite {
return false
@@ -182,6 +188,10 @@ func (w *widgetBase) GetType() string {
return w.Type
}
+func (w *widgetBase) SetProviders(providers *Providers) {
+ w.Providers = providers
+}
+
func (w *widgetBase) render(data any, t *template.Template) template.HTML {
w.templateBuffer.Reset()
err := t.Execute(&w.templateBuffer, data)