siteroutes

package
v0.326.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Has

func Has(seg string) bool

Has reports whether seg is in the set.

func IsPath

func IsPath(p string) bool

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.

func Segments

func Segments() []string

Segments is the installed set, sorted (nil before Set).

func Set

func Set(segs []string)

Set installs segs (first path segments, no slashes) as the set, sorted and de-duplicated. A segment that is empty or holds a character IsPath splits on is dropped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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