Documentation ¶
Overview ¶
Package assets provides the web assets.
Index ¶
- Constants
- Variables
- func ExecuteToBuffer(tmpl *template.Template, args any) ([]byte, error)
- type LangPack
- type Store
- func (st *Store) DefaultName(lang language.Tag) string
- func (st *Store) RequestToLang(r *http.Request) language.Tag
- func (st *Store) ServeAlert(w http.ResponseWriter, entry *api.Superchat, lang language.Tag)
- func (st *Store) ServeCheck(w http.ResponseWriter, receipt *api.Receipt, lang language.Tag)
- func (st *Store) ServeError(w http.ResponseWriter, statusCode int, reason api.ErrorReason, ...)
- func (st *Store) ServeIndexCaptcha(w http.ResponseWriter, captchaID string, lang language.Tag)
- func (st *Store) ServePay(w http.ResponseWriter, pendingPayment *api.PendingPayment, lang language.Tag)
- func (st *Store) ServeView(w http.ResponseWriter, entries []api.Superchat, refreshInterval uint, ...)
- func (st *Store) StaticContent(key string, lang language.Tag) ([]byte, error)
- func (st *Store) StaticContentHandler(fn string) http.HandlerFunc
Constants ¶
const ( BaseStyleFile = "style.css" ViewStyleFile = "view.css" IconFile = "xmr.svg" LogoFile = "logo.png" IndexFile = "index.html" )
Variables ¶
var ( StaticAssets = []string{ BaseStyleFile, ViewStyleFile, IconFile, LogoFile, } )
Functions ¶
Types ¶
type LangPack ¶
type LangPack struct {
// contains filtered or unexported fields
}
LangPack is a set of localzed data.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a collection of assets.
func (*Store) DefaultName ¶
DefaultName returns the default name corresponding to the locale.
func (*Store) RequestToLang ¶
RequestToLang attempts to determine the suitable language for a given http request.
func (*Store) ServeAlert ¶
ServeAlert serves an alertTemplate, parameterized by `(entry, lang)`.
func (*Store) ServeCheck ¶
ServeCheck serves a checkTemplate, parametereized by `(receipt, lang)`.
func (*Store) ServeError ¶
func (st *Store) ServeError(w http.ResponseWriter, statusCode int, reason api.ErrorReason, lang language.Tag)
ServeError serves an error parameterized by `(statusCode, reason, lang)` as a HTTP response to the writer `w`.
func (*Store) ServeIndexCaptcha ¶
ServeIndexCaptcha serves an indexTemplate, parameterized by `(captchaID, lang)`.
func (*Store) ServePay ¶
func (st *Store) ServePay(w http.ResponseWriter, pendingPayment *api.PendingPayment, lang language.Tag)
ServePay serves a payTemplate, parameterized by `(pendingPayment, lang)`.
func (*Store) ServeView ¶
func (st *Store) ServeView(w http.ResponseWriter, entries []api.Superchat, refreshInterval uint, lang language.Tag)
ServeView serves a viewTemplate, parameterized by `(entries, refreshInterval, lang)`.
func (*Store) StaticContent ¶
StaticContent returns the localized static content identified by `key`.
func (*Store) StaticContentHandler ¶
func (st *Store) StaticContentHandler(fn string) http.HandlerFunc
StaticContentHandler returns a http.Handler backed by static content.