gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit875353c1875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre875353c1/lib/push-plan.hl

2.5 KB

  1. // lib/push-plan.hl — the SERVER's copy of reminders.hl `planBetween` / `missed` (calendar#9 part 2): the same rules, but the
  2. // instants come from hl:time `fromLocal` (the zone database of the server) instead of the browser's `Intl`, which the server
  3. // has not. NOT in reminders.hl because Hybriel refuses a static that calls hl:time `fromLocal` in a component's browser build
  4. // ("'viaStatic' is a static … whose initializer reaches 'instantOf', a name the realm 'client' … cannot bind"; repro
  5. // .scratch/hltime-client/, reported). When that works, delete this file and call reminders.hl with a zone.
  6. import { fromLocal } from 'hl:time'
  7. import { prevDay } from '../components/month-view/dates.hl'
  8. import { bodyOf, lateBodyOf } from '../components/month-view/reminders.hl'
  9. // 'YYYY-MM-DDTHH:MM:SS' in a zone → epoch ms
  10. static instantIn = (wall, zone) => {
  11. return fromLocal({ year = toNumber(wall.slice(0, 4)) month = toNumber(wall.slice(5, 7)) day = toNumber(wall.slice(8, 10)) hour = toNumber(wall.slice(11, 13)) minute = toNumber(wall.slice(14, 16)) }, zone)
  12. }
  13. // events { id title allDay startDate startTime place zone rows } → their reminders with sinceMs < at <= nowMs (an all-day event's
  14. // day is read in `deviceZone`)
  15. static dueBetween = (events, sinceMs, nowMs, deviceZone, todayText) => {
  16. out = []
  17. let i = 0
  18. while (i < events.length) {
  19. let ev = events[i]
  20. let zone = ev.allDay ? deviceZone : ev.zone
  21. let start = instantIn(ev.startDate + 'T' + (ev.allDay ? '00:00' : ev.startTime) + ':00', zone)
  22. let j = 0
  23. while (j < ev.rows.length) {
  24. let r = ev.rows[j]
  25. let at = 0
  26. if (r.unit == 'minutes') { at = start - toNumber(r.n) * 60000 }
  27. else if (r.unit == 'hours') { at = start - toNumber(r.n) * 3600000 }
  28. else {
  29. let day = ev.startDate
  30. let k = toNumber(r.n)
  31. while (k > 0) { day = prevDay(day) k = k - 1 }
  32. at = instantIn(day + 'T' + r.time + ':00', zone)
  33. }
  34. if (at > sinceMs && at <= nowMs) {
  35. out.push({ id = ev.id key = ev.id + ':' + at at = at start = start title = ev.title body = bodyOf(ev, r) late = lateBodyOf(ev, todayText) })
  36. }
  37. j = j + 1
  38. }
  39. i = i + 1
  40. }
  41. return out
  42. }
  43. // …of events that have not started yet, one per event (the newest of its reminders)
  44. static dueNow = (events, sinceMs, nowMs, deviceZone, todayText) => {
  45. all = dueBetween(events, sinceMs, nowMs, deviceZone, todayText)
  46. out = []
  47. let i = 0
  48. while (i < all.length) {
  49. let q = all[i]
  50. let newest = q.start > nowMs
  51. let j = 0
  52. while (j < all.length) {
  53. if (all[j].id == q.id && all[j].at > q.at) { newest = false }
  54. j = j + 1
  55. }
  56. if (newest) { out.push(q) }
  57. i = i + 1
  58. }
  59. return out
  60. }

Branches

Latest commits

  • 875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre
  • ce16a4efdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • f490bc8cdeploy: Web Push gate tests/push.mjs (PUSH_GATE_PORT)mre
  • 3af29fc8calendar mission 008 (A8): report, README, LOG, push-shots.mjsmre
  • f91f3663calendar mission 008 (A8): push only asked of the browser when the app has the VAPID settings (pushAvailable); real-FCM E2E scripts (push-real-app.mjs, push-real.mjs)mre
  • bf571badcalendar mission 008 (A8): Turn off on this device (unsubscribes the browser, server drops the device, choice kept), subscribe/refresh when the app is shown again; push gate part 3mre
  • 50985708calendar mission 008 (A7): Web Push report, README, mission, LOGmre
  • ee318774calendar mission 008 (A7): push-real.mjs, push sent log linemre
  • 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