mirror of
https://github.com/glanceapp/glance.git
synced 2025-08-20 04:28:49 +02:00
Add Dashboard Icons prefix support
- defined new type IconSource and constants, presently supporting: - LocalFile - SimpleIcon - DashboardIcon - added new field to bookmarks and monitors to hold IconSource - adjusted IsSimpleIcon to get truthiness from IconSource field - generalised `toSimpleIconIfPrefixed` into `toRemoteResourceIconIfPrefixed`, adding support for `walkxcode`'s dashboard icons via CDN (svg)
This commit is contained in:
@@ -49,6 +49,7 @@ type Monitor struct {
|
||||
Title string `yaml:"title"`
|
||||
IconUrl string `yaml:"icon"`
|
||||
IsSimpleIcon bool `yaml:"-"`
|
||||
IconSource IconSource `yaml:"-"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
StatusText string `yaml:"-"`
|
||||
StatusStyle string `yaml:"-"`
|
||||
@@ -61,7 +62,8 @@ func (widget *Monitor) Initialize() error {
|
||||
widget.withTitle("Monitor").withCacheDuration(5 * time.Minute)
|
||||
|
||||
for i := range widget.Sites {
|
||||
widget.Sites[i].IconUrl, widget.Sites[i].IsSimpleIcon = toSimpleIconIfPrefixed(widget.Sites[i].IconUrl)
|
||||
widget.Sites[i].IconUrl, widget.Sites[i].IconSource = toRemoteResourceIconIfPrefixed(widget.Sites[i].IconUrl)
|
||||
widget.Sites[i].IsSimpleIcon = widget.Sites[i].IconSource == SimpleIcon
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user