Add a Gotea Pages prototype: a pages branch is checked out with got, built with the vendored bb, swapped atomically into a pages root, and served only on a separate host from an allowlist. A post-receive hook installer wires the flow through Gitea delegate hooks. The CGI pages mode isolates the host and contains paths with realpath. Assisted-by: OpenCode:DeepSeek-V4.1-Flash
gotea
Gotea is a fork of Gitea with two defining changes:
- repositories are read and maintained with got
(Game of Trees) instead of the
gitbinary, and - an HTML 4.01 frontend written in C99/POSIX serves repositories over CGI, with no JavaScript and a CDE/Motif look.
The fork is based on Gitea v28.4.0. Upstream history and licensing are retained.
Status
This tree is at the bootstrap milestone:
| Layer | State |
|---|---|
| Go backend | Imported and building as gotea (module gotea.dev). Still uses git internally; the got migration is in progress. |
| Legacy frontend | cgi/gotea-cgi: read-only browser over got, HTML 4.01 Transitional, no JavaScript, CDE palette. |
| Pages | Prototype: a pages branch is checked out with got, built with vendored bb, and served on a separate host. |
| Auth and writes | Not yet implemented in the CGI frontend. |
Build
make gotea # Go backend binary
make build # full Gitea build; needs pnpm and Node
make -C cgi # C99 CGI binary
make -C cgi check # CGI + pages tests (git is used only for fixtures)
make bb # vendored bb static site generator
Run the CGI
GOTEA_REPO_ROOT=/var/lib/gotea/data/gitea-repositories \
GOT_BIN=/usr/bin/got \
SCRIPT_NAME=/cgi-bin/gotea \
REQUEST_METHOD=GET PATH_INFO=/ \
./cgi/gotea-cgi
Point GOTEA_REPO_ROOT at Gotea's data/gitea-repositories. Both flat
(repo.git) and owner-scoped (owner/repo.git) layouts are supported.
Deploy with Apache
ScriptAlias /cgi-bin/gotea /usr/local/libexec/gotea-cgi
<Directory /usr/local/libexec>
Options +ExecCGI
SetHandler cgi-script
</Directory>
SetEnv GOTEA_REPO_ROOT /var/lib/gotea/data/gitea-repositories
SetEnv GOT_BIN /usr/bin/got
For nginx, run the CGI through fcgiwrap; the binary does not need a daemon.
Access control: gotea-cgi is read-only and does not authenticate. It serves
every repository under GOTEA_REPO_ROOT to anyone who can reach it. Use it only
for public repositories, or put it behind web-server authentication, until the
auth layer lands.
CGI configuration
| Variable | Default | Meaning |
|---|---|---|
GOTEA_REPO_ROOT |
./repositories |
Directory with bare Git-format repositories |
GOT_BIN |
got |
got binary |
GOTEA_PALETTE |
built-in CDE palette | key=value colour file |
GOTEA_DEBUG |
unset | Show got stderr on error pages |
SCRIPT_NAME |
/cgi-bin/gotea |
CGI mount point, set by the web server |
GOTEA_PAGES_HOST |
unset | Serve pages only when HTTP_HOST matches this |
GOTEA_PAGES_ROOT |
unset | Root of the built project sites |
GOTEA_PAGES_ALLOW |
unset | File listing owner/repo sites that may be served |
Palette keys: base, light, white, dark, shadow, text, link,
visited, title_bg, title_fg. Values must be #rgb or #rrggbb.
See cgi/palettes/cde-default.palette.
Pages
A pages branch is a bb project. On push,
the post-receive hook checks the branch out with got, runs bb build, and
atomically swaps the built dist/ into
GOTEA_PAGES_ROOT/<owner>/<repo>/.
make bb
cgi/pages/install-hook.sh <bare-repo> <pages-root> <allow-file> [bb] [branch]
The installer adds owner/repo to the allowlist and writes
hooks/gotea-pages.env; Gitea's delegate hook runs hooks/post-receive.d/*.
Manual publish:
GOTEA_PAGES_ROOT=/var/lib/gotea/pages \
GOTEA_BB=third_party/bb/bb \
cgi/pages/publish.sh <bare-repo> owner/repo <commit>
Serve the built output on a separate host:
GOTEA_PAGES_HOST=pages.example.com \
GOTEA_PAGES_ROOT=/var/lib/gotea/pages \
GOTEA_PAGES_ALLOW=/etc/gotea/pages.allow \
./cgi/gotea-cgi
GOTEA_PAGES_HOST must match HTTP_HOST exactly; other hosts get 404. Only
allowlisted repositories are served, and the pages host never exposes the main
UI. Keep private repositories out of the allowlist: the publisher has no
visibility check. Optional publisher settings are GOTEA_PAGES_BRANCH (default
pages), GOTEA_PAGES_THEME, GOTEA_PAGES_SUBDIR, and GOTEA_PAGES_STRICT=1
to fail the push when publishing fails.
bb is vendored under third_party/bb (MIT, upstream commit in
third_party/bb/NOTICE), so a checkout builds without an installed bb.
make bb-check runs bb's own suite; it currently reports 20 upstream theme
contrast failures (925/945 pass), which do not affect the build path.
Design notes
- HTML 4.01 Transitional, CSS1, table layout, no JavaScript, no external assets.
- CDE/Motif cues: grey panels, bevelled borders, navy title bars, Front Panel sidebar.
- The CGI is read-only;
gotis its only repository reader, with no shell invocation and nogitfallback. - Routes:
/,/repo/<name>/tree[/path],/repo/<name>/blob/<path>,/repo/<name>/raw/<path>,/repo/<name>/log,/repo/<name>/commit/<rev>.
Why the backend is not rewritten in C
Gitea's value is its forge backend: authentication, permissions, issues, pull requests, API, and migrations. Rewriting that up front would discard working, security-sensitive code and delay the interface the fork actually needs. The old-browser interface is therefore a C99 CGI presentation tier over the same repositories, and it can take over more of the UI incrementally.
License
MIT. Upstream copyright and license notices are retained; see LICENSE.