Documentation ¶
Index ¶
- func CreateLogger() *zap.SugaredLogger
- func CronDeleteExpiredPosts(cfg *ConfigSite, dbpool db.DB)
- func FilenameToTitle(filename string, title string) string
- func GetBlogName(username 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 GetPostTitle(post *db.Post) string
- func GetSubdomain(r *http.Request) string
- func GetUsernameFromRequest(r *http.Request) string
- func IsText(s string) bool
- func IsTextFile(text string, filename string) bool
- func KeyText(s ssh.Session) (string, error)
- func ParseText(filename string, text string) (string, error)
- func SanitizeFileExt(fname string) string
- func StartApiServer()
- func TimeAgo(t *time.Time) string
- type BlogPageData
- type ConfigSite
- func (c *ConfigSite) BlogURL(username string) string
- func (c *ConfigSite) GetSiteData() *SitePageData
- func (c *ConfigSite) HomeURL() string
- func (c *ConfigSite) IsSubdomains() bool
- func (c *ConfigSite) PostURL(username, filename string) string
- func (c *ConfigSite) RawPostURL(username, filename string) string
- func (c *ConfigSite) ReadURL() string
- func (c *ConfigSite) RssBlogURL(username string) string
- type DbHandler
- type HeaderTxt
- type Link
- type Opener
- type PageData
- type PostItemData
- type PostPageData
- type Route
- type ServeFn
- type SitePageData
- type TransparencyPageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLogger ¶
func CreateLogger() *zap.SugaredLogger
func CronDeleteExpiredPosts ¶
func CronDeleteExpiredPosts(cfg *ConfigSite, dbpool db.DB)
func FilenameToTitle ¶
func GetBlogName ¶
func GetPostTitle ¶
func GetSubdomain ¶
func GetUsernameFromRequest ¶
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 SanitizeFileExt ¶
func StartApiServer ¶
func StartApiServer()
Types ¶
type BlogPageData ¶
type BlogPageData struct { Site SitePageData PageTitle string URL template.URL RSSURL template.URL Username string Header *HeaderTxt Posts []PostItemData }
type ConfigSite ¶
func GetCfg ¶
func GetCfg(r *http.Request) *ConfigSite
func NewConfigSite ¶
func NewConfigSite() *ConfigSite
func (*ConfigSite) BlogURL ¶
func (c *ConfigSite) BlogURL(username string) string
func (*ConfigSite) GetSiteData ¶
func (c *ConfigSite) GetSiteData() *SitePageData
func (*ConfigSite) HomeURL ¶
func (c *ConfigSite) HomeURL() string
func (*ConfigSite) IsSubdomains ¶
func (c *ConfigSite) IsSubdomains() bool
func (*ConfigSite) PostURL ¶
func (c *ConfigSite) PostURL(username, filename string) string
func (*ConfigSite) RawPostURL ¶
func (c *ConfigSite) RawPostURL(username, filename string) string
func (*ConfigSite) ReadURL ¶
func (c *ConfigSite) ReadURL() string
func (*ConfigSite) RssBlogURL ¶
func (c *ConfigSite) RssBlogURL(username string) string
type DbHandler ¶
type DbHandler struct { User *db.User DBPool db.DB Cfg *ConfigSite }
func NewDbHandler ¶
func NewDbHandler(dbpool db.DB, cfg *ConfigSite) *DbHandler
type PageData ¶
type PageData struct {
Site SitePageData
}
type PostItemData ¶
type PostPageData ¶
type ServeFn ¶
type ServeFn func(http.ResponseWriter, *http.Request)
func CreateServe ¶
func CreateServe(routes []Route, subdomainRoutes []Route, cfg *ConfigSite, dbpool db.DB, logger *zap.SugaredLogger) ServeFn
type SitePageData ¶
type TransparencyPageData ¶
type TransparencyPageData struct { Site SitePageData Analytics *db.Analytics }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.