gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitebda0fd1ebda0fd1calendar mission 008 (A7): server-side reminder plan on hl:time (push-plan.hl; hl:time fromLocal in a browser static is refused: repro .scratch/hltime-client), push gate 9/9mreebda0fd1/project.hl

4.3 KB

  1. // project.hl — calendar.worldapi.org: THE MAP. Config, routes and WHO HEARS WHAT. Hybriel on hl:web.
  2. // The month view at `/` (ticket #1); login with ident and the user's private events (ticket #2).
  3. //
  4. // WHERE WHAT IS (README "Files"):
  5. // events, every write to events.db, the faces' answers lib/events.hl (+ lib/events-helpers.hl)
  6. // the default reminders (settings.db) lib/settings.hl
  7. // users, the ident exchange, both logins' user step lib/users.hl
  8. // /login/callback lib/api.hl (+ lib/api-helpers.hl)
  9. // env, table folder, lists, id checks lib/util.hl
  10. // the page shell, login/logout faces components/main.hl
  11. // `/` and the event faces, /login/failed, all CSS components/calendar.hl, loginfailed.hl, styles.hl
  12. // Web Push: subscriptions + the clock that sends lib/push.hl (faces calPushSave / calPushOff in calendar.hl)
  13. // the month view (UI, dates, names, reminders, clock) components/month-view/
  14. import WebFramework from 'hl:web'
  15. import { env } from 'hl:proc'
  16. import Styles from './components/styles.hl'
  17. import { dark, darker } from './shared/tokens.hl'
  18. import { tagOf } from './lib/users.hl'
  19. import { loginCallback } from './lib/api.hl'
  20. import Calendar from './components/calendar.hl'
  21. import LoginFailed from './components/loginfailed.hl'
  22. import Push from './lib/push.hl'
  23. import { envOr } from './lib/util.hl'
  24. static siteName = "Calendar"
  25. appTitle = siteName
  26. appThemeColor = darker.value
  27. appBackgroundColor = dark.value
  28. appIcons = [
  29. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'any' }
  30. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'any' }
  31. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'maskable' }
  32. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'maskable' }
  33. ]
  34. offline = [ Calendar ]
  35. styles = Styles
  36. routes = [
  37. { pattern = "/favicon.ico" direct = "" }
  38. // the login button's return writes the session: the request and the store go BY REFERENCE (lib/api.hl)
  39. { pattern = "/login/callback" function = (route, req) => { return loginCallback(route, &req, &server.sessions) } }
  40. { pattern = "/login/failed" component = LoginFailed }
  41. { pattern = "/login.js" file = "./login.js" headers = { 'Cache-Control' = 'no-cache' } }
  42. // the installable app (ticket #3): the icons (manifest and service worker are hl:web's own, from appIcons / offline)
  43. { pattern = "/icons/icon-192.png" file = "./icons/icon-192.png" headers = { 'Cache-Control' = 'no-cache' } }
  44. { pattern = "/icons/icon-512.png" file = "./icons/icon-512.png" headers = { 'Cache-Control' = 'no-cache' } }
  45. { pattern = "/" component = Calendar }
  46. ]
  47. // WHO GETS THE PUSH: the login state reaches the tabs of one session.
  48. // `calendarSignedIn` / `calendarSignedOut` go to the tabs of ONE session: the one whose login carries that random tag.
  49. audience = {
  50. calendarSignedIn = (tag, session) => { return tag != null && tagOf(session) == tag }
  51. calendarSignedOut = (tag, session) => { return tag != null && tagOf(session) == tag }
  52. }
  53. sessionDir = env('CALENDAR_SESSIONS') != null ? env('CALENDAR_SESSIONS') : null
  54. port = env('CALENDAR_PORT') != null ? toNumber(env('CALENDAR_PORT')) : 8380
  55. // HL_HOST = the interface hl:web binds: 127.0.0.1 on Byrodin behind nginx; unset = 0.0.0.0 (dev on Loreana).
  56. // CALENDAR_WATCH=0 = no dev watcher.
  57. watching = env('CALENDAR_WATCH') != '0'
  58. // The session idles out after the 14 days of sessionMaxAge, not after 15 minutes.
  59. sessionCookie = 'calendarsid'
  60. sessionIdle = 1209600
  61. // WEB PUSH (calendar#9): the VAPID key pair and contact, all three or none (tools/vapid-keys.hl makes the pair; README "Web Push").
  62. // Unset = no push: the page still shows reminders while it is open.
  63. pushPublic = envOr('CALENDAR_PUSH_PUBLIC', '')
  64. pushPrivate = envOr('CALENDAR_PUSH_PRIVATE', '')
  65. pushContact = envOr('CALENDAR_PUSH_SUBJECT', '')
  66. pushOn = pushPublic != '' && pushPrivate != '' && pushContact != ''
  67. // the sender's clock lives on an INSTANCE of lib/push.hl
  68. push = new Push()
  69. server = new WebFramework(routes = routes, styles = styles, minify = true, port = port, watchMode = watching, sessionCookie = sessionCookie, pushKey = pushOn ? pushPublic : null, pushPrivateKey = pushOn ? pushPrivate : null, pushSubject = pushOn ? pushContact : null)
  70. on Error(e) { console.log('error absorbed: ' + e.message) }

