gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit109cfc5c109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre109cfc5c/components/list.hl

3.4 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. // THE LIST COMES FIRST (mobile first): the repositories are what this page is for; the create form, tokens and keys follow it.
  20. // (Before, a phone scrolled past three forms — 5 000 px — to reach the first repository.)
  21. View {
  22. repoList {
  23. h1 { id = "heading" "Repositories" }
  24. if (needsLogin) { p { id = "loginhint" class = "muted" "Log in with ident (top right) to create a repository." } }
  25. if (noRepos) { p { id = "empty" class = "empty" "No repository yet." } }
  26. ol { id = "repos"
  27. for (r of repos) {
  28. li {
  29. a { class = "slug" href = r.address r.slug }
  30. if (r.described) { span { class = "about" r.description } }
  31. repoMeta { span { r.owner } time { r.created } }
  32. }
  33. }
  34. }
  35. if (canCreate) {
  36. form { id = "createform"
  37. on submit(e) {
  38. e.preventDefault()
  39. emit createIt(e)
  40. }
  41. h2 { "Create a repository" }
  42. label { "Address — its name is unique in the whole system and becomes NAME.gitoria.worldapi.org"
  43. input { id = "slug" name = "slug" required = "required" minlength = "2" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" }
  44. }
  45. label { "Description (optional)"
  46. input { id = "description" name = "description" maxlength = "200" autocomplete = "off" }
  47. }
  48. button { id = "createsave" type = "submit" "Create repository" }
  49. p { id = "createerror" class = "message" createError }
  50. }
  51. }
  52. if (hasCreated) { p { id = "created" class = "notice" createdText " " a { id = "createdlink" href = createdHref "Open it" } } }
  53. Tokens { }
  54. SshKeys { }
  55. }
  56. }
  57. on createIt(e) {
  58. f = e.target.elements
  59. r = emit server gitoriaCreate(f.slug.value, f.description.value)
  60. if (r == null || r.error != null) {
  61. createError = r != null ? r.error : 'could not create the repository'
  62. return null
  63. }
  64. createError = ''
  65. f.slug.value = ''
  66. f.description.value = ''
  67. createdText = "Created '" + r.repo.slug + "': "
  68. createdHref = r.repo.address
  69. hasCreated = true
  70. }
  71. // this session's tabs follow a login / name / logout (the shell's faces push them)
  72. on client gitoriaSignedIn(tag, info) {
  73. canCreate = info.named
  74. needsLogin = false
  75. }
  76. on client gitoriaSignedOut(tag) {
  77. canCreate = false
  78. needsLogin = true
  79. }
  80. // a new repo, from any session: the list follows live
  81. on client repoCreated(row) {
  82. next = [row]
  83. for (x of repos) { if (x.id != row.id) { next.push(x) } }
  84. repos = next
  85. noRepos = false
  86. }
  87. on server gitoriaCreate(slug, description, session) {
  88. u = userOfSession(session)
  89. if (u == null) { return { error = 'log in with ident (top right) to create a repository' } }
  90. r = createRepo(u.id, slug, description)
  91. if (r.error != null) { return { error = r.error } }
  92. emit client repoCreated(r.repo)
  93. return r
  94. }

Branches

Latest commits

  • 109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre
  • 7eb6be27sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • b3911918reports/MG-mobile.md: 404 fixed, rebased gatesMG
  • 9da65b42tests/browser.mjs: 404 checks (host, no hydration wait)MG
  • 00517fafgitoria: shell 404 page for unknown paths (catch-all route, status 404, JSON 404 under /api), 390 gate checksMG
  • d9e977f0reports/MG-mobile.md, LOGMG
  • 2f2725actests/browser.mjs: commit-row check (one row, centred date)MG
  • 4df1ea01tests/browser.mjs: MG phone checks (list first, no dead strip, one branch heading, tab grid, commit rows, PR title row, ticket columns, wrapping commands)MG
  • c52424e9gitoria mobile: repo list before the forms, 3x2 tab grid, no duplicate branch heading, ordered commit rows, aligned ticket rows, pull title on its own row, wrapping clone commands, no dead strip under formsMG
  • 3a95252dG3: cache parsed README blocks by sha256 of the text (bounded LRU), reportmre
  • 570138cddeploy: security gate (tests/security.mjs)mre
  • da6b20fcgitoria SG: security audit fixes (uploadMax 0, Secure cookie on https, session rotation at login, nosniff on function routes, no identity in page data) + tests/security.mjs gate + reportmre
  • f98c981fgitoria B1: report wordingmre
  • c6364cedgitoria B1: compact Markdown blocks (one kind flag per block/span, empty and false fields omitted); same rendered HTML, page values -67%mre
  • cd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmre
  • e5404b9breport: commit idsmre
  • 63cfa21ereports/G2-repotabs.mdmre
  • 9b0516fdgitoria#22: mark the tab underline functional (check-theme), chain E2E: serve/measure split, bring the lisbeth tab to frontmre
  • 19bc1df8gitoria#22: all repo pages under ONE layout level (components/repo.hl, hl:web D-CHAIN): a tab click replaces only the page in the slot; head and tab nav stay the same DOM nodesmre
  • 40658417tests/browser.mjs: wait for the page to be live (hydrated) before clicking Merge — a click on the server-rendered button before the client mounted was lost (flaky 'Clashing change' under load)mre