Documentation
¶
Overview ¶
Package web is the brief session's page (itd-2610091016262335, spc-2610141709430146 step 3): the static files `abcd session page` writes, embedded in the binary. The page is plain HTML, one ES module and one stylesheet, plus the vendored, provenance-pinned editor bundle (adr-2610141949110653). It connects only to the relay the person names and to api.github.com with the person's own token, and it sends the person to github.com for sign-in and to open the pre-filled issues a session sends.
The HTML is written twice, as index.html and as 404.html, byte for byte the same: a static host such as GitHub Pages serves 404.html for a path it has no file for, which is how /<owner>/<repo>/brief/ reaches the page. Every asset the HTML loads is named from the site's root (/session.js), or from under the base path the page is written for (/abcdesign/session.js), so /<owner>/<repo>/brief loads them with or without its trailing slash; the page then adds the slash.
Index ¶
Constants ¶
const Generator = `<meta name="generator" content="abcd session page">`
Generator is the line the page's HTML carries, which is how a later run knows a directory holding the page's files as one it wrote.
const RelayMarker = `<meta name="abcd-session-relay" content="self">`
RelayMarker is the line the page carries when the relay serves it itself (a local session): the page then takes its own origin as its relay.
Variables ¶
This section is empty.
Functions ¶
func RelayFiles ¶
RelayFiles is the page as a local session's relay serves it itself, keyed by the path it is served at: the page's files at the site's root, its HTML as "index.html" carrying RelayMarker once, and no 404.html, since the relay answers the brief's path itself.
Types ¶
type Refusal ¶
type Refusal struct{ Reason string }
Refusal is a directory Write will not write into; nothing was written.
type Result ¶
type Result struct {
Out string `json:"out"`
Files []string `json:"files"`
Bytes int64 `json:"bytes"`
// BasePath is the path the site is served under, "/" at the root.
BasePath string `json:"base_path"`
// Replaced is true when the directory held an earlier copy of the page.
Replaced bool `json:"replaced"`
}
Result is what Write did.
func Write ¶
Write writes the page's files, for a site served under basePath, into out and nothing else. out may be absent or empty; a directory holding anything but the page's own files, or holding them without the page's own index.html, is refused untouched. Nothing is ever removed: an earlier copy of the page is overwritten file by file.