gitoriaLog in with ident

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit836f644f836f644fident#24: installable app (manifest, service worker, data-free offline /start), own iconmre836f644f/components/main.hl

1.8 KB

  1. // components/main.hl — THE SHELL: the application header and the slot the page renders
  2. // into. All CSS is in styles.hl.
  3. import { siteName } from '../project.hl'
  4. slot = null
  5. // OFFLINE (mission 046): true while the shell's probe cannot reach ident (the header says so)
  6. noNetwork = false
  7. View {
  8. body {
  9. applicationHeader {
  10. a { class = "brand" href = "/" siteName }
  11. span { class = "tagline" "worldapi login" }
  12. nav {
  13. a { id = "navidentities" href = "/" "Identities" }
  14. a { id = "navinbox" href = "/inbox" "Inbox" }
  15. a { id = "navapps" href = "/apps" "Apps" }
  16. }
  17. if (noNetwork) { offlineNote { id = "offline" "Offline — ident needs the network to sign in and to save" } }
  18. }
  19. // THE NETWORK PROBE: a CSS animation (styles.hl `ident-net-probe`) starts half a second
  20. // after the page is up and repeats every 20 s; each start and repeat asks /api/online.
  21. // A View has no "mounted" event, and a probe that fired before the page is hydrated
  22. // would be lost, so the delayed animation is the trigger. No JavaScript of ours.
  23. netProbe { on animationstart(e) { emit probe(e) } on animationiteration(e) { emit probe(e) } }
  24. main { slot }
  25. script { src = "/avatar.js" }
  26. }
  27. }
  28. // the probe: no answer (or not ident's 204) = offline; the next repeat clears it again.
  29. // On `/start` (the installed app's start page, start.hl) an answer means: go on to `/`.
  30. on probe(e) {
  31. let r = window.__hlAttempt(() => { return fetch('/api/online', { cache = 'no-store' }) })
  32. noNetwork = !r.ok || r.value.status != 204
  33. if (!noNetwork && window.location.pathname == '/start') { window.location.replace('/') }
  34. }
  35. // "SIGN OUT EVERYWHERE" from another device or tab (home.hl signOutAll): the server pushes
  36. // this to every open page of the account (project.hl audience), which reloads into the
  37. // signed-out state at once — no click needed.
  38. on client signedOutAll(accountId) {
  39. window.location.reload()
  40. }

Branches

Latest commits

  • 836f644fident#24: installable app (manifest, service worker, data-free offline /start), own iconmre
  • 8bebbbf2deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • cc063ea2deploy.sh: never send .git or .gitignore to Byrodinmre
  • 81b15b7bState of 2026-09-27, before the move to gitoriamre