Documentation ¶
Index ¶
- Variables
- func BytesToGB(size int) float32
- func CheckHandler(w http.ResponseWriter, r *http.Request)
- func CreateLogger(debug bool) *zap.SugaredLogger
- func CreatePageHandler(fname string) http.HandlerFunc
- func FilenameToTitle(filename string, title string) string
- func GetAssetBucketName(userID string) string
- func GetAssetFileName(entry *utils.FileEntry) string
- func GetCache(r *http.Request) *cache.Cache
- func GetCustomDomain(logger *zap.SugaredLogger, 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 GetImgsBucketName(userID string) string
- func GetLogger(r *http.Request) *zap.SugaredLogger
- func GetProjectName(entry *utils.FileEntry) string
- 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 IsValidSubdomain(subd string) bool
- func KeyAsValue(token *SplitToken) string
- func KeyText(s ssh.Session) (string, error)
- func PublishAtDate(date string) (*time.Time, error)
- 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 SplitByNewline(text string) []string
- func TimeAgo(t *time.Time) string
- func ToUpper(str string) string
- func TokenToMetaField(meta *ListMetaData, token *SplitToken) error
- type AllReaderAt
- type ConfigSite
- func (c *ConfigSite) AssetURL(username, projectName, fpath string) string
- 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 Link
- type ListItem
- type ListMetaData
- type ListParsedText
- type MetaData
- type PageData
- type ParsedText
- type Route
- type ServeFn
- type SitePageData
- type SplitToken
Constants ¶
This section is empty.
Variables ¶
View Source
var DigestIntervalOpts = []string{
"10min",
"1hour",
"6hour",
"12hour",
"1day",
"7day",
"30day",
}
View Source
var FuncMap = template.FuncMap{
"minus": minus,
"intRange": intRange,
}
View Source
var GB = MB * 1024
View Source
var KB = 1024
View Source
var MB = KB * 1024
Functions ¶
func CheckHandler ¶
func CheckHandler(w http.ResponseWriter, r *http.Request)
func CreateLogger ¶
func CreateLogger(debug bool) *zap.SugaredLogger
func CreatePageHandler ¶
func CreatePageHandler(fname string) http.HandlerFunc
func FilenameToTitle ¶
func GetAssetBucketName ¶ added in v1.2.0
func GetAssetFileName ¶ added in v1.2.0
func GetCustomDomain ¶
func GetCustomDomain(logger *zap.SugaredLogger, host string, space string) string
func GetImgsBucketName ¶ added in v1.10.0
func GetProjectName ¶ added in v1.2.0
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 IsValidSubdomain ¶ added in v1.2.0
func KeyAsValue ¶ added in v1.1.0
func KeyAsValue(token *SplitToken) string
func RenderTemplate ¶
func RenderTemplate(cfg *ConfigSite, templates []string) (*template.Template, error)
func SanitizeFileExt ¶
func SplitByNewline ¶ added in v1.1.0
func TokenToMetaField ¶ added in v1.1.0
func TokenToMetaField(meta *ListMetaData, token *SplitToken) error
Types ¶
type AllReaderAt ¶ added in v1.8.0
type AllReaderAt struct {
Reader utils.ReaderAtCloser
}
func NewAllReaderAt ¶ added in v1.8.0
func NewAllReaderAt(reader utils.ReaderAtCloser) *AllReaderAt
func (*AllReaderAt) Close ¶ added in v1.8.0
func (a *AllReaderAt) Close() error
type ConfigSite ¶
type ConfigSite struct { config.ConfigCms config.ConfigURL Debug bool SubdomainsEnabled bool CustomdomainsEnabled bool SendgridKey string UseImgProxy bool }
func GetCfg ¶
func GetCfg(r *http.Request) *ConfigSite
func (*ConfigSite) AssetURL ¶ added in v1.2.0
func (c *ConfigSite) AssetURL(username, projectName, fpath string) string
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 ListMetaData ¶ added in v1.1.0
type ListMetaData struct { PublishAt *time.Time Title string Description string Layout string Tags []string ListType string // https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type DigestInterval string Email string InlineContent bool // allows content inlining to be disabled in feeds.sh emails }
type ListParsedText ¶ added in v1.1.0
type ListParsedText struct { Items []*ListItem *ListMetaData }
func ListParseText ¶ added in v1.1.0
func ListParseText(text string) *ListParsedText
type PageData ¶
type PageData struct {
Site SitePageData
}
type ParsedText ¶
func ParseText ¶
func ParseText(text string) (*ParsedText, error)
type Route ¶
type Route struct { Method string Regex *regexp.Regexp Handler http.HandlerFunc }
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, cache *cache.Cache) ServeFn
type SitePageData ¶
type SplitToken ¶ added in v1.1.0
func TextToSplitToken ¶ added in v1.1.0
func TextToSplitToken(text string) *SplitToken
Source Files ¶
Click to show internal directories.
Click to hide internal directories.