Documentation
¶
Overview ¶
Package siteroutes is which paths of this server a link in rendered text may name: a site-relative path (/pages/12/view) is a link only when its FIRST segment is one of muster's own browser routes.
🔴 THE SET IS NOT WRITTEN HERE. internal/api derives it from its own route registration when the package loads (api site_routes.go: every GET route's first segment, minus /api and the browser listener's machine-only doors) and installs it with Set. A program that never loads internal/api has the EMPTY set, so no path is a link there: the rule fails closed, never open.
One rule, three readers: the markdown renderer (internal/ui mdLinkify), the page shell's open check (internal/pages ShellScript, which carries Segments as data and spells IsPath in JavaScript), and their tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPath ¶
IsPath reports whether p is a site-relative path naming one of muster's routes: exactly one `/`, then a character that is neither `/` nor `\`, no control character anywhere, and a first segment (up to the next `/`, `?` or `#`) in the set.
🔴 THE SECOND CHARACTER IS WHAT KEEPS IT ON THIS HOST. A browser reads `//host/x` as protocol-relative (another host), and for http(s) it reads `\` as `/`, so `/\host` is `//host` too. Past the second character the URL parser has settled the host, so nothing later can leave the origin. Tab and newline, which a browser strips from a URL before parsing, are control characters and refused here.
Types ¶
This section is empty.