gitoria

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2804f0d32804f0d3Merge branch 'iw-ident-widget'mre2804f0d3/lib/notes-helpers.hl

1.1 KB

  1. // lib/notes-helpers.hl — what lib/notes.hl looks up (notes mission 002, code order): the size limit, the tombstone
  2. // check, the version stamp and the copy mark of a conflict.
  3. import { now } from 'hl:time'
  4. static maxText = 200000
  5. static textError = (text) => {
  6. if (text == null || hlTypeName(text) != 'String') { return 'the note must be text' }
  7. if (text.length > maxText) { return 'the note is too long (at most ' + maxText + ' characters)' }
  8. return null
  9. }
  10. // alive = not deleted (gone == 0; the row of a deleted note stays as a tombstone)
  11. static isAlive = (n) => { return n != null && (n.gone == null || n.gone == 0) }
  12. // the version stamp of an edit made at `at` (the browser's clock): never in the future, always after `prev` —
  13. // so the sidebar order is the order the edits were really made in, and a version stamp is never reused
  14. static stampOf = (at, prev) => {
  15. t = now()
  16. cand = at > 0 && at < t ? at : t
  17. return cand > prev ? cand : prev + 1
  18. }
  19. // the line at the end of the version that lost a conflict (kept as a note of its own)
  20. static copyMark = '
  21. *(kept as a copy: this note was changed on two devices at once)*'

Branches

Latest commits

  • 2804f0d3Merge branch 'iw-ident-widget'mre
  • 52d8d242notes: e2e script checks Log out and the selector in the header instead of the user menumre
  • e5abf7b7notes header: the selector alone top right plus Log out as before the theme missions; the user icon is gonemre
  • a2e343aeident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
  • 7a889b82notes: MdEditor with the Table button, typed pipe rows and the theme's table look (components mt-tables); a table note is named by its header words; gate checks that fail on mainmre
  • b96c7f70theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
  • 6140e6a0sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • cb7e6469deploy: security gate (tests/security.mjs)mre
  • 774bf34bnotes security: CSRF guard on /api/notes, new session at login, Secure cookie, uploadMax 0, login rate limit, nosniff, face payload check; tests/security.mjs; SN reportmre
  • ef18a68fsync components.hybriel 214c318: MdEditor on a phone, two even toolbar rows of 44 px targets, label 15 px, table head 16 px (E2)mre
  • c37488b1MN report: alignment updatemre
  • 4fb35a0enotes mobile: Delete note and the delete row exactly on the editor's edges; gate asserts 1 pxmre
  • 91736270MN report and logmre
  • 15667425notes: delete confirmation buttons at most 12rem wide on the desktopmre
  • 8f7a6a95gate: MN phone checks (list header gutter, back gap, delete question)mre
  • 90c73ed3notes mobile: back link gapmre
  • 72bd4f83notes mobile: list header on the gutter, delete confirmation as a question + two equal buttons, Delete note under the editor edgemre
  • ba1e73f8notes: a sent edit is done once the server's version is not older, so a second writer's text shows in the first tab; gate: two writers both waysmre
  • c69ef9ebsync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
  • 2eb783f5sync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre