widget

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HSLHueMax        = 360
	HSLSaturationMax = 100
	HSLLightnessMax  = 100
)

Variables

View Source
var DurationPattern = regexp.MustCompile(`^(\d+)(s|m|h|d)$`)
View Source
var EnvFieldPattern = regexp.MustCompile(`^\${([A-Z_]+)}$`)
View Source
var HSLColorPattern = regexp.MustCompile(`^(?:hsla?\()?(\d{1,3})(?: |,)+(\d{1,3})%?(?: |,)+(\d{1,3})%?\)?$`)

Functions

This section is empty.

Types

type Bookmarks

type Bookmarks struct {
	Groups []struct {
		Title string         `yaml:"title"`
		Color *HSLColorField `yaml:"color"`
		Links []struct {
			Title        string `yaml:"title"`
			URL          string `yaml:"url"`
			Icon         string `yaml:"icon"`
			IsSimpleIcon bool   `yaml:"-"`
			SameTab      bool   `yaml:"same-tab"`
			HideArrow    bool   `yaml:"hide-arrow"`
		} `yaml:"links"`
	} `yaml:"groups"`
	Style string `yaml:"style"`
	// contains filtered or unexported fields
}

func (*Bookmarks) GetType

func (w *Bookmarks) GetType() string

func (*Bookmarks) Initialize

func (widget *Bookmarks) Initialize() error

func (*Bookmarks) Render

func (widget *Bookmarks) Render() template.HTML

func (*Bookmarks) RequiresUpdate

func (w *Bookmarks) RequiresUpdate(now *time.Time) bool

func (*Bookmarks) Update

func (w *Bookmarks) Update(ctx context.Context)

type Calendar

type Calendar struct {
	Calendar *feed.Calendar
	// contains filtered or unexported fields
}

func (*Calendar) GetType

func (w *Calendar) GetType() string

func (*Calendar) Initialize

func (widget *Calendar) Initialize() error

func (*Calendar) Render

func (widget *Calendar) Render() template.HTML

func (*Calendar) RequiresUpdate

func (w *Calendar) RequiresUpdate(now *time.Time) bool

func (*Calendar) Update

func (widget *Calendar) Update(ctx context.Context)

type ChangeDetection added in v0.5.0

type ChangeDetection struct {
	ChangeDetections feed.ChangeDetectionWatches `yaml:"-"`
	WatchUUIDs       []string                    `yaml:"watches"`
	InstanceURL      string                      `yaml:"instance-url"`
	Token            OptionalEnvString           `yaml:"token"`
	Limit            int                         `yaml:"limit"`
	CollapseAfter    int                         `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*ChangeDetection) GetType added in v0.5.0

func (w *ChangeDetection) GetType() string

func (*ChangeDetection) Initialize added in v0.5.0

func (widget *ChangeDetection) Initialize() error

func (*ChangeDetection) Render added in v0.5.0

func (widget *ChangeDetection) Render() template.HTML

func (*ChangeDetection) RequiresUpdate added in v0.5.0

func (w *ChangeDetection) RequiresUpdate(now *time.Time) bool

func (*ChangeDetection) Update added in v0.5.0

func (widget *ChangeDetection) Update(ctx context.Context)

type Clock added in v0.5.0

type Clock struct {
	HourFormat string `yaml:"hour-format"`
	Timezones  []struct {
		Timezone string `yaml:"timezone"`
		Label    string `yaml:"label"`
	} `yaml:"timezones"`
	// contains filtered or unexported fields
}

func (*Clock) GetType added in v0.5.0

func (w *Clock) GetType() string

func (*Clock) Initialize added in v0.5.0

func (widget *Clock) Initialize() error

func (*Clock) Render added in v0.5.0

func (widget *Clock) Render() template.HTML

func (*Clock) RequiresUpdate added in v0.5.0

func (w *Clock) RequiresUpdate(now *time.Time) bool

func (*Clock) Update added in v0.5.0

func (w *Clock) Update(ctx context.Context)

type DurationField

type DurationField time.Duration

func (*DurationField) UnmarshalYAML

func (d *DurationField) UnmarshalYAML(node *yaml.Node) error

type Extension added in v0.5.0

type Extension struct {
	URL        string            `yaml:"url"`
	Parameters map[string]string `yaml:"parameters"`
	AllowHtml  bool              `yaml:"allow-potentially-dangerous-html"`
	Extension  feed.Extension    `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Extension) GetType added in v0.5.0

func (w *Extension) GetType() string

func (*Extension) Initialize added in v0.5.0

