gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit944ad51e944ad51eSK: report reports/SK-sec.md, LOGsk944ad51e/components/franchiseedit.hl

4.3 KB

  1. // components/franchiseedit.hl — `/franchises/edit` (tracker.worldapi.org#19, mission 066): the creator's editor, step 1 —
  2. // a new franchise (name + summary → its index), a new timeline (name → its own editor, /timelines/<slug>/edit, where titles
  3. // are added and ordered and the franchise is attached), and a finder for the timelines that exist (by name → their editor).
  4. // Only the creator (franchises.hl isEditorSession: ident id az5b2, TRACKER_EDITORS) sees the forms; every face checks it again.
  5. //
  6. // HYBRIEL TRAPS (as components/search.hl): no member reads both a route param and `session`; every list is replaced whole.
  7. parent './main.hl'
  8. import { navigate } from 'hl:web'
  9. import { appTitle } from '../project.hl'
  10. import { isEditorSession, createFranchise, createTimeline, findTimelines } from '../lib/franchises.hl'
  11. import { warmReady, warmText } from '../lib/warm.hl'
  12. static editorOf = (&session) => { return isEditorSession(session) }
  13. session = null
  14. isEditor = editorOf(session)
  15. notEditor = isEditor == false
  16. message = ''
  17. hasMessage = message != ''
  18. found = []
  19. hasFound = found.length > 0
  20. __title = 'Edit franchises — ' + appTitle
  21. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'
  22. // stage is there this page says so instead of showing half a map
  23. warming = !warmReady('all')
  24. warmNote = warming ? warmText() : ''
  25. View {
  26. franchiseEditPage {
  27. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  28. h1 { "Edit franchises" }
  29. if (notEditor) { p { id = "edit-refused" class = "muted" "Only the creator can edit franchises and timelines." } }
  30. if (isEditor) {
  31. if (hasMessage) { p { id = "edit-message" class = "message" message } }
  32. editSection {
  33. h2 { class = "film-heading" "New franchise" }
  34. input { id = "fe-name" type = "text" placeholder = "Name, e.g. Star Trek" autocomplete = "off" "aria-label" = "Franchise name" }
  35. textarea { id = "fe-summary" rows = "3" placeholder = "A few words about it (optional)" "aria-label" = "Franchise summary" }
  36. button { id = "fe-create" type = "button" class = "primary" "Create franchise" on click(e) { emit newFranchise(e) } }
  37. }
  38. editSection {
  39. h2 { class = "film-heading" "New timeline" }
  40. input { id = "te-name" type = "text" placeholder = "Name, e.g. Star Trek — Prime" autocomplete = "off" "aria-label" = "Timeline name" }
  41. button { id = "te-create" type = "button" class = "primary" "Create timeline" on click(e) { emit newTimeline(e) } }
  42. }
  43. editSection {
  44. h2 { class = "film-heading" "Edit a timeline" }
  45. input { id = "tl-find" type = "search" placeholder = "Timeline name" autocomplete = "off" "aria-label" = "Find a timeline" on input(e) { emit findTyped(e) } }
  46. if (hasFound) {
  47. timelineList { id = "tl-found"
  48. for (t of found) {
  49. a { class = "timeline-link" href = t.href
  50. timelineLinkName { t.name }
  51. timelineLinkCount { t.countText }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. on newFranchise(e) {
  61. r = emit server fedCreateFranchise(document.getElementById('fe-name').value, document.getElementById('fe-summary').value)
  62. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  63. navigate('/franchises/' + r.slug)
  64. }
  65. on newTimeline(e) {
  66. r = emit server fedCreateTimeline(document.getElementById('te-name').value)
  67. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  68. navigate('/timelines/' + r.slug + '/edit')
  69. }
  70. on findTyped(e) {
  71. v = e.target.value
  72. r = emit server fedFindTimelines(v)
  73. if (r == null || document.getElementById('tl-find').value != v) { return null }
  74. found = r.rows
  75. }
  76. // ---- the faces (unique names: hl:web dispatches by name across all files; the trailing `session` is the server's) ----
  77. on server fedCreateFranchise(name, summary, session) {
  78. if (!isEditorSession(session)) { return { error = 'only the creator can do that' } }
  79. return createFranchise(name, summary)
  80. }
  81. on server fedCreateTimeline(name, session) {
  82. if (!isEditorSession(session)) { return { error = 'only the creator can do that' } }
  83. return createTimeline(name)
  84. }
  85. // timeline names are public (/franchises lists them all) — no session needed
  86. on server fedFindTimelines(text) {
  87. return { rows = findTimelines(text) }
  88. }

Branches

Latest commits

  • 944ad51eSK: report reports/SK-sec.md, LOGsk
  • 415487c1SK: import budget per user + id type check, gate checkssk
  • 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
  • f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre
  • 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
  • 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
  • 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre
  • c87149e8tests/warmstart.mjs: the progressive start proven over HTTP (note in the window, 503 short id, after: everything); bootBeginmre
  • 593a6350boot: resumable start-up scan, the server listens first (T17)mre
  • be4890a0reports: H2 hydration audit (no test change needed)mre
  • 1f9c8bf4re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • c1df88eddocker-compose: HL_GC_TABLE_LOAD=62 (tracker mission 048, T16 real-data numbers)mre
  • d0a82867mission 048: report, LOG (HL_GC_TABLE_LOAD=62 measured)mre
  • 2d4be66fre-vendor Hybriel 5df4eb7e (GC: HL_GC_TABLE_LOAD knob, mission 406)mre
  • 99e7c8b9tests: realdata-m035-radii, repro-t38, realdata-060-backfill ports from env (REAL_PORT, REAL_CHROME, REPRO_CHROME), defaults unchangedmre
  • 4625aa22re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • a6dfd6ecdeploy: person-lookup gate (tracker#46)mre
  • 33ad4bd5Merge commit 'f57f64f'mre
  • 7d38cec4docker-compose: nofile 65536 (default soft 1024 refused boot: errno 24 in fs.listDir, Hybriel 528bc89f)mre
  • f57f64f0mission 046: report, LOGmre