gitoria
All repositories: gitoria
8.4 KB
// project.hl — gitoria.worldapi.org: THE MAP. Config, routes and WHO HEARS WHAT; the logic lives in lib/. Hybriel on hl:web.//// WHERE THINGS ARE (one line per feature; README.md "Files" has the full list):// repos: create, list, owner, main-branch setting, push rule lib/repos.hl (slug rules, rows, Markdown view: lib/repos-helpers.hl)// users, login through ident, display names lib/users.hl// git on the server (calls, branches, init, temp folder) lib/git.hl (paths, ids, |||PR / |||RL markers: lib/git-helpers.hl)// the repo homepage (README.md / $docs) lib/homepage.hl (Markdown → blocks: lib/markdown.hl)// browsing code (/code, /branch, /commit), "Make main" lib/code.hl// pull requests, the Merge button lib/pulls.hl// releases lib/releases.hl// a repo's tickets, connecting tickets, `#12` links both ways lib/tickets.hl (lib/tickets-helpers.hl)// push and pull over HTTPS (the git protocol's routes) lib/transport.hl (lib/transport-helpers.hl)// access tokens / ssh keys lib/tokens.hl / lib/sshkeys.hl// function routes: API, /login/callback, /settings/connect…, /__git/… lib/api.hl (plumbing: lib/api-helpers.hl)// shared helpers (env, storage dir, addresses, lists, Vienna time) lib/util.hl// pages: shell, repo list, readme, code, pulls, releases, tickets, settings, tokens, keys components/*.hl; CSS components/styles.hl//// HOW A REPO GETS ITS ADDRESS (ticket #6, gitoria#16): nginx sends `gitoria.worldapi.org` AND every// `<slug>.gitoria.worldapi.org` to this one app. Every page component that declares `host = null` gets the// request's host (without port, hybriel#74) on the SERVER, on the first load and on every hl:web navigation:// the main address shows the repo list + "create" (components/index.hl → list.hl), `<slug>.` shows that repo —// each repo view is its own page component on its own route (readme, code, branch, commit, pulls, releases,// tickets), rendered on the server WITH its content: git is read with hl:proc run(), which waits (hybriel#80).// The session cookie carries `Domain=.<host>` (hl:web `sessionDomain`, hybriel#44) so one// login holds on every address; the login button always returns through the main address// (the only origin registered in ident) and then on to the repo the login started from.import WebFramework from 'hl:web'import { env } from 'hl:proc'import Styles from './components/styles.hl'import { dark, darker } from './shared/tokens.hl'import { hostOnly, domainFor } from './lib/util.hl'import { tagOf } from './lib/users.hl'import { apiRepos, apiRepo, loginCallback, connectStart, connectBack, gitKeys, gitAccess } from './lib/api.hl'import { gitTransport } from './lib/transport.hl'import Index from './components/index.hl'import Code from './components/code.hl'import Branch from './components/branch.hl'import Commit from './components/commit.hl'import Pulls from './components/pulls.hl'import Releases from './components/releases.hl'import Tickets from './components/tickets.hl'import Settings from './components/settings.hl'import LoginFailed from './components/loginfailed.hl'static siteName = "gitoria"appTitle = siteNamestyles = Styles// ---- THE INSTALLABLE APP (mission 046), the same way calendar.worldapi.org and tracker do it: hl:web's own web app// manifest (/__hl/manifest.webmanifest, linked from every head with the apple-touch-icon and theme-color) and service// worker (/__hl/sw.js) from these settings — no JavaScript of ours. Icons in icons/ (icon.svg is the source, the PNGs// are rendered from it with rsvg-convert, README "PWA"). The theme colour is the header's background (darker), the// splash background the page's (dark) — both off the tokens. Every repo address is its own origin, so each one gets// its own manifest and worker (start_url / = that repo's Readme).appThemeColor = darker.valueappBackgroundColor = dark.valueappIcons = [{ src = '/icons/icon-192.png' sizes = '192x192' purpose = 'any' }{ src = '/icons/icon-512.png' sizes = '512x512' purpose = 'any' }{ src = '/icons/icon-192.png' sizes = '192x192' purpose = 'maskable' }{ src = '/icons/icon-512.png' sizes = '512x512' purpose = 'maskable' }]appTouchIcon = '/icons/apple-touch-icon.png'appFavicon = '/icons/favicon.svg'// OFFLINE: only the shell and `/` (components/main.hl says "You are offline" while the browser has no network). `/`// is kept as last seen (the worker is network-first and refreshes its copy on every online visit): the repo list on// the main address, the Readme on a repo address. Every other page (code, commits, pulls, …) needs the network and// gets hl:web's "Unavailable offline" page.offline = [ Index ]// EVERY REPO VIEW IS ITS OWN PAGE (gitoria#16); `/` is the list on the main address, the Readme on a repo address.routes = [{ pattern = "/favicon.ico" file = "./icons/favicon.ico" headers = { 'Cache-Control' = 'no-cache' } }// the installable app (mission 046): the icons (manifest and service worker are hl:web's own, from appIcons / offline){ pattern = "/icons/icon-192.png" file = "./icons/icon-192.png" headers = { 'Cache-Control' = 'no-cache' } }{ pattern = "/icons/icon-512.png" file = "./icons/icon-512.png" headers = { 'Cache-Control' = 'no-cache' } }{ pattern = "/icons/apple-touch-icon.png" file = "./icons/apple-touch-icon.png" headers = { 'Cache-Control' = 'no-cache' } }{ pattern = "/icons/favicon.svg" file = "./icons/favicon.svg" headers = { 'Cache-Control' = 'no-cache' } }// the login button's return and the tickets connection write the session: the request and the store go BY REFERENCE (lib/api.hl){ pattern = "/login/callback" function = (route, req) => { return loginCallback(route, &req, &server.sessions) } }{ pattern = "/login/failed" component = LoginFailed }{ pattern = "/login.js" file = "./login.js" headers = { 'Cache-Control' = 'no-cache' } }{ pattern = "/api/repos" function = apiRepos }{ pattern = "/api/repos/:slug" function = apiRepo }{ pattern = "/" component = Index }{ pattern = "/code" component = Code }{ pattern = "/code/*path" component = Code }{ pattern = "/branch/*path" component = Branch }{ pattern = "/commit/*path" component = Commit }{ pattern = "/pulls" component = Pulls }{ pattern = "/releases" component = Releases }{ pattern = "/tickets" component = Tickets }{ pattern = "/settings" component = Settings }{ pattern = "/settings/connect" function = (route, req) => { return connectStart(route, &req, &server.sessions) } }{ pattern = "/settings/connected" function = (route, req) => { return connectBack(route, &req, &server.sessions) } }{ pattern = "/__git/keys" function = gitKeys }{ pattern = "/__git/access" function = gitAccess }{ pattern = "/:repo/info/refs" function = gitTransport }{ pattern = "/:repo/git-upload-pack" function = gitTransport }{ pattern = "/:repo/git-receive-pack" function = gitTransport }]// WHO GETS THE PUSH: a new repo reaches every open page (the list follows live)// `gitoriaSignedIn` / `gitoriaSignedOut` go to the tabs of ONE session: the one whose login carries// that random tag (session.data.tag, set at login, users.hl tagOf) — every open page of it switches without a reload.audience = {repoCreated = (row, session) => { return true }ticketOpened = (slug, row, session) => { return true }gitoriaSignedIn = (tag, info, session) => { return tag != null && tagOf(session) == tag }gitoriaSignedOut = (tag, session) => { return tag != null && tagOf(session) == tag }}sessionDir = env('GITORIA_SESSIONS') != null ? env('GITORIA_SESSIONS') : nullport = env('GITORIA_PORT') != null ? toNumber(env('GITORIA_PORT')) : 8360// HL_HOST = the interface hl:web binds (hybriel #24, fixed upstream): 127.0.0.1 on Byrodin behind nginx;// unset = 0.0.0.0 (dev on Loreana). GITORIA_WATCH=0 = no dev watcher. The session cookie is `gitoriasid` (hybriel #10).watching = env('GITORIA_WATCH') != '0'sessionCookie = 'gitoriasid'// the cookie's Domain (hybriel#44): every <slug>.<host> shares the login (util.hl domainFor; '' = host-only → null)sessionDomain = domainFor(hostOnly) != '' ? domainFor(hostOnly) : nullserver = new WebFramework(routes = routes, styles = styles, minify = true, port = port, watchMode = watching, sessionCookie = sessionCookie, sessionDomain = sessionDomain)on Error(e) { console.log('error absorbed: ' + e.message) }
Branches
- mainmain branch
Latest commits
- 86605446mission 002 (code order) 4/4: README file map + import order + 'Same output' test + gate run with a tickets HEAD copy, STATUS (entry, lessons), LOG, report; tests/realdata-baseline.mjs + realdata-compare.py (a cleanup answers the same on live data: pages, modules, API, git over HTTPS and SSH, faces), tests/letcount.pymre
- cc7bf7bamission 002 (code order) 3/4: let only where a variable is reassigned or re-bound in a loop body (289 lets → plain declarations; 213 left: 125 reassigned, 88 loop-bound; no member/import/param clash). gates 200/0, 46/0, 44/0; real-data reads + writes identical (browser modules: var → const only)mre
- 090a20c6mission 002 (code order) 2/4: one lib/ file per topic — git.hl split into git (calls, branches, init, temp folder) / homepage / code / pulls / releases (+ git-helpers: paths, ids, |||PR/|||RL markers); repos-helpers, tickets-helpers, transport-helpers; util.hl = localtime + env, storage dir, addresses, lists, text checks, one newest-first sort (was 3 copies); the function routes out of project.hl into lib/api.hl (thin; plumbing in api-helpers.hl), sshgate.hl folded into api.hl + sshkeys.hl keyLine + repos.hl mayPush; 'Make main' and the merge answer out of the faces (code.hl makeMain, pulls.hl pullsView), one login helper (users.hl userOfLoginCode); project.hl is the map. Session-writing routes get &req + &server.sessions. gates 200/0, 46/0, 44/0; real-data identical except /login/failed now shows the parked reason for a browser that already had a session (the old copy-of-req lost it)mre
- 110c2799mission 002 (code order) 1/4: .hl files out of the root — lib/ (api, git, localtime, markdown, repos, sshgate, sshkeys, tickets, tokens, transport, users), components/styles.hl; jsoncheck.hl removed (imported nowhere); import paths only. gates 200/0, 46/0, 44/0; real-data reads + writes identicalmre
- fdfb4b1bgitoria: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 200/0, 46/0, 44/0mre
- 5b46ac84antcolony#40: LOG.md — missions 069/072 are antcolony missions (report paths on Byrodin)mre
- 5602ff41gitoria: Hybriel master 190aa11d (fc838894 GC correctness, #127 mountKids by reference, #126, #48) — tracker README flat; gates 200/0, 46/0, 44/0mre
- e85eaf01gitoria: 069 round 2 — hybriel 1a096ad3 not adopted (Markdown SSR still grows); browser gate waits for the server-side logout before restartmre
- 09ce4f3fgitoria: mission 069 re-vendor hybriel 8efba065 stopped (big SSR pages grow + slow down); lambda audit clean; old vendor keptmre
- 3dc43108antcolony#40: mission references point to the moved missionsmre
- 8d9450fdantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
- 205d5fe4gitoria: Hybriel master ff51cf46; ssh keys/tokens no double rows (session sync); gates follow #20mre
- 9b27cb26gitoria#21: installable app (manifest, service worker, offline start page), own iconmre
- 68dcb603deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
- e2deed6dgitoria#20: "Add code" only on the Code page of an empty repository, no collapsiblemre
- 8bb97ffddeploy.sh: never send .git or .gitignore to Byrodinmre
- fd981932State of 2026-09-27; bin/ no longer tracked (Hybriel commit is in README)mre
- 4a2d7125initial commitmre