homepage

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIconURL = gperr.New("invalid icon url")
View Source
var PredefinedCategories = map[string]string{
	"sonarr":       "Torrenting",
	"radarr":       "Torrenting",
	"bazarr":       "Torrenting",
	"lidarr":       "Torrenting",
	"readarr":      "Torrenting",
	"prowlarr":     "Torrenting",
	"watcharr":     "Torrenting",
	"qbittorrent":  "Torrenting",
	"qbit":         "Torrenting",
	"qbt":          "Torrenting",
	"transmission": "Torrenting",

	"jellyfin":   "Media",
	"jellyseerr": "Media",
	"emby":       "Media",
	"plex":       "Media",
	"navidrome":  "Media",
	"immich":     "Media",
	"tautulli":   "Media",
	"nextcloud":  "Media",
	"invidious":  "Media",

	"uptime":             "Monitoring",
	"uptime-kuma":        "Monitoring",
	"prometheus":         "Monitoring",
	"grafana":            "Monitoring",
	"netdata":            "Monitoring",
	"changedetection.io": "Monitoring",
	"changedetection":    "Monitoring",
	"influxdb":           "Monitoring",
	"influx":             "Monitoring",

	"adguardhome":  "Networking",
	"adgh":         "Networking",
	"adg":          "Networking",
	"pihole":       "Networking",
	"flaresolverr": "Networking",

	"homebridge":     "Home Automation",
	"home-assistant": "Home Automation",

	"dockge":       "Container Management",
	"portainer-ce": "Container Management",
	"portainer-be": "Container Management",
	"logs":         "Container Management",
	"dozzle":       "Container Management",

	"rss":        "RSS",
	"rsshub":     "RSS",
	"rss-bridge": "RSS",
	"miniflux":   "RSS",
	"freshrss":   "RSS",

	"paperless":     "Documents",
	"paperless-ngx": "Documents",
	"s-pdf":         "Documents",
	"stirling-pdf":  "Documents",

	"minio":       "Storage",
	"filebrowser": "Storage",
	"rclone":      "Storage",
}

PredefinedCategories by alias or docker image name.

Functions

func GetDisplayName added in v0.11.0

func GetDisplayName(reference string) (string, bool)

func HasSelfhstIcon added in v0.11.0

func HasSelfhstIcon(name string, filetype string) bool

func HasWalkxCodeIcon added in v0.11.0

func HasWalkxCodeIcon(name string, filetype string) bool

func InitIconCache added in v0.11.0

func InitIconCache()

func InitIconListCache added in v0.11.0

func InitIconListCache()

func PruneRouteIconCache added in v0.11.0

func PruneRouteIconCache(route route)

func SearchIcons added in v0.11.0

func SearchIcons(keyword string, limit int) ([]string, error)

Types

type Cache added in v0.11.0

type Cache struct {
	WalkxCode, Selfhst IconsMap
	DisplayNames       ReferenceDisplayNameMap
	IconList           IconList // combined into a single list
}

func ListAvailableIcons added in v0.11.0

func ListAvailableIcons() (*Cache, error)

type Category

type Category []*Item

type FetchResult added in v0.11.0

type FetchResult struct {
	Icon       []byte
	StatusCode int
	ErrMsg     string
	// contains filtered or unexported fields
}

func FetchFavIconFromURL added in v0.11.0

func FetchFavIconFromURL(ctx context.Context, iconURL *IconURL) *FetchResult

func FindIcon added in v0.11.0

func FindIcon(ctx context.Context, r route, uri string) *FetchResult

func (*FetchResult) ContentType added in v0.11.0

func (res *FetchResult) ContentType() string

func (*FetchResult) OK added in v0.11.0

func (res *FetchResult) OK() bool

type GitHubContents added in v0.11.0

type GitHubContents struct {
	Type string `json:"type"`
	Path string `json:"path"`
	Name string `json:"name"`
	Sha  string `json:"sha"`
	Size int    `json:"size"`
}

