- docs/: shiroa book with three example categories (thermo, security, homelab); pages declare access via '#let access-groups = (...)' - cmd/parser: scans docs/ and generates acl.json (public by default, skips book.typ/template.typ/partials) - internal/acl: loads acl.json, normalizes URLs to page keys so a page's renderer data (*.multi.sir.in) inherits its protection; fail closed on malformed input - internal/oidc: authorization-code flow client, verified ID tokens, groups claim from Authentik - internal/middleware: in-memory sessions, login/logout/callback handlers, CSRF states, access gate + security headers - cmd/server + embed.go: single binary embedding dist/ and acl.json; /searchindex.json blocked; graceful shutdown - Justfile (build/run/parse/check/clean/preview-docs), Gitea Actions workflow (shiroa v0.4.0-rc2), rootless Dockerfile, README - legacy docs moved to legacy_docs/; .idea untracked
37 lines
1.0 KiB
Makefile
37 lines
1.0 KiB
Makefile
# Yggdrasil: Typst documentation behind an authenticated Go server.
|
|
# Run `just` alone to build everything.
|
|
|
|
# Build everything: acl.json, the static site, and the server binary.
|
|
default: build
|
|
build: parse build-docs build-server
|
|
|
|
# Scan docs/ for access-groups tags and regenerate acl.json.
|
|
parse:
|
|
go run ./cmd/parser -in docs -out acl.json
|
|
|
|
# Compile the Typst book into dist/ (requires shiroa on PATH).
|
|
build-docs:
|
|
shiroa build docs --dest-dir ../dist
|
|
|
|
# Build the server binary (embeds dist/ and acl.json).
|
|
build-server:
|
|
CGO_ENABLED=0 go build -trimpath -o server ./cmd/server
|
|
|
|
# Rebuild everything and run the server locally.
|
|
run: build
|
|
./server
|
|
|
|
# Live-preview the book without authentication (shiroa dev server).
|
|
preview-docs:
|
|
shiroa serve docs
|
|
|
|
# Run static checks and tests.
|
|
check:
|
|
go vet ./...
|
|
go test ./...
|
|
@test -z "$(gofmt -l cmd internal embed.go)" || { echo 'gofmt needed:'; gofmt -l cmd internal embed.go; exit 1; }
|
|
|
|
# Remove build artifacts (keeps the committed acl.json and dist/.gitkeep).
|
|
clean:
|
|
rm -rf dist server
|