internal

package
v0.0.0-...-c3fd5e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger() *zap.SugaredLogger

func FilenameToTitle

func FilenameToTitle(filename string, title string) string

func GetBlogName

func GetBlogName(username string) string

func GetDB

func GetDB(r *http.Request) db.DB

func GetEnv

func GetEnv(key string, defaultVal string) string

func GetField

func GetField(r *http.Request, index int) string

func GetLogger

func GetLogger(r *http.Request) *zap.SugaredLogger

func GetPostTitle

func GetPostTitle(post *db.Post) string

func GetSubdomain

func GetSubdomain(r *http.Request) string

func GetUsernameFromRequest

func GetUsernameFromRequest(r *http.Request) string

func IsText

func IsText(s string) bool

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

func IsTextFile(text string, filename string) bool

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 KeyText

func KeyText(s ssh.Session) (string, error)

func SanitizeFileExt

func SanitizeFileExt(fname string) string

func StartApiServer

func StartApiServer()

func TimeAgo

func TimeAgo(t *time.Time) string

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

type ConfigSite struct {
	config.ConfigCms
	config.ConfigURL
	SubdomainsEnabled bool
}

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

func (*DbHandler) Validate

func (h *DbHandler) Validate(s ssh.Session) error

func (*DbHandler) Write

func (h *DbHandler) Write(s ssh.Session, entry *utils.FileEntry) error

type HeaderTxt

type HeaderTxt struct {
	Title    string
	Bio      string
	Nav      []Link
	HasLinks bool
}
type Link struct {
	URL  string
	Text string
}

type MetaData

type MetaData struct {
	PublishAt   *time.Time
	Title       string
	Description string
	Nav         []Link
}

type Opener

type Opener struct {
	// contains filtered or unexported fields
}

func (*Opener) Open

func (o *Opener) Open(name string) (io.Reader, error)

type PageData

type PageData struct {
	Site SitePageData
}

type ParsedText

type ParsedText struct {
	Html string
	*MetaData
}

func ParseText

func ParseText(text string) *ParsedText

type PostItemData

type PostItemData struct {
	URL            template.URL
	BlogURL        template.URL
	Username       string
	Title          string
	Description    string
	PublishAtISO   string
	PublishAt      string
	UpdatedAtISO   string
	UpdatedTimeAgo string
	Padding        string
}

type PostPageData

type PostPageData struct {
	Site         SitePageData
	PageTitle    string
	URL          template.URL
	BlogURL      template.URL
	Title        string
	Description  string
	Username     string
	BlogName     string
	Contents     template.HTML
	PublishAtISO string
	PublishAt    string
}

type ReadPageData

type ReadPageData struct {
	Site     SitePageData
	NextPage string
	PrevPage string
	Posts    []PostItemData
}

type ReadmeTxt

type ReadmeTxt struct {
	HasText  bool
	Contents template.HTML
}

type Route

type Route struct {
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(method, pattern string, handler http.HandlerFunc) Route

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 SitePageData struct {
	Domain  template.URL
	HomeURL template.URL
	Email   string
}

type TransparencyPageData

type TransparencyPageData struct {
	Site      SitePageData
	Analytics *db.Analytics
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL