code wiki / _hdl_build / nx_reader_library.nx
nx_reader_library.nx
buildroot/runtime/_hdl_build/nx_reader_library.nx
about
nx_reader_library.nx -- R1 of the shared/personal LIBRARY arc (operator 2026-07-02: "the library should have a
shared area and a personal area so what i download or brad or kelli or jensen can have their privacy but i can
keep the family books in the main library"). Two tiers, both behind THE WALL, keyed by the AUTHENTICATED user
(sy_user_key from the auth handle -- identity is the auth layer's, never a client claim):
SHARED = the family library (existing idx_book.wsl over the NAS + extracted comics at reader/<slug>/, slugs
that do NOT start "u_"). Every authed user sees it. The owner PROMOTES a personal book here.
PERSONAL = a per-user PRIVATE book whose SLUG ITSELF carries the owner: "u_<ukey>_<name>", stored at
reader/u_<ukey>_<name>/. Because every reader route (open/zoomprep/book/pos/ann) keys off a single
slug, encoding the owner IN the slug means ALL of them work unchanged + one guard: a "u_"-prefixed
slug is reachable ONLY by the user whose ukey it carries. TRUE isolation BY CONSTRUCTION -- the slug
is the capability. Each user has a private index idx_book_personal_<ukey>.wsl (rows = full slugs).
LIB (fail-closed helpers + the isolation predicate); nx_reader_library_gate proves the isolation. Reuses zs_*.
license_tier: ORIGINAL
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_reader_zoomserve.nx
imported by: nx_manga_add.nxnx_manga_get.nxnx_media_import.nxnx_media_server.nxnx_reader_library_gate.nxnx_reader_list_test.nx
structs
| none |
consts
| 17 | const RL_PIDX_PRE: *u8 = "knowledge/staging/media/idx_book_personal_" // + <ukey> + ".wsl" |
functions
| 19 | func rl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 23 | func rl_personal_slug(ukey: *u8, name: *u8, out: *u8) -> i64 |
| 34 | func rl_personal_slug_dir(ukey: *u8, name: *u8, out: *u8) -> i64 |
| 41 | func rl_personal_index(ukey: *u8, out: *u8) -> i64 |
| 49 | func rl_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 62 | func rl_slug_guard(req_ukey: *u8, slug: *u8) -> i64 called by 5: ms_slug_guardedrl_may_accessrl_list_personal_jsonrl_promote_to_sharedmain calls 1: rl_slen |
| 79 | func rl_may_access(req_ukey: *u8, rel: *u8) -> i64 |
| 97 | func rl_add_personal(ukey: *u8, name: *u8, title: *u8, title_n: i64) -> i64 called by 3: mainmainmain calls 11: sys_mmaprl_personal_slugzs_slug_saferl_personal_slug_dirzs_mkdirrl_personal_index+5 |
| 131 | func rl_list_personal_json(ukey: *u8, out: *u8, cap: i64) -> i64 called by 4: mainms_handlemainmain calls 6: sys_mmaprl_personal_indexrl_readzs_appszs_slug_saferl_slug_guard |
| 172 | func rl_promote_to_shared(req_ukey: *u8, full_slug: *u8) -> i64 |