gitoria

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchw7eeaea980report 007: say which runs included the removed checkmrew7/project.hl

5.7 KB

  1. // project.hl — notes.worldapi.org: THE MAP. Config, routes and WHO HEARS WHAT. Hybriel on hl:web.
  2. // Notes with an ident login (ticket notes#1): a sidebar of the user's notes (subject = first line, last edited
  3. // first) and the selected note on the right, edited with <md-editor> (shared/md-editor.js, vendored from
  4. // worldapi-components). Saved on the server in storage/mpackdb/; kept offline in the browser by hl:web (tickets
  5. // notes#2, notes#4: `offline` below — no JavaScript of our own).
  6. //
  7. // WHERE WHAT IS (README "Files"):
  8. // notes, their sync rules, every write to notes.db lib/notes.hl (+ lib/notes-helpers.hl)
  9. // users, the ident exchange, both logins' user step lib/users.hl
  10. // /login/callback, /api/me, /api/notes lib/api.hl (+ lib/api-helpers.hl, lib/jsoncheck.hl)
  11. // env, table folder, lists, id checks lib/util.hl
  12. // the page shell, login/logout faces components/main.hl
  13. // the notes page (list, editor, offline + sync faces) components/notes.hl
  14. // /login/failed, all CSS components/loginfailed.hl, styles.hl
  15. // the ident selector bridge (ident's custom event) login.js
  16. import WebFramework from 'hl:web'
  17. import { env } from 'hl:proc'
  18. import Styles from './components/styles.hl'
  19. import { tagOf, userIdOfSession } from './lib/users.hl'
  20. import { loginCallback, apiMe, apiNotes } from './lib/api.hl'
  21. import { dark, darker } from './shared/tokens.hl'
  22. import Notes from './components/notes.hl'
  23. import LoginFailed from './components/loginfailed.hl'
  24. static siteName = "notes"
  25. appTitle = siteName
  26. // ---- THE INSTALLABLE APP (mission 046), as calendar.worldapi.org / tracker do it: hl:web's own web app manifest
  27. // (/__hl/manifest.webmanifest, linked from every head with the apple-touch-icon and theme-color) from these settings.
  28. // Icons in icons/ (icon.svg is the source, the PNGs are rendered from it with rsvg-convert, README "PWA"). The theme
  29. // colour is the header's background (darker), the splash background the page's (dark) — both off the tokens.
  30. // OFFLINE (notes#4): `offline = [Notes]` below makes hl:web register its generated service worker (/__hl/sw.js), keep
  31. // the page's state per user in the browser and queue the saves made without a network.
  32. appThemeColor = darker.value
  33. appBackgroundColor = dark.value
  34. appIcons = [
  35. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'any' }
  36. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'any' }
  37. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'maskable' }
  38. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'maskable' }
  39. ]
  40. appTouchIcon = '/icons/apple-touch-icon.png'
  41. appFavicon = '/icons/favicon.svg'
  42. styles = Styles
  43. routes = [
  44. { pattern = "/favicon.ico" file = "./icons/favicon.ico" headers = { 'Cache-Control' = 'no-cache' } }
  45. // the installable app (mission 046): the icons (the manifest is hl:web's own, from appIcons)
  46. { pattern = "/icons/icon-192.png" file = "./icons/icon-192.png" headers = { 'Cache-Control' = 'no-cache' } }
  47. { pattern = "/icons/icon-512.png" file = "./icons/icon-512.png" headers = { 'Cache-Control' = 'no-cache' } }
  48. { pattern = "/icons/apple-touch-icon.png" file = "./icons/apple-touch-icon.png" headers = { 'Cache-Control' = 'no-cache' } }
  49. { pattern = "/icons/favicon.svg" file = "./icons/favicon.svg" headers = { 'Cache-Control' = 'no-cache' } }
  50. // the login button's return writes the session: the request and the store go BY REFERENCE (lib/api.hl)
  51. { pattern = "/login/callback" function = (route, req) => { return loginCallback(route, &req, &server.sessions) } }
  52. { pattern = "/login/failed" component = LoginFailed }
  53. { pattern = "/login.js" file = "./login.js" headers = { 'Cache-Control' = 'no-cache' } }
  54. // the Markdown editor <md-editor>, vendored from worldapi-components (one <script> in the shell would do too:
  55. // it is loaded by the page component's parent, see components/main.hl)
  56. { pattern = "/md-editor.js" file = "./shared/md-editor.js" headers = { 'Cache-Control' = 'no-cache' } }
  57. // the JSON API (ticket notes#2, lib/api.hl) — the page itself syncs through its faces (components/notes.hl)
  58. { pattern = "/api/me" function = apiMe }
  59. { pattern = "/api/notes" function = apiNotes }
  60. { pattern = "/" component = Notes }
  61. { pattern = "/note/:id" component = Notes }
  62. ]
  63. // OFFLINE (notes#4, hl:web COMPONENTS §10): the notes page is kept — the service worker, its state per user, the queue
  64. offline = [Notes]
  65. // WHO GETS THE PUSH: the login state reaches the tabs of one session; a user's notes reach every tab of that user.
  66. // `notesSignedIn` / `notesSignedOut` go to the tabs of ONE session: the one whose login carries that random tag.
  67. // `notesChanged(user, list)` goes to every tab signed in as `user` (components/notes.hl, after each save or delete).
  68. audience = {
  69. notesChanged = (user, list, session) => { return user != null && userIdOfSession(session) == user }
  70. notesSignedIn = (tag, session) => { return tag != null && tagOf(session) == tag }
  71. notesSignedOut = (tag, session) => { return tag != null && tagOf(session) == tag }
  72. }
  73. sessionDir = env('NOTES_SESSIONS') != null ? env('NOTES_SESSIONS') : null
  74. port = env('NOTES_PORT') != null ? toNumber(env('NOTES_PORT')) : 8710
  75. // HL_HOST = the interface hl:web binds: 127.0.0.1 on Byrodin behind nginx; unset = 0.0.0.0 (dev on Loreana).
  76. // NOTES_WATCH=0 = no dev watcher. The session cookie is `notessid` (hybriel #10). A note taker is not logged
  77. // out after 15 minutes of thinking: the session idles out after the 14 days of sessionMaxAge.
  78. watching = env('NOTES_WATCH') != '0'
  79. sessionCookie = 'notessid'
  80. sessionIdle = 1209600
  81. server = new WebFramework(routes = routes, styles = styles, minify = true, port = port, watchMode = watching, sessionCookie = sessionCookie)
  82. on Error(e) { console.log('error absorbed: ' + e.message) }

