session

package
v2.0.0-rc05 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PathGetJs is the GET endpoint for most of the javascript needed by the webapps.
	PathGetJs = "/_/js"
	// PathGetCss is the GET endpoint for all the css needed by the webapps.
	PathGetCss = "/_/css"
	// PathReload tells the server to reload all data from the file system.
	PathReload = "/_/r"
	// PathGetLabelsForFile is the GET endpoint for code block labels of one markdown file.
	PathGetLabelsForFile = "/_/getLabelsForFile"
	// PathGetHtmlForFile is the GET endpoint for HTML of one markdown file.
	PathGetHtmlForFile = "/_/getHtmlForFile"
	// PathRunBlock is the POST endpoint to trigger code block execution.
	PathRunBlock = "/_/runCodeBlock"
	// PathSave is the POST endpoint to save application state.
	PathSave = "/_/save"

	// KeyMdSessID is the param name for session ID.
	KeyMdSessID = "sid"
	// KeyIsTitleOn is the param name for is-the-title-on boolean.
	KeyIsTitleOn = "tit"
	// KeyIsNavOn is the param name for the is-the-nav-on boolean.
	KeyIsNavOn = "nav"
	// KeyMdFileIndex is the param name for the markdown file index.
	KeyMdFileIndex = "fix"
	// KeyBlockIndex is the param name for the code block index.
	KeyBlockIndex = "bix"
)

These must all be unique, and preferably short. These are URL query parameter and cookie field names.

Variables

View Source
var (
	//go:embed session.js
	Js string
)

Functions

func AssureDefaults

func AssureDefaults(s *sessions.Session)

AssureDefaults inserts default values if values are missing.

Types

type Bucket

type Bucket struct {
	// The session ID.
	MdSessID TypeSessID
	// Is the header showing?
	IsHeaderOn bool
	// Is the nav showing?
	IsNavOn bool
	// The active markdown file.
	MdFileIndex int
	// The active block in that file.
	BlockIndex int
}

Bucket holds session state data, presumably associated with a cookie.

func ConvertToBucket

func ConvertToBucket(s *sessions.Session) *Bucket

ConvertToBucket creates a SessionData instance; a copy of the session data but in typesafe fields rather than a map of string to any.

type TypeSessID

type TypeSessID string

TypeSessID represents a session ID.

Jump to

Keyboard shortcuts

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