gitoria
All repositories: gitoria
2.4 KB
// lib/orgs.hl — ORGANIZATIONS (ticket gitoria#34, GO34). An organization is a name that is its own address <org>.<domain>; its repos live at// <org>.<domain>/<repo> and look like a repo page on <repo>.<domain>. One hl:mpackdb table, storage/mpackdb/orgs.db:// pk @id index !slug, owner { slug, owner (users @id), priv (true = every repo of it is private, also new ones), created }// An organization's name and a repo's name share one namespace (both are subdomains): lib/repos.hl checks both. Who belongs to an// organization is the one member list of lib/members.hl. Statics only; no page code.import { MPackDB } from 'hl:mpackdb'import { now } from 'hl:time'import { storageDir, firstOf, slugOfHost } from './util.hl'static orgsTable = new MPackDB(file = storageDir + '/orgs.db', primaryKey = '@id', indexes = ['!slug', 'owner'])static orgBySlug = (slug) => {if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }return firstOf(orgsTable.find('slug', slug))}static putOrg = (slug, owner, priv) => {id = orgsTable.put({ slug = slug owner = owner priv = priv created = now() })return id == null ? null : orgsTable.fetch(id)}static setOrgPriv = (o, priv) => {orgsTable.update(o.id, { id = o.id slug = o.slug owner = o.owner priv = priv created = o.created })after = orgsTable.fetch(o.id)return after != null && after.priv == priv}// every organization recordstatic allOrgs = () => {all = orgsTable.find(null, null)return all == null || all.length == null ? [] : all}// THE REPO NAME OF A REQUEST: `host` (no port) and `orepo` (the first path segment of an organization's address, '' elsewhere).// '' = the main address; `name` = a repo's own address; `org/name` = a repo inside an organization; '!x' = a path that names// no repo (a first segment on a host that is not an organization) — "No such repository".static slugOfRequest = (host, orepo) => {label = slugOfHost(host)if (orepo == null || orepo == '') { return label }if (label != '' && orgBySlug(label) != null) { return label + '/' + orepo }return '!'}// the first path segment of an organization's address (the repo inside it), '' on every other host or at the organization's rootstatic orepoOfPath = (host, path) => {label = slugOfHost(host)if (label == '' || path == null || orgBySlug(label) == null) { return '' }rest = path.startsWith('/') ? path.slice(1) : pathi = rest.indexOf('/')return i < 0 ? rest : rest.slice(0, i)}
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- cd442066gitoria#43: app-auth unit test reads the apps table from its new filemre
- 5dccbe38gitoria#43: in-flight rows are left alone by the other process; gate in deploy.sh; READMEmre
- 8c8805f3merge main (gitoria#42), delivery log and redelivery routes, sweep fixmre
- 5a996ea8gitoria#42: short-lived app tokens, read-only git fetch with them (merge w42-app-token)mre
- afdb0cbfgitoria#43: rename the moved helper (name clash in the browser build)mre
- 15e01e94gitoria#43: tests/events.mjs and its probemre
- 77829b73gitoria#43: signed events to connected apps (deliveries table, sender timer, pull_request events, ping)mre
- b5d696fegitoria#42: app tokens (gat_, one hour), appOfRequest, app token as the git read passwordmre
- 1997e77dgitoria#40: stable PR numbers, refs/pull/N/head, ssh pushes reach the app (merge w40-pr-number)mre
- 9364fb16gitoria#40: ssh pushes call /__git/pushed before and after (ensurePulls, notifyPush, syncPulls); gate over the sshd imagemre
- fdb9ed28gitoria#41: repo owners can connect an app (merge w41-apps-connect)mre
- 2ef23df0gitoria#40: the browser gate reads the title without the #Nmre
- 9af07ecegitoria#41: connect an app to a repo (apps table, connect flow, manual add, allow-list, settings)mre
- b9137ff0gitoria#40: pull requests are stored with a number, refs/pull/N/head, syncPulls and pullObject; /pulls shows #Nmre
- 06d622daown image tag gitoria-runtime:debian12 for gitoria and standby (shared tag lost git)mre
- 20caa33agitoria#37: media queries in the language's @media block (minWidth = '60rem') in list, codebrowser and repomre
- c4175e6dgitoria: a startup error prints its message before exit 1 (hybriel#247)mre
- c50d17efKeep function-route not-found style in shared stylesheetmre
- e42d78d3Preserve ticket state CSS and document function-route style gapmre
- c6b7154eWIP gitoria#26: move styles into nested component blocksmre