gitoriaLog in with ident

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit4f47843e4f47843egate: ticket links use the tickets short URL (/<slug>/<n>, tickets#25)mre4f47843e/components/list.hl

3.2 KB

  1. // components/list.hl — THE REPO LIST of the main address (ticket #6, gitoria#16): every repository, newest
  2. // first, and "Create a repository" (slug = its address, unique in the whole system) for a named user.
  3. // Composed into components/index.hl (route `/`) when the request's host is the main address. Rendered on
  4. // the server with its rows; a new repo from any session reaches every open list (push `repoCreated`).
  5. import Tokens from './tokens.hl'
  6. import SshKeys from './sshkeys.hl'
  7. import { repoRows, createRepo } from '../lib/repos.hl'
  8. import { infoOfSession, userOfSession } from '../lib/users.hl'
  9. session = null
  10. me = infoOfSession(session)
  11. canCreate = me != null && me.named
  12. needsLogin = me == null
  13. repos = repoRows()
  14. noRepos = repos.length == 0
  15. createError = ''
  16. createdText = ''
  17. createdHref = ''
  18. hasCreated = false
  19. View {
  20. repoList {
  21. h1 { id = "heading" "Repositories" }
  22. if (needsLogin) { p { id = "loginhint" class = "muted" "Log in with ident (top right) to create a repository." } }
  23. if (canCreate) {
  24. form { id = "createform"
  25. on submit(e) {
  26. e.preventDefault()
  27. emit createIt(e)
  28. }
  29. h2 { "Create a repository" }
  30. label { "Address — its name is unique in the whole system and becomes NAME.gitoria.worldapi.org"
  31. input { id = "slug" name = "slug" required = "required" minlength = "2" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" }
  32. }
  33. label { "Description (optional)"
  34. input { id = "description" name = "description" maxlength = "200" autocomplete = "off" }
  35. }
  36. button { id = "createsave" type = "submit" "Create repository" }
  37. p { id = "createerror" class = "message" createError }
  38. }
  39. }
  40. if (hasCreated) { p { id = "created" class = "notice" createdText " " a { id = "createdlink" href = createdHref "Open it" } } }
  41. if (noRepos) { p { id = "empty" class = "empty" "No repository yet." } }
  42. Tokens { }
  43. SshKeys { }
  44. ol { id = "repos"
  45. for (r of repos) {
  46. li {
  47. a { class = "slug" href = r.address r.slug }
  48. if (r.described) { span { class = "about" r.description } }
  49. repoMeta { span { r.owner } time { r.created } }
  50. }
  51. }
  52. }
  53. }
  54. }
  55. on createIt(e) {
  56. f = e.target.elements
  57. r = emit server gitoriaCreate(f.slug.value, f.description.value)
  58. if (r == null || r.error != null) {
  59. createError = r != null ? r.error : 'could not create the repository'
  60. return null
  61. }
  62. createError = ''
  63. f.slug.value = ''
  64. f.description.value = ''
  65. createdText = "Created '" + r.repo.slug + "': "
  66. createdHref = r.repo.address
  67. hasCreated = true
  68. }
  69. // this session's tabs follow a login / name / logout (the shell's faces push them)
  70. on client gitoriaSignedIn(tag, info) {
  71. canCreate = info.named
  72. needsLogin = false
  73. }
  74. on client gitoriaSignedOut(tag) {
  75. canCreate = false
  76. needsLogin = true
  77. }
  78. // a new repo, from any session: the list follows live
  79. on client repoCreated(row) {
  80. next = [row]
  81. for (x of repos) { if (x.id != row.id) { next.push(x) } }
  82. repos = next
  83. noRepos = false
  84. }
  85. on server gitoriaCreate(slug, description, session) {
  86. u = userOfSession(session)
  87. if (u == null) { return { error = 'log in with ident (top right) to create a repository' } }
  88. r = createRepo(u.id, slug, description)
  89. if (r.error != null) { return { error = r.error } }
  90. emit client repoCreated(r.repo)
  91. return r
  92. }

Branches

Latest commits

  • 4f47843egate: ticket links use the tickets short URL (/<slug>/<n>, tickets#25)mre
  • 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