gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit90b4f72890b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre90b4f728/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

  • 90b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre
  • a487248cgitoria#25: remove every cache that hid the page build (page key, Markdown render key, homepage cache, parsed-blocks cache) and the gate that only tested themmre
  • 12f2f4fegitoria: re-vendor Hybriel set-day27b, a startup fault in on Error exits 1mre
  • c21c084egitoria: write the standby service out in full so the boot gate can read the main servicemre
  • e307d69agitoria: say what is per process during the hand-overmre
  • f0cbe6a6gitoria: standby service on port 45014 and a deploy that hands over through it without a gapmre
  • 727cd083gitoria#25: README: vendor notes for Hybriel c1b1010f and the page cachemre
  • 61b72dedgitoria#25: re-vendor Hybriel master c1b1010f (W149 page cache), key the repo Readme page by slug and main commit, extend the readme-cache gatemre
  • 5b0b4b9ereadme-cache gate: use the security gate's ports when no own ports are givenmre
  • bc8f20d9gitoria#25: re-vendor Hybriel c09538bb with the W141 render cache, cache the homepage per commit, add the readme-cache gatemre
  • 9feebbd3Re-vendor Hybriel to ded47c13 (W145: Firefox start script fix)mre
  • 28ed41e5gitoria#24: one sign-in comes from hl:web batch 20, the /session/share workaround is gonemre
  • 3b2669e4gs: drop the unbuildable legacy check, fix pwa fetchmre
  • 2a2fdd77gs: C2 check before cookie experimentsmre
  • 76e0587aWIP gs 2mre
  • a80da7bdWIP gs: security gate for lazy sessions, g24 browser checksmre
  • 23fb05d8re-vendor Hybriel aaa39e69 (hl:web batch 20: login emit and Sessions.mint, tab follows a login, signed-in session cookie wins among duplicates and is re-issued with the Domain, W85 faster render, lazy sessions)mre
  • a0727ca3ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • a06975f9gitoria: a gap between your name and Log out in the phone header (they touched); gate checks itmre
  • 32ba9d59gitoria: leave the host-only cookie experiment out of the browser gate (gitoria#24 is a separate mission)mre