gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit32ba9d5932ba9d59gitoria: leave the host-only cookie experiment out of the browser gate (gitoria#24 is a separate mission)mre32ba9d59/components/settings.hl

3.3 KB

  1. // components/settings.hl — THE SETTINGS of a repo (gitoria#18): `/settings` on <slug>.<domain>. For now one section,
  2. // "Tickets": connect the repo to a tickets.worldapi.org project (the owner clicks "Tickets: connect", tickets asks which
  3. // project, and brings them back — lib/api.hl /settings/connect and /settings/connected; lib/tickets.hl). Anyone sees
  4. // whether the repo is connected; only the owner sees the buttons. Rendered on the server from the request's host.
  5. // (The main branch is switched on the code page.)
  6. parent './repo.hl'
  7. import { siteName } from '../project.hl'
  8. import { slugOfHost } from '../lib/util.hl'
  9. import { userOfSession } from '../lib/users.hl'
  10. import { repoAt, ownsRepo, setTicketsConnection } from '../lib/repos.hl'
  11. import { pageTitle } from '../lib/repos-helpers.hl'
  12. import { ticketsUrl } from '../lib/tickets-helpers.hl'
  13. host = null
  14. session = null
  15. slug = slugOfHost(host)
  16. repo = repoAt(slug)
  17. hasRepo = repo != null
  18. isOwner = repo != null && ownsRepo(slug, session)
  19. connected = repo != null && repo.ticketsOn
  20. notConnected = repo != null && !repo.ticketsOn
  21. projectTitle = repo != null ? repo.ticketsTitle : ''
  22. projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''
  23. connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''
  24. hasConnectNote = connectNote != ''
  25. notOwnerHint = repo != null && !isOwner
  26. settingsError = ''
  27. forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'
  28. __title = pageTitle(siteName, slug, 'Settings')
  29. View {
  30. repoPage {
  31. if (hasRepo) {
  32. repoSettings { id = "settings"
  33. section { id = "ticketsettings"
  34. h2 { "Tickets" }
  35. if (hasConnectNote) { p { id = "connectnote" class = "message" connectNote } }
  36. if (connected) {
  37. p { id = "connectedto" "Connected to the tickets project " a { id = "projectlink" href = projectHref projectTitle } "." }
  38. }
  39. if (notConnected) { p { id = "notconnected" class = "muted" "This repository is not connected to a tickets project yet." } }
  40. if (isOwner) {
  41. p {
  42. a { id = "connecttickets" class = "button" href = "/settings/connect" "Tickets: connect" }
  43. }
  44. button { id = "disconnecttickets" class = forgetClass type = "button" "Forget the connection" on click(e) { emit disconnect() } }
  45. p { class = "muted" "Connecting asks tickets which project (you must be its admin there). Tickets can also disconnect gitoria from its side." }
  46. }
  47. if (notOwnerHint) { p { id = "ownerhint" class = "muted" "Only the owner of this repository can connect it." } }
  48. p { id = "settingserror" class = "message" settingsError }
  49. }
  50. }
  51. }
  52. }
  53. }
  54. on disconnect() {
  55. settingsError = ''
  56. r = emit server gitoriaDisconnectTickets(slug)
  57. if (r == null || r.error != null) {
  58. settingsError = r != null ? r.error : 'could not disconnect'
  59. return null
  60. }
  61. connected = false
  62. notConnected = true
  63. forgetClass = 'nomerge'
  64. projectTitle = ''
  65. projectHref = ''
  66. }
  67. on server gitoriaDisconnectTickets(slugOf, session) {
  68. if (session == null || repoAt(slugOf) == null) { return { error = 'could not disconnect' } }
  69. if (userOfSession(session) == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can change this' } }
  70. r = setTicketsConnection(slugOf, '', '', '', '')
  71. if (r.error != null) { return { error = r.error } }
  72. return { ok = true }
  73. }

Branches

Latest commits

  • 32ba9d59gitoria: leave the host-only cookie experiment out of the browser gate (gitoria#24 is a separate mission)mre
  • 43ad2bcfgitoria header: the selector alone plus your name and Log out as before the theme missions; tests follow (WIP: host-only cookie experiment fails)mre
  • ac2c4e3fident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
  • b279f536theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
  • 2b01515ctests/ticketskit: a failed start kills the tickets server (own process group); stop() kills the groupmre
  • 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