Documentation ¶
Index ¶
- Variables
- func CreateLogger() *zap.SugaredLogger
- 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 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) ReadURL() string
- func (c *ConfigSite) RssBlogURL(username string) string
- type DbHandler
- type HeaderTxt
- type Opener
- type PageData
- type PostItemData
- type PostPageData
- type ReadPageData
- type ReadmeTxt
- type Route
- type ServeFn
- type SitePageData
- type TransparencyPageData
Constants ¶
This section is empty.
Variables ¶
View Source
var HiddenPosts = []string{"_readme", "_header"}
Functions ¶
func CreateLogger ¶
func CreateLogger() *zap.SugaredLogger
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 Readme *ReadmeTxt 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) 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 ReadPageData ¶
type ReadPageData struct { Site SitePageData NextPage string PrevPage string Posts []PostItemData }
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 }
Click to show internal directories.
Click to hide internal directories.