server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LayoutTemplateFiles = []string{
	"_layout/layout.html",
	"_layout/header.html",
	"_layout/footer.html",
}

Functions

func BuildPageHeader

func BuildPageHeader() (string, error)

func CompileTimeCheck

func CompileTimeCheck(fsys fs.FS) error

func FormatTimeDiff

func FormatTimeDiff(ts time.Time) template.HTML

func GetTemplate

func GetTemplate(files ...string) *template.Template

func GetTemplateFuncs

func GetTemplateFuncs() template.FuncMap

GetTemplateFuncs will get the template functions

func GetTemplateNames

func GetTemplateNames() []string

func HandleNotFound

func HandleNotFound(w http.ResponseWriter, r *http.Request)

func HandlePageError

func HandlePageError(w http.ResponseWriter, r *http.Request, pageError error)

func HandleTemplateError

func HandleTemplateError(w http.ResponseWriter, r *http.Request, fileIdentifier string, functionIdentifier string, infoIdentifier string, err error) error

used to handle errors constructed by Template.ExecuteTemplate correctly

func IncludeHTML

func IncludeHTML(path string) template.HTML

func JSONMarshal

func JSONMarshal(v interface{}) template.JS

JSONMarshal converts a Go value to JSON for use in templates

Types

type ErrorPageData

type ErrorPageData struct {
	CallTime   time.Time
	CallUrl    string
	ErrorMsg   string
	StackTrace string
	Version    string
}

type Frontend

type Frontend struct {
	NotFoundHandler func(http.ResponseWriter, *http.Request)
	// contains filtered or unexported fields
}

func NewFrontend

func NewFrontend(config *types.FrontendConfig, logger logrus.FieldLogger, staticEmbedFS embed.FS, templateEmbedFS embed.FS) (*Frontend, error)

func (*Frontend) ServeHTTP

func (frontend *Frontend) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Meta

type Meta struct {
	Title       string
	Description string
	Domain      string
	Path        string
	Tlabel1     string
	Tdata1      string
	Tlabel2     string
	Tdata2      string
	Templates   string
}

type PageData

type PageData struct {
	Active           string
	Meta             *Meta
	Data             interface{}
	Version          string
	BuildTime        string
	Year             int
	Title            string
	Lang             string
	Debug            bool
	DebugTemplates   []string
	DisableTxMetrics bool
	DisableAuditLogs bool
	HasEL            bool // Whether EL bootnode is active
	HasCL            bool // Whether CL bootnode is active
}

func InitPageData

func InitPageData(r *http.Request, active, path, title string, mainTemplates []string) *PageData

func (*PageData) SetBootnodeStatus added in v0.0.2

func (p *PageData) SetBootnodeStatus(hasEL, hasCL bool)

SetBootnodeStatus sets the HasEL and HasCL flags based on bootnode table availability. This should be called by handlers that have access to the bootnode service.

Jump to

Keyboard shortcuts

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