Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterCSSFile(path string)
- func SetThemeCookie(w http.ResponseWriter, theme Theme)
- func SetWeakCookie(w http.ResponseWriter, k, v string)
- func ThemeM(next http.Handler) http.Handler
- type CommonCtx
- type Component
- type Config
- type ErrorRenderer
- type Mux
- func (m *Mux) Delete(route string, r Renderer)
- func (m *Mux) Get(route string, r Renderer)
- func (m *Mux) M(render Renderer) http.HandlerFunc
- func (m *Mux) Mount(route string, mounter func(Muxer) http.Handler)
- func (m *Mux) NewRequest(w http.ResponseWriter, r *http.Request) *Request
- func (m *Mux) Post(route string, r Renderer)
- func (m *Mux) SetErrorRenderer(r ErrorRenderer)
- type Muxer
- type Page
- type Render
- type Renderer
- type Request
- func (r *Request) Cookie(name string) *http.Cookie
- func (r *Request) CookieValue(name string) string
- func (r *Request) FlushCookies()
- func (r *Request) IDParam() (int64, error)
- func (r *Request) Me() (smolboard.UserPart, error)
- func (r *Request) Param(name string) string
- func (r *Request) Push(url string)
- func (r *Request) Redirect(path string, code int)
- func (r *Request) SetWeakCookie(k, v string)
- func (r *Request) TokenCookie() *http.Cookie
- type Template
- type Theme
Constants ¶
const DefaultTheme = LightTheme
Variables ¶
var Empty = Render{}
Empty is a blank page.
Functions ¶
func RegisterCSSFile ¶
func RegisterCSSFile(path string)
RegisterCSSFile adds the CSS file to the global CSS file, which can be located in /components.css
func SetThemeCookie ¶
func SetThemeCookie(w http.ResponseWriter, theme Theme)
func SetWeakCookie ¶
func SetWeakCookie(w http.ResponseWriter, k, v string)
SetWeakCookie sets an insecure cookie for user settings.
Types ¶
type ErrorRenderer ¶
ErrorRenderer represents a renderable page for errors.
type Mux ¶
func NewHTTPMux ¶
NewHTTPMux creates a new frontend muxer with the given backendHTTP endpoint. This endpoint will be used to make HTTP requests to the server.
func NewMux ¶
NewMux creates a new frontend muxer with the given backendSocket as the Unix socket path to call the backend.
func (*Mux) NewRequest ¶
NewRequest makes a new internal request struct. The returned Request pointer is never nil.
func (*Mux) SetErrorRenderer ¶
func (m *Mux) SetErrorRenderer(r ErrorRenderer)
type Muxer ¶
type Muxer interface {
M(Renderer) http.HandlerFunc
}
Muxer implements the interface that's passable to pages' mount functions.
type Request ¶
type Request struct { CommonCtx Writer http.ResponseWriter // contains filtered or unexported fields }
func (*Request) Cookie ¶
Cookie returns the cookie from the Request. These cookies won't have anything else filled other than the value field.
func (*Request) CookieValue ¶
func (*Request) FlushCookies ¶
func (r *Request) FlushCookies()
FlushCookies dumps all the session state's cookies to the response writer.
func (*Request) SetWeakCookie ¶
SetWeakCookie calls SetWeakCookie with the writer in Request.
func (*Request) TokenCookie ¶
TokenCookie returns the cookie that contains the token if any or nil if none. This function searches the cookie from the smolboard client.