Branches

Latest commits

  • eeaea980report 007: say which runs included the removed checkmre
  • 8a8ad9banotes mission 007: report, LOG, STATUSmre
  • 2cce9c96code order: plain declarations where never reassigned (letcount 0 never); gate: scan every IndexedDB at log-out, soft mode for old-code runs, drop a check that could not failmre
  • 7f6a4090README: offline in Hybriel (hl:web offline, continuation, known md-editor gap); gate waits report instead of crash; realdata-offline checkmre
  • 632223f2notes#4: delete notes-offline.js and sw.js (hl:web's generated worker and kept state replace them)mre
  • 52a2acadgate: offline checks on hl:web's worker/queue, Chrome offline via CDP (reload offline first), one-offline conflict, log-out forgets the kept copymre
  • e5785b03notes#4: the notes page in Hybriel — hl:web offline = [Notes], queued faces notesPut/notesDrop, push notesChanged, value-form notesPull on a tick; notes-offline.js/sw.js no longer loaded or routedmre
  • 510aff75notes#4: server continues a run of saves of one login (by + since), loser keeps writing into its copy; notesFor listmre
  • 0176c4b5mission brief 007mre
  • 06cfa870notes mission 006: re-vendor hybriel 0f396652 (static), reportmre
  • 6c07bd91mission brief w6mre
  • cf64d3d5notes mission 005: stopped at a Hybriel gap (for list repainted during hl:web boot throws, rowKidless); report, LOG, STATUSmre
  • a43b5d2dmission brief 005mre
  • 04a625edmission 004: re-vendor hybriel a832f73b (native bin + plugins as tickets), compose HL_CACHE_DIR volume + tmpfs /tmp, deploy URL wait 120 s, tests wait 120 s per start; gate 57/0 old and new; real-data same output. Not deployed.mre
  • aefb9d44mission brief w4mre
  • 202098b3docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
  • 304f6a9dnotes mission 003 (#5): report, STATUS, LOGmre
  • 9acc27f8notes mission 003 (#5): GitHub pipe tables in md-editor (parse, render, type, write) + gate checksmre
  • 2149e902notes mission 002 (4/4): code order — README file map + same-output test, STATUS, LOG, report; tests/letcount.py, tests/realdata-baseline.mjs, tests/realdata-compare.pymre
  • 47db4fc1notes mission 002 (3/4): code order — let only where reassigned (58 dropped; 34 left: 19 reassigned, 15 loop-bound); gates 50/0 + 18/0, live-data run = step 2mre