A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Add HTML widget
Svilen Markov75079a981b95
diff --git a/docs/configuration.md b/docs/configuration.mdindex c76414e..f547700 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -26,6 +26,7 @@- [Twitch Channels](#twitch-channels)- [Twitch Top Games](#twitch-top-games)- [iframe](#iframe)+ - [HTML](#html)## IntroConfiguration is done via a single YAML file and a server restart is required in order for any changes to take effect. Trying to start the server with an invalid config file will result in an error.@@ -1412,3 +1413,16 @@ The source of the iframe.##### `height`The height of the iframe. The minimum allowed height is 50.++### HTML+Embed any HTML.++Example:++```yaml+- type: html+ source: |+ <p>Hello, <span class="color-primary">World</span>!</p>+```++Note the use of `|` after `source:`, this allows you to insert a multi-line string.diff --git a/internal/widget/html.go b/internal/widget/html.gonew file mode 100644index 0000000..6c66488--- /dev/null+++ b/internal/widget/html.go@@ -0,0 +1,20 @@+package widget++import (+ "html/template"+)++type HTML struct {+ widgetBase `yaml:",inline"`+ Source template.HTML `yaml:"source"`+}++func (widget *HTML) Initialize() error {+ widget.withTitle("").withError(nil)++ return nil+}++func (widget *HTML) Render() template.HTML {+ return widget.Source+}diff --git a/internal/widget/widget.go b/internal/widget/widget.goindex e16af92..0ccb3de 100644--- a/internal/widget/widget.go+++ b/internal/widget/widget.go@@ -27,6 +27,8 @@ func New(widgetType string) (Widget, error) {return &Bookmarks{}, nilcase "iframe":return &IFrame{}, nil+ case "html":+ return &HTML{}, nilcase "hacker-news":return &HackerNews{}, nilcase "releases":