func (widget *Extension) Initialize() error

func (*Extension) Render added in v0.5.0

func (widget *Extension) Render() template.HTML

func (*Extension) RequiresUpdate added in v0.5.0

func (w *Extension) RequiresUpdate(now *time.Time) bool

func (*Extension) Update added in v0.5.0

func (widget *Extension) Update(ctx context.Context)

type HSLColorField

type HSLColorField struct {
	Hue        uint16
	Saturation uint8
	Lightness  uint8
}

func (*HSLColorField) AsCSSValue

func (c *HSLColorField) AsCSSValue() template.CSS

func (*HSLColorField) String

func (c *HSLColorField) String() string

func (*HSLColorField) UnmarshalYAML

func (c *HSLColorField) UnmarshalYAML(node *yaml.Node) error

type HTML added in v0.5.0

type HTML struct {
	Source template.HTML `yaml:"source"`
	// contains filtered or unexported fields
}

func (*HTML) GetType added in v0.5.0

func (w *HTML) GetType() string

func (*HTML) Initialize added in v0.5.0

func (widget *HTML) Initialize() error

func (*HTML) Render added in v0.5.0

func (widget *HTML) Render() template.HTML

func (*HTML) RequiresUpdate added in v0.5.0

func (w *HTML) RequiresUpdate(now *time.Time) bool

func (*HTML) Update added in v0.5.0

func (w *HTML) Update(ctx context.Context)

type HackerNews

type HackerNews struct {
	Posts               feed.ForumPosts `yaml:"-"`
	Limit               int             `yaml:"limit"`
	SortBy              string          `yaml:"sort-by"`
	ExtraSortBy         string          `yaml:"extra-sort-by"`
	CollapseAfter       int             `yaml:"collapse-after"`
	CommentsUrlTemplate string          `yaml:"comments-url-template"`
	ShowThumbnails      bool            `yaml:"-"`
	// contains filtered or unexported fields
}

func (*HackerNews) GetType

func (w *HackerNews) GetType() string

func (*HackerNews) Initialize

func (widget *HackerNews) Initialize() error

func (*HackerNews) Render

func (widget *HackerNews) Render() template.HTML

func (*HackerNews) RequiresUpdate

func (w *HackerNews) RequiresUpdate(now *time.Time) bool

func (*HackerNews) Update

func (widget *HackerNews) Update(ctx context.Context)

type IFrame

type IFrame struct {
	Source string `yaml:"source"`
	Height int    `yaml:"height"`
	// contains filtered or unexported fields
}

func (*IFrame) GetType

func (w *IFrame) GetType() string

func (*IFrame) Initialize

func (widget *IFrame) Initialize() error

func (*IFrame) Render

func (widget *IFrame) Render() template.HTML

func (*IFrame) RequiresUpdate

func (w *IFrame) RequiresUpdate(now *time.Time) bool

func (*IFrame) Update

func (w *IFrame) Update(ctx context.Context)

type Lobsters added in v0.5.0

type Lobsters struct {
	Posts          feed.ForumPosts `yaml:"-"`
	Limit          int             `yaml:"limit"`
	CollapseAfter  int             `yaml:"collapse-after"`
	SortBy         string          `yaml:"sort-by"`
	Tags           []string        `yaml:"tags"`
	ShowThumbnails bool            `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Lobsters) GetType added in v0.5.0

func (w *Lobsters) GetType() string

func (*Lobsters) Initialize added in v0.5.0

func (widget *Lobsters) Initialize() error

func (*Lobsters) Render added in v0.5.0

func (widget *Lobsters) Render() template.HTML

func (*Lobsters) RequiresUpdate added in v0.5.0

func (w *Lobsters) RequiresUpdate(now *time.Time) bool

func (*Lobsters) Update added in v0.5.0

func (widget *Lobsters) Update(ctx context.Context)

type Markets added in v0.5.0

type Markets struct {
	StocksRequests []feed.MarketRequest `yaml:"stocks"`
	MarketRequests []feed.MarketRequest `yaml:"markets"`
	Sort           string               `yaml:"sort-by"`
	Style          string               `yaml:"style"`
	Markets        feed.Markets         `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Markets) GetType added in v0.5.0

func (w *Markets) GetType() string

func (*Markets) Initialize added in v0.5.0

func (widget *Markets) Initialize() error

func (*Markets) Render added in v0.5.0

func (widget *Markets) Render() template.HTML

func (*Markets) RequiresUpdate added in v0.5.0

func (w *Markets) RequiresUpdate(now *time.Time) bool

func (*Markets) Update added in v0.5.0