Branches

Latest commits

  • ebda0fd1calendar mission 008 (A7): server-side reminder plan on hl:time (push-plan.hl; hl:time fromLocal in a browser static is refused: repro .scratch/hltime-client), push gate 9/9mre
  • d063dad3calendar mission 008 (A7): Web Push (WIP): lib/push.hl subscriptions + sender clock, faces calPushSave/calPushOff, button subscribes, VAPID tool, tests/push.mjs; instantOf on hl:timemre
  • cf175c80calendar mission 008 (A7): re-vendor Hybriel master 0e3c9830 (bin 9d957fed, plugins whole: hl:crypto Web Push primitives, hl:web sendPush)mre
  • 9bf3c38bcalendar mission 008: re-vendor Hybriel f9833544 (gates old = new); Web Push stopped: hl:crypto half missing on mastermre
  • 186f969bcalendar mission 007: signed-in gate for the first-pointer race (fails on 3c5604f), README theme section, reportmre
  • ba9b4955calendar mission 006: first pointer event no longer re-runs the month (stale overwrite race), gate check, e2e settings cleanup, reportmre
  • bd730759calendar mission 006: theme move (WIP): brief, report, LOG, STATUSmre
  • b117b153calendar mission 006 WIP: reminder row fields keep 44 px; e2e script flagsmre
  • 53e3b0debrowser gate: Log out through the user menu, theme colour rgb(15, 20, 25)mre
  • 90bf9e2ecalendar mission 006 WIP: theme dbe3de7, theme shell (AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst), styles cut to the app's own rules, check-theme gate, e2e toolsmre
  • 3c5604f9identkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
  • 4996bbe7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • f5bf0803calendar mission 004: re-vendor Hybriel to the shared static build 0f396652; compose cache volume + tmpfs; notify-paths gate in deploy.sh; gate start waits 150 s; reportmre
  • eb86526fmission brief 004mre
  • 2f953b16deploy.sh: wait up to DEPLOY_URL_WAIT (120 s) for 200 after the restart, as the other apps (cold compile, hybriel#148)mre
  • 9078e1b7calendar mission 003 (2/2): report, LOG, STATUS (cause: timers only in an open, front, touched page; gate old 5/2 new 7/0; Hybriel gaps Web Push + page-shown hook, STOP)mre
  • 31ffe910calendar mission 003 (1/2): calendar#9 — missed reminders shown when the app is back, timers set again when it is shownmre
  • 26c997d3mission brief 003mre
  • c6809c76calendar mission 002: report, LOG, STATUS (test bug; fixed gate 78/0 at 00:30 05:40 12:00 19:59 20:01; 23:30 not run, quota stop)mre
  • 00f72783calendar mission 002 (2/2): TEST bug — the reminder steps get their own identity (carol): alice's all-day Vacation (20th-22nd) from the events steps added 2 reminders from the 12th 20:00 to the 19th 23:00; Tokyo check no longer skipped in the Tokyo eveningmre