type Homepage added in v0.10.0

type Homepage map[string]Category

func (Homepage) Add added in v0.10.0

func (c Homepage) Add(item *Item)

type IconExtra

type IconExtra struct {
	FileType string `json:"file_type"`
	Name     string `json:"name"`
}

type IconList added in v0.11.0

type IconList []string

type IconSource

type IconSource int
const (
	IconSourceAbsolute IconSource = iota
	IconSourceRelative
	IconSourceWalkXCode
	IconSourceSelfhSt
)

type IconURL

type IconURL struct {
	Value      string `json:"value"`
	FullValue  string `json:"full_value"`
	IconSource `json:"source"`
	Extra      *IconExtra `json:"extra"`
}

func NewSelfhStIconURL

func NewSelfhStIconURL(reference, format string) *IconURL

func NewWalkXCodeIconURL

func NewWalkXCodeIconURL(name, format string) *IconURL

func (*IconURL) HasIcon

func (u *IconURL) HasIcon() bool

HasIcon checks if the icon referenced by the IconURL exists in the cache based on its source. Returns false if the icon does not exist for IconSourceSelfhSt or IconSourceWalkXCode, otherwise returns true.

func (*IconURL) MarshalText

func (u *IconURL) MarshalText() ([]byte, error)

func (*IconURL) Parse

func (u *IconURL) Parse(v string) error

Parse implements strutils.Parser.

func (*IconURL) String

func (u *IconURL) String() string

func (*IconURL) URL

func (u *IconURL) URL() string

func (*IconURL) UnmarshalText

func (u *IconURL) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type IconsMap added in v0.11.0

type IconsMap map[string]map[string]struct{}

type Item

type Item struct {
	*ItemConfig

	Alias    string
	Provider string
}

func (*Item) MarshalJSON added in v0.10.0

func (item *Item) MarshalJSON() ([]byte, error)

type ItemConfig

type ItemConfig struct {
	Show         bool           `json:"show"`
	Name         string         `json:"name"` // display name
	Icon         *IconURL       `json:"icon"`
	Category     string         `json:"category"`
	Description  string         `json:"description" aliases:"desc"`
	SortOrder    int            `json:"sort_order"`
	WidgetConfig map[string]any `json:"widget_config" aliases:"widget"`
}

func (*ItemConfig) GetOverride added in v0.10.0

func (cfg *ItemConfig) GetOverride(alias string) *ItemConfig

type OverrideConfig

type OverrideConfig struct {
	ItemOverrides  map[string]*ItemConfig `json:"item_overrides"`
	DisplayOrder   map[string]int         `json:"display_order"`  // TODO: implement this
	CategoryOrder  map[string]int         `json:"category_order"` // TODO: implement this
	ItemVisibility map[string]bool        `json:"item_visibility"`
	// contains filtered or unexported fields
}

func GetOverrideConfig

func GetOverrideConfig() *OverrideConfig

func (*OverrideConfig) GetOverride

func (c *OverrideConfig) GetOverride(alias string, item *ItemConfig) *ItemConfig

func (*OverrideConfig) HideItems

func (c *OverrideConfig) HideItems(keys []string)

func (*OverrideConfig) Initialize added in v0.11.0

func (c *OverrideConfig) Initialize()

func (*OverrideConfig) OverrideItem

func (c *OverrideConfig) OverrideItem(alias string, override *ItemConfig)

func (*OverrideConfig) OverrideItems

func (c *OverrideConfig) OverrideItems(items map[string]*ItemConfig)

func (*OverrideConfig) SetCategoryOrder

func (c *OverrideConfig) SetCategoryOrder(key string, value int)

func (*OverrideConfig) UnhideItems

func (c *OverrideConfig) UnhideItems(keys []string)

type ReferenceDisplayNameMap added in v0.11.0

type ReferenceDisplayNameMap map[string]string

Jump to

Keyboard shortcuts

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