Fix hardcoded release icons
This commit is contained in:
parent
b484e32b08
commit
1a4c12d851
9 changed files with 37 additions and 20 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue