view

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Entry

func Entry(w io.Writer, p EntryParams) error

func Feed

func Feed(w io.Writer, p FeedParams) error

func Home

func Home(w io.Writer, vm []HomeParams) error

func Login

func Login(w io.Writer, p LoginParams) error

func Render

func Render(w http.ResponseWriter, render func(io.Writer) error)

Render safely writes HTML to the ResponseWriter. It first renders the template/content into a buffer so that: 1) We avoid sending partial responses if rendering fails midway. 2) We can choose the correct HTTP status code on errors before any bytes are written. Only after a successful render do we set the Content-Type and write the body.

func StaticFiles

func StaticFiles() embed.FS

Types

type EntryLinkViewModel

type EntryLinkViewModel struct {
	Title    string
	Href     string
	TypeLink string
	Subtext  string
}

EntryLinkViewModel is a single link in the entry.html template.

type EntryParams

type EntryParams struct {
	URL              string
	Feed             *opds.Feed
	Entry            opds.Entry
	DeviceType       device.DeviceType
	ConverterManager *convert.ConverterManager
}

type EntryViewModel

type EntryViewModel struct {
	Title           string
	Author          string
	Content         template.HTML
	DownloadLinks   []EntryLinkViewModel
	NavigationLinks []EntryLinkViewModel
	FeedURL         string
	ImageURL        string
	ImageData       template.URL
	Search          string
	Navigation      []NavigationViewModel
}

EntryViewModel is the data passed to the entry.html template.

type FeedParams

type FeedParams struct {
	URL  string
	Feed *opds.Feed
}

type FeedViewModel

type FeedViewModel struct {
	Title      string
	Search     string
	Navigation []NavigationViewModel
	Links      []LinkViewModel
}

type HomeParams

type HomeParams struct {
	Title string
	URL   string
}

type LinkViewModel

type LinkViewModel struct {
	Title     string
	Author    string
	ImageURL  string
	ImageData template.URL // Base64 encoded image data
	Content   string
	Href      string
	EntryID   string
}

type LoginParams

type LoginParams struct {
	ReturnURL string
}
type NavigationData struct {
	Search     string
	Navigation []NavigationViewModel
}

NavigationData contains the common navigation and search data

type NavigationViewModel struct {
	Href  string
	Label string
}

Jump to

Keyboard shortcuts

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