func (widget *Markets) Update(ctx context.Context)

type Monitor

type Monitor struct {
	Sites []struct {
		*feed.SiteStatusRequest `yaml:",inline"`
		Status                  *feed.SiteStatus `yaml:"-"`
		Title                   string           `yaml:"title"`
		IconUrl                 string           `yaml:"icon"`
		IsSimpleIcon            bool             `yaml:"-"`
		SameTab                 bool             `yaml:"same-tab"`
		StatusText              string           `yaml:"-"`
		StatusStyle             string           `yaml:"-"`
	} `yaml:"sites"`
	Style string `yaml:"style"`
	// contains filtered or unexported fields
}

func (*Monitor) GetType

func (w *Monitor) GetType() string

func (*Monitor) Initialize

func (widget *Monitor) Initialize() error

func (*Monitor) Render

func (widget *Monitor) Render() template.HTML

func (*Monitor) RequiresUpdate

func (w *Monitor) RequiresUpdate(now *time.Time) bool

func (*Monitor) Update

func (widget *Monitor) Update(ctx context.Context)

type OptionalEnvString

type OptionalEnvString string

func (*OptionalEnvString) UnmarshalYAML

func (f *OptionalEnvString) UnmarshalYAML(node *yaml.Node) error

type RSS

type RSS struct {
	FeedRequests    []feed.RSSFeedRequest `yaml:"feeds"`
	Style           string                `yaml:"style"`
	ThumbnailHeight float64               `yaml:"thumbnail-height"`
	CardHeight      float64               `yaml:"card-height"`
	Items           feed.RSSFeedItems     `yaml:"-"`
	Limit           int                   `yaml:"limit"`
	CollapseAfter   int                   `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*RSS) GetType

func (w *RSS) GetType() string

func (*RSS) Initialize

func (widget *RSS) Initialize() error

func (*RSS) Render

func (widget *RSS) Render() template.HTML

func (*RSS) RequiresUpdate

func (w *RSS) RequiresUpdate(now *time.Time) bool

func (*RSS) Update

func (widget *RSS) Update(ctx context.Context)

type Reddit

type Reddit struct {
	Posts               feed.ForumPosts `yaml:"-"`
	Subreddit           string          `yaml:"subreddit"`
	Style               string          `yaml:"style"`
	ShowThumbnails      bool            `yaml:"show-thumbnails"`
	SortBy              string          `yaml:"sort-by"`
	TopPeriod           string          `yaml:"top-period"`
	Search              string          `yaml:"search"`
	ExtraSortBy         string          `yaml:"extra-sort-by"`
	CommentsUrlTemplate string          `yaml:"comments-url-template"`
	Limit               int             `yaml:"limit"`
	CollapseAfter       int             `yaml:"collapse-after"`
	RequestUrlTemplate  string          `yaml:"request-url-template"`
	// contains filtered or unexported fields
}

func (*Reddit) GetType

func (w *Reddit) GetType() string

func (*Reddit) Initialize

func (widget *Reddit) Initialize() error

func (*Reddit) Render

func (widget *Reddit) Render() template.HTML

func (*Reddit) RequiresUpdate

func (w *Reddit) RequiresUpdate(now *time.Time) bool

func (*Reddit) Update

func (widget *Reddit) Update(ctx context.Context)

type Releases

type Releases struct {
	Releases      feed.AppReleases  `yaml:"-"`
	Repositories  []string          `yaml:"repositories"`
	Token         OptionalEnvString `yaml:"token"`
	Limit         int               `yaml:"limit"`
	CollapseAfter int               `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*Releases) GetType

func (w *Releases) GetType() string

func (*Releases) Initialize

func (widget *Releases) Initialize() error

func (*Releases) Render

func (widget *Releases) Render() template.HTML

func (*Releases) RequiresUpdate

func (w *Releases) RequiresUpdate(now *time.Time) bool

func (*Releases) Update

func (widget *Releases) Update(ctx context.Context)

type Repository added in v0.4.0

type Repository struct {
	RequestedRepository string            `yaml:"repository"`
	Token               OptionalEnvString `yaml:"token"`
	PullRequestsLimit   int               `yaml:"pull-requests-limit"`
	IssuesLimit         int               `yaml:"issues-limit"`
	RepositoryDetails   feed.RepositoryDetails
	// contains filtered or unexported fields
}

func (*Repository) GetType added in v0.4.0

func (w *Repository) GetType() string

func (*Repository) Initialize added in v0.4.0

func (widget *Repository) Initialize() error

