caddyhugo

package module
v0.0.0-...-af9d6d6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MPL-2.0 Imports: 39 Imported by: 0

README

author view

Documentation

Index

Constants

View Source
const (
	IdleWebsocketTimeout = 10 * time.Minute
	WebsocketFileTicker  = 1 * time.Second
)

Variables

View Source
var AdminPage = frontend.AdminPage()
View Source
var AuthorPage = frontend.AuthorPage()
View Source
var EditPage = frontend.EditPage()

Functions

func HugoInternalProcessConfig

func HugoInternalProcessConfig(ch *CaddyHugo, es *editSession, touchFn func()) (idleshut.Config, error)

func UploadPage

func UploadPage(elemName string) string

Types

type CaddyHugo

type CaddyHugo struct {
	ServerType string
	Site       SiteConfig
	HugoSites  *hugolib.HugoSites
	HugoCfg    *deps.DepsCfg

	Dir string

	Media    *media.MediaSource
	Comments *comments.Service
	// contains filtered or unexported fields
}

CaddyHugo implements the plugin for a single site

func (*CaddyHugo) Admin

func (ch *CaddyHugo) Admin() caddyhttp.Handler

func (*CaddyHugo) Auth

func (ch *CaddyHugo) Auth(r *http.Request) bool

func (*CaddyHugo) AuthorHome

func (ch *CaddyHugo) AuthorHome() caddyhttp.Handler

func (*CaddyHugo) BasePath

func (ch *CaddyHugo) BasePath() string

BasePath returns the directory that the CaddyHugo internal/author pages are under

func (*CaddyHugo) Build

func (ch *CaddyHugo) Build() error

Build rebuilds the cached state of the site. TODO: determine if this republishes

func (*CaddyHugo) CaddyModule

func (m *CaddyHugo) CaddyModule() caddy.ModuleInfo

func (*CaddyHugo) ClearConfirmed

func (ch *CaddyHugo) ClearConfirmed(lowestPending uint64)

func (*CaddyHugo) ConfirmLTime

func (ch *CaddyHugo) ConfirmLTime(ltime uint64)

ConfirmLTime marks an ltime as something that should be confirmed with clients

func (*CaddyHugo) Confirming

func (ch *CaddyHugo) Confirming() []uint64

Confirming returns the current list of LTimes that need to be confirmed to clients

func (*CaddyHugo) DeltaWebsocket

func (ch *CaddyHugo) DeltaWebsocket(w http.ResponseWriter, r *http.Request) error

func (*CaddyHugo) Edit

func (ch *CaddyHugo) Edit() caddyhttp.Handler

func (*CaddyHugo) LTime

func (ch *CaddyHugo) LTime() uint64

func (*CaddyHugo) LowestPendingConfirmation

func (ch *CaddyHugo) LowestPendingConfirmation() uint64

LowestPendingConfirmation identifies the lowest LTime that needs to be confirmed to clients

func (*CaddyHugo) Match

func (ch *CaddyHugo) Match(r *http.Request) bool

func (*CaddyHugo) Message

func (ch *CaddyHugo) Message(deltas ...acedoc.Delta) Message

func (*CaddyHugo) NewContent

func (ch *CaddyHugo) NewContent(name, ctype string) (string, error)

NewContent initializes new content with the name (title) and content type. If ctype is empty string, "default" is used. The return value is the filename, which may be modified from the title and includes the content type if other than default, but does not include the full directory relative to the site.

func (*CaddyHugo) ObserveLTime

func (ch *CaddyHugo) ObserveLTime(ltime uint64) uint64

func (*CaddyHugo) Provision

func (m *CaddyHugo) Provision(ctx caddy.Context) error

func (*CaddyHugo) Publish

func (ch *CaddyHugo) Publish() error

Publish really renders new content into the public directory

func (*CaddyHugo) ReferencedMedia

func (ch *CaddyHugo) ReferencedMedia() map[string]map[page.Page]struct{}

func (*CaddyHugo) ServeHTTP

func (ch *CaddyHugo) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*CaddyHugo) ServeNewContent

func (ch *CaddyHugo) ServeNewContent(w http.ResponseWriter, r *http.Request) error

func (*CaddyHugo) Setup

func (ch *CaddyHugo) Setup(dir string) error

func (*CaddyHugo) ShouldApply

func (ch *CaddyHugo) ShouldApply(ltime uint64) bool

func (*CaddyHugo) TmplData

func (ch *CaddyHugo) TmplData(r *http.Request, docref *editSession) interface{}

TmplData collects data for template execution

type Content

type Content struct {
	Filename string
	Modtime  time.Time
	Metadata *Metadata
}

func GetContent

func GetContent(siteRoot string, sites *hugolib.HugoSites) ([]Content, error)

GetContent fetches the list of available content from the site directory. If possible, the return value will be enriched with metadata from Hugo.

type DeltaConn

type DeltaConn interface {
	ReadJSON(v interface{}) error
	WriteJSON(v interface{}) error
}

DeltaConn identifies the methods used in the original websocket implementation.

type Message

type Message struct {
	Deltas        []acedoc.Delta `json:"deltas"`
	LTime         uint64         `json:"ltime"`
	Confirmed     []uint64       `json:"confirmed"`
	LowestPending uint64         `json:"lowestPending"`
}

type Metadata

type Metadata struct {
	Title         string
	Path          string
	Date, Lastmod time.Time
}

type SiteConfig

type SiteConfig struct {
	Hosts            []string
	Root             string
	CommentsEnabled  bool
	CommentsPassword string
}

func (*SiteConfig) UnmarshalCaddyfile

func (s *SiteConfig) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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