gitoriaLog in with ident

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit47db4fc147db4fc1notes mission 002 (3/4): code order — let only where reassigned (58 dropped; 34 left: 19 reassigned, 15 loop-bound); gates 50/0 + 18/0, live-data run = step 2mre47db4fc1/lib/util.hl

1.6 KB

  1. // lib/util.hl — SMALL SHARED HELPERS (notes mission 002, code order): the environment, the table folder, lists and the
  2. // id checks. Each lives here once; the topic files import them.
  3. import { env } from 'hl:proc'
  4. // an environment variable (or `.env` beside project.hl), trimmed; unset or blank → fallback
  5. static envOr = (name, fallback) => {
  6. v = env(name)
  7. return v != null && v.trim() != '' ? v.trim() : fallback
  8. }
  9. // NOTES_STORAGE = the table directory (default ./storage/mpackdb, relative to project.hl)
  10. static storageDir = envOr('NOTES_STORAGE', './storage/mpackdb')
  11. static countOfList = (list) => {
  12. if (list == null) { return 0 }
  13. n = list.length
  14. return n == null ? 0 : n
  15. }
  16. static firstOf = (list) => { return countOfList(list) > 0 ? list[0] : null }
  17. // only lowercase hex (ident's one-time codes are 48 hex)
  18. static isHex = (s, max) => {
  19. if (s == null || hlTypeName(s) != 'String' || s.length == 0 || s.length > max) { return false }
  20. let i = 0
  21. while (i < s.length) {
  22. let c = s.charCodeAt(i)
  23. if (!((c >= 48 && c <= 57) || (c >= 97 && c <= 102))) { return false }
  24. i = i + 1
  25. }
  26. return true
  27. }
  28. // an identity id as ident answers it: its public SHORT ID since ident#23 (5 characters like `a68sz`: 2-9 and a-z),
  29. // before that the old per-app id (32 hex) — lower case letters and digits, at most 64 (mission 039; isHex refused `a68sz`)
  30. static isIdentId = (s) => {
  31. if (s == null || hlTypeName(s) != 'String' || s.length == 0 || s.length > 64) { return false }
  32. let i = 0
  33. while (i < s.length) {
  34. let c = s.charCodeAt(i)
  35. if (!((c >= 48 && c <= 57) || (c >= 97 && c <= 122))) { return false }
  36. i = i + 1
  37. }
  38. return true
  39. }

Branches

Latest commits

  • 47db4fc1notes mission 002 (3/4): code order — let only where reassigned (58 dropped; 34 left: 19 reassigned, 15 loop-bound); gates 50/0 + 18/0, live-data run = step 2mre
  • 3f8cb383notes mission 002 (2/4): code order — topics, map, thin wrappers: lib/util.hl, lib/notes(-helpers).hl, lib/users.hl (+userOfLoginCode, tagOf), lib/api(-helpers).hl; project.hl = map; login routes take &req/&sessions (failed-login reason now kept); dead notes#1 functions removed; gates 50/0 + 18/0mre
  • 8cda5412notes mission 002 (1/4): code order — files moved: lib/notes.hl, lib/users.hl, lib/jsoncheck.hl, components/styles.hl (imports only); gates 50/0 + 18/0, live-data run identicalmre
  • 47dad68bnotes: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 50/0 + 18/0mre
  • a4a2b2aeantcolony#40: tracker missions moved too — references to them in missions/reports/LOG.md updatedmre
  • 3dea0ef2notes: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gate 50/0mre
  • e27c7d71notes: Hybriel master 8efba065 (#126 GC by bytes, #48 lambda params copy; audit: nothing to fix; gate 50/0)mre
  • 124613b6antcolony#40: mission references point to the moved missionsmre
  • 1ca2f34dantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 2bebebdanotes: Hybriel master ff51cf46 (re-vendor round)mre
  • 3eff126dnotes#3: installable app (manifest + own icon/favicon; notes' own sw.js kept)mre
  • 9883c540deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • eee693b8deploy.sh: never send .git or .gitignore to Byrodinmre
  • c8904061State of 2026-09-27, before the move to gitoriamre