func (*Repository) Render added in v0.4.0

func (widget *Repository) Render() template.HTML

func (*Repository) RequiresUpdate added in v0.4.0

func (w *Repository) RequiresUpdate(now *time.Time) bool

func (*Repository) Update added in v0.4.0

func (widget *Repository) Update(ctx context.Context)
type Search struct {
	SearchEngine string       `yaml:"search-engine"`
	Bangs        []SearchBang `yaml:"bangs"`
	// contains filtered or unexported fields
}

func (*Search) GetType added in v0.5.0

func (w *Search) GetType() string

func (*Search) Initialize added in v0.5.0

func (widget *Search) Initialize() error

func (*Search) Render added in v0.5.0

func (widget *Search) Render() template.HTML

func (*Search) RequiresUpdate added in v0.5.0

func (w *Search) RequiresUpdate(now *time.Time) bool

func (*Search) Update added in v0.5.0

func (w *Search) Update(ctx context.Context)

type SearchBang added in v0.5.0

type SearchBang struct {
	Title    string
	Shortcut string
	URL      string
}

type TwitchChannels

type TwitchChannels struct {
	ChannelsRequest []string             `yaml:"channels"`
	Channels        []feed.TwitchChannel `yaml:"-"`
	CollapseAfter   int                  `yaml:"collapse-after"`
	SortBy          string               `yaml:"sort-by"`
	// contains filtered or unexported fields
}

func (*TwitchChannels) GetType

func (w *TwitchChannels) GetType() string

func (*TwitchChannels) Initialize

func (widget *TwitchChannels) Initialize() error

func (*TwitchChannels) Render

func (widget *TwitchChannels) Render() template.HTML

func (*TwitchChannels) RequiresUpdate

func (w *TwitchChannels) RequiresUpdate(now *time.Time) bool

func (*TwitchChannels) Update

func (widget *TwitchChannels) Update(ctx context.Context)

type TwitchGames

type TwitchGames struct {
	Categories    []feed.TwitchCategory `yaml:"-"`
	Exclude       []string              `yaml:"exclude"`
	Limit         int                   `yaml:"limit"`
	CollapseAfter int                   `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*TwitchGames) GetType

func (w *TwitchGames) GetType() string

func (*TwitchGames) Initialize

func (widget *TwitchGames) Initialize() error

func (*TwitchGames) Render

func (widget *TwitchGames) Render() template.HTML

func (*TwitchGames) RequiresUpdate

func (w *TwitchGames) RequiresUpdate(now *time.Time) bool

func (*TwitchGames) Update

func (widget *TwitchGames) Update(ctx context.Context)

type Videos

type Videos struct {
	Videos            feed.Videos `yaml:"-"`
	VideoUrlTemplate  string      `yaml:"video-url-template"`
	Style             string      `yaml:"style"`
	CollapseAfterRows int         `yaml:"collapse-after-rows"`
	Channels          []string    `yaml:"channels"`
	Limit             int         `yaml:"limit"`
	// contains filtered or unexported fields
}

func (*Videos) GetType

func (w *Videos) GetType() string

func (*Videos) Initialize

func (widget *Videos) Initialize() error

func (*Videos) Render

func (widget *Videos) Render() template.HTML

func (*Videos) RequiresUpdate

func (w *Videos) RequiresUpdate(now *time.Time) bool

func (*Videos) Update

func (widget *Videos) Update(ctx context.Context)

type Weather

type Weather struct {
	Location     string          `yaml:"location"`
	ShowAreaName bool            `yaml:"show-area-name"`
	HideLocation bool            `yaml:"hide-location"`
	HourFormat   string          `yaml:"hour-format"`
	Units        string          `yaml:"units"`
	Place        *feed.PlaceJson `yaml:"-"`
	Weather      *feed.Weather   `yaml:"-"`
	TimeLabels   [12]string      `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Weather) GetType

func (w *Weather) GetType() string

func (*Weather) Initialize

func (widget *Weather) Initialize() error

func (*Weather) Render

func (widget *Weather) Render() template.HTML

func (*Weather) RequiresUpdate

func (w *Weather) RequiresUpdate(now *time.Time) bool

func (*Weather) Update

func (widget *Weather) Update(ctx context.Context)

type Widget

type Widget interface {
	Initialize() error
	RequiresUpdate(*time.Time) bool
	Update(context.Context)
	Render() template.HTML
	GetType() string
}

func New

func New(widgetType string) (Widget, error)

type Widgets

type Widgets []Widget

func (*Widgets) UnmarshalYAML

func (w *Widgets) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL