Documentation ¶
Index ¶
- Variables
- func CheckHandler(w http.ResponseWriter, r *http.Request)
- func CreateImgURL(linkify Linkify) func([]byte) []byte
- func CreateLogger() *zap.SugaredLogger
- func CreatePageHandler(fname string) http.HandlerFunc
- func FilenameToTitle(filename string, title string) string
- func GetCustomDomain(host string, space string) string
- func GetDB(r *http.Request) db.DB
- func GetEnv(key string, defaultVal string) string
- func GetField(r *http.Request, index int) string
- func GetLogger(r *http.Request) *zap.SugaredLogger
- func GetStorage(r *http.Request) storage.ObjectStorage
- func GetSubdomain(r *http.Request) string
- func GetUsernameFromRequest(r *http.Request) string
- func HtmlPolicy() *bluemonday.Policy
- func IsExtAllowed(filename string, allowedExt []string) bool
- func IsText(s string) bool
- func IsTextFile(text string) bool
- func KeyText(s ssh.Session) (string, error)
- func NewImgsRenderer(url func([]byte) []byte) renderer.NodeRenderer
- func RenderTemplate(cfg *ConfigSite, templates []string) (*template.Template, error)
- func SanitizeFileExt(fname string) string
- func ServeFile(file string, contentType string) http.HandlerFunc
- func Shasum(data []byte) string
- func TimeAgo(t *time.Time) string
- func ToUpper(str string) string
- type ConfigSite
- func (c *ConfigSite) BlogURL(username string) string
- func (c *ConfigSite) CssURL(username string) string
- func (c *ConfigSite) FullBlogURL(curl *CreateURL, username string) string
- func (c *ConfigSite) FullPostURL(curl *CreateURL, username, slug string) string
- func (c *ConfigSite) GetSiteData() *SitePageData
- func (c *ConfigSite) HomeURL() string
- func (c *ConfigSite) ImgFullURL(username, slug string) string
- func (c *ConfigSite) ImgOrigURL(curl *CreateURL, username string, slug string) string
- func (c *ConfigSite) ImgPostURL(curl *CreateURL, username string, slug string) string
- func (c *ConfigSite) ImgURL(curl *CreateURL, username string, slug string) string
- func (c *ConfigSite) IsCustomdomains() bool
- func (c *ConfigSite) IsSubdomains() bool
- func (c *ConfigSite) PostURL(username, slug string) string
- func (c *ConfigSite) RawPostURL(username, slug string) string
- func (c *ConfigSite) ReadURL() string
- func (c *ConfigSite) RssBlogURL(curl *CreateURL, username, tag string) string
- func (c *ConfigSite) StaticPath(fname string) string
- func (c *ConfigSite) TagURL(curl *CreateURL, username, tag string) string
- type CreateURL
- type ImgOptimizer
- func (h *ImgOptimizer) DecodeWebp(r io.Reader) (image.Image, error)
- func (h *ImgOptimizer) EncodeWebp(writer io.Writer, img image.Image) error
- func (h *ImgOptimizer) GetImage(r io.Reader, mimeType string) (image.Image, error)
- func (h *ImgOptimizer) Process(writer io.Writer, contents io.Reader) error
- type ImgRender
- type Link
- type Linkify
- type MetaData
- type PageData
- type ParsedText
- type Ratio
- type Route
- type ServeFn
- type SitePageData
Constants ¶
This section is empty.
Variables ¶
View Source
var FuncMap = template.FuncMap{
"minus": minus,
"intRange": intRange,
}
Functions ¶
func CheckHandler ¶
func CheckHandler(w http.ResponseWriter, r *http.Request)
func CreateImgURL ¶
func CreateLogger ¶
func CreateLogger() *zap.SugaredLogger
func CreatePageHandler ¶
func CreatePageHandler(fname string) http.HandlerFunc
func FilenameToTitle ¶
func GetCustomDomain ¶
func GetStorage ¶
func GetStorage(r *http.Request) storage.ObjectStorage
func GetSubdomain ¶
func GetUsernameFromRequest ¶
func HtmlPolicy ¶
func HtmlPolicy() *bluemonday.Policy
func IsExtAllowed ¶
func IsText ¶
IsText reports whether a significant prefix of s looks like correct UTF-8; that is, if it is likely that s is human-readable text.
func IsTextFile ¶
IsTextFile reports whether the file has a known extension indicating a text file, or if a significant chunk of the specified file looks like correct UTF-8; that is, if it is likely that the file contains human- readable text.
func NewImgsRenderer ¶
func NewImgsRenderer(url func([]byte) []byte) renderer.NodeRenderer
func RenderTemplate ¶
func RenderTemplate(cfg *ConfigSite, templates []string) (*template.Template, error)
func SanitizeFileExt ¶
Types ¶
type ConfigSite ¶
type ConfigSite struct { config.ConfigCms config.ConfigURL Debug bool SubdomainsEnabled bool CustomdomainsEnabled bool }
func GetCfg ¶
func GetCfg(r *http.Request) *ConfigSite
func (*ConfigSite) BlogURL ¶
func (c *ConfigSite) BlogURL(username string) string
func (*ConfigSite) CssURL ¶
func (c *ConfigSite) CssURL(username string) string
func (*ConfigSite) FullBlogURL ¶
func (c *ConfigSite) FullBlogURL(curl *CreateURL, username string) string
func (*ConfigSite) FullPostURL ¶
func (c *ConfigSite) FullPostURL(curl *CreateURL, username, slug string) string
func (*ConfigSite) GetSiteData ¶
func (c *ConfigSite) GetSiteData() *SitePageData
func (*ConfigSite) HomeURL ¶
func (c *ConfigSite) HomeURL() string
func (*ConfigSite) ImgFullURL ¶
func (c *ConfigSite) ImgFullURL(username, slug string) string
func (*ConfigSite) ImgOrigURL ¶
func (c *ConfigSite) ImgOrigURL(curl *CreateURL, username string, slug string) string
func (*ConfigSite) ImgPostURL ¶
func (c *ConfigSite) ImgPostURL(curl *CreateURL, username string, slug string) string
func (*ConfigSite) ImgURL ¶
func (c *ConfigSite) ImgURL(curl *CreateURL, username string, slug string) string
func (*ConfigSite) IsCustomdomains ¶
func (c *ConfigSite) IsCustomdomains() bool
func (*ConfigSite) IsSubdomains ¶
func (c *ConfigSite) IsSubdomains() bool
func (*ConfigSite) PostURL ¶
func (c *ConfigSite) PostURL(username, slug string) string
func (*ConfigSite) RawPostURL ¶
func (c *ConfigSite) RawPostURL(username, slug string) string
func (*ConfigSite) ReadURL ¶
func (c *ConfigSite) ReadURL() string
func (*ConfigSite) RssBlogURL ¶
func (c *ConfigSite) RssBlogURL(curl *CreateURL, username, tag string) string
func (*ConfigSite) StaticPath ¶
func (c *ConfigSite) StaticPath(fname string) string
type CreateURL ¶
type CreateURL struct { Subdomain bool UsernameInRoute bool HostDomain string AppDomain string Username string Cfg *ConfigSite }
func CreateURLFromRequest ¶
func CreateURLFromRequest(cfg *ConfigSite, r *http.Request) *CreateURL
func NewCreateURL ¶
func NewCreateURL(cfg *ConfigSite) *CreateURL
type ImgOptimizer ¶
type ImgOptimizer struct { // Specify the compression factor for RGB channels between 0 and 100. The default is 75. // A small factor produces a smaller file with lower quality. // Best quality is achieved by using a value of 100. Quality float32 *Ratio DeviceType deviceType Lossless bool }
func NewImgOptimizer ¶
func NewImgOptimizer(logger *zap.SugaredLogger, dimes string) *ImgOptimizer
func (*ImgOptimizer) DecodeWebp ¶
func (*ImgOptimizer) EncodeWebp ¶
type ImgRender ¶
func (*ImgRender) RegisterFuncs ¶
func (r *ImgRender) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
type PageData ¶
type PageData struct {
Site SitePageData
}
type ParsedText ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func CreatePProfRoutes ¶
type ServeFn ¶
type ServeFn func(http.ResponseWriter, *http.Request)
func CreateServe ¶
func CreateServe(routes []Route, subdomainRoutes []Route, cfg *ConfigSite, dbpool db.DB, st storage.ObjectStorage, logger *zap.SugaredLogger) ServeFn
Click to show internal directories.
Click to hide internal directories.