gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd6da2d02d6da2d02tests: delivery and migration gate ports from env (DELIVERY_GATE_PORT, DELIVERY_GATE_CHROME, MIGRATION_GATE_CHROME) — hard-coded 8700-8719 collided with a worker during deploymred6da2d02/lib/delivery-helpers.hl

2.5 KB

  1. // lib/delivery-helpers.hl — what lib/delivery.hl looks up: the local date, the clock (with the gates' test clock),
  2. // the two mails' subject and text. No table access. Statics only.
  3. import { now } from 'hl:time'
  4. import { env } from 'hl:proc'
  5. import { readFile, exists } from 'hl:fs'
  6. static NL = '
  7. '
  8. // where the mails' "open your inbox" link points (the container sets it; unset = no link)
  9. static publicUrl = env('IDENT_PUBLIC_URL') != null && env('IDENT_PUBLIC_URL') != '' ? env('IDENT_PUBLIC_URL') : null
  10. // THE CLOCK OF DELIVERY. IDENT_TEST_CLOCK (THE GATES ONLY, never set in the container) names a file holding an
  11. // epoch-ms instant: delivery then takes that as "now" — the gate moves it to Vienna's, New York's, Tokyo's 17:00, a
  12. // DST day. No file / no number in it = the real clock. Only delivery reads it; everything else keeps now().
  13. static clockFile = env('IDENT_TEST_CLOCK') != null && env('IDENT_TEST_CLOCK') != '' ? env('IDENT_TEST_CLOCK') : null
  14. static clockNow = () => {
  15. if (clockFile == null || !exists(clockFile)) { return now() }
  16. n = toNumber(('' + readFile(clockFile)).trim())
  17. return n == null ? now() : n
  18. }
  19. // a `local()` reading → 'YYYY-MM-DD'
  20. static pad2 = (n) => { return n < 10 ? '0' + n : '' + n }
  21. static dateOf = (l) => { return l.year + '-' + pad2(l.month) + '-' + pad2(l.day) }
  22. static plural = (n, one, many) => { return n == 1 ? '1 ' + one : n + ' ' + many }
  23. static indented = (text) => { return ' ' + text.replaceAll(NL, NL + ' ') }
  24. static entry = (r) => {
  25. head = '* ' + r.name + ' — ' + r.app + ' · ' + r.identity + (r.urgent ? ' (urgent)' : '')
  26. return head + NL + indented(r.text) + NL + (r.link != '' ? ' ' + r.link + NL : '')
  27. }
  28. static footer = () => {
  29. inbox = publicUrl != null ? 'Your inbox: ' + publicUrl + '/inbox' + NL : ''
  30. return '--' + NL + inbox + 'Which notifications are mailed is up to you: open an app in your ident inbox and switch them.' + NL
  31. }
  32. // THE DAILY MAIL: `rows` = lib/notify.hl pendingDaily, `date` = the user's local date
  33. static digestSubject = (rows, date) => { return 'ident: ' + plural(rows.length, 'notification', 'notifications') + ' (' + date + ')' }
  34. static digestText = (rows, date, zone) => {
  35. let t = 'Hi,' + NL + NL + 'your notifications for ' + date + ' (17:00, ' + zone + '):' + NL + NL
  36. for (r of rows) { t = t + entry(r) + NL }
  37. return t + footer()
  38. }
  39. // AN URGENT ONE, at once: `r` = one row as in the daily mail
  40. static urgentSubject = (r) => { return r.app + ': ' + r.name }
  41. static urgentText = (r) => { return 'Hi,' + NL + NL + 'an urgent notification:' + NL + NL + entry(r) + NL + footer() }

Branches

Latest commits

  • d6da2d02tests: delivery and migration gate ports from env (DELIVERY_GATE_PORT, DELIVERY_GATE_CHROME, MIGRATION_GATE_CHROME) — hard-coded 8700-8719 collided with a worker during deploymre
  • 7276a008ident mission 013: re-vendor Hybriel master f9614007 (#200, #202 mpackdb copy fix); gates and e2e rerunmre
  • e13e30c3ident mission 013: report, mission, repro, LOGmre
  • eff734f3ident mission 013: in-place sign-out also closes the code step (no leftover code form); checksmre
  • b7a61546ident mission 013: e2e — in-place main-menu mark kept as a known gapmre
  • 59b43d81ident mission 013: sign out everywhere keeps this browser's own (signed-out) session so the page goes on in placemre
  • 716e14ffident mission 013: browser gate — Bob signs out everywhere (no second code request)mre
  • 5885f1c9ident mission 013 step 2: stopgap reload removed (in-place sign-in/out reach the shell via emit, notices back, route-marked main menu), gates updatedmre
  • 734ac0a9ident mission 013 step 1: re-vendor Hybriel ce6f2e0a (plugins whole; bin/ is git-ignored)mre
  • b37875ccident mission 012 part 3: real-Chrome fixes (brand 44 px, identity form width), e2e walk, report, logmre
  • f989c2ebident mission 012: stopgap reload after in-place sign-in/sign-out (until hybriel#193), gates wait for cold start, welcome end reloadsmre
  • 443291d4ident mission 012: /start on its own shell (no account), browser gate 152/0, reportmre
  • 021dd0fcident mission 012: browser gate waits cold start (IDENT_COLD_MS), header selectors, e2e checks; shell events from a page do not reach it (probe), current not marked, account-bar link 44 pxmre
  • 97f77b07ident mission 012 (WIP): onto the layouts theme dbe3de7, shell on AppHeader/MainMenu/UserMenu/Sidebar + ContentFirst, styles cut, check-theme gatemre
  • 8e4f435bpaths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • fa288f63ident mission 011: report wording (Intl zone names)mre
  • 961fae01ident mission 011: report, LOG, STATUSmre
  • 65348039ident#7: delivery gate — console check split at the gate's own server restart (49 checks)mre
  • dfa7b783ident#7: README (Delivery, env, gate, files, data), deploy.sh runs tests/delivery.mjsmre
  • ab6331f4ident#7: tests/delivery.mjs — fake clock gate: Vienna/New York/Tokyo/UTC 17:00, urgent, mail off, restart, DST days, zone changemre