code wiki / _hdl_build / nx_reader_library.nx

nx_reader_library.nx

buildroot/runtime/_hdl_build/nx_reader_library.nx

10357 B195 linesdepth 3pulls 3 transitivereach 9 importersview sourcekind librarytopic reader
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_reader_zoomserve.nx nx_reader_library.nx nx_manga_add.nx nx_manga_get.nx nx_media_import.nx nx_media_server.nx nx_reader_library_gate.nx nx_reader_list_test.nx

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

17const RL_PIDX_PRE: *u8 = "knowledge/staging/media/idx_book_personal_" // + <ukey> + ".wsl"

functions

19func rl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
23func rl_personal_slug(ukey: *u8, name: *u8, out: *u8) -> i64
34func rl_personal_slug_dir(ukey: *u8, name: *u8, out: *u8) -> i64
41func rl_personal_index(ukey: *u8, out: *u8) -> i64
49func rl_read(path: *u8, buf: *u8, cap: i64) -> i64
62func rl_slug_guard(req_ukey: *u8, slug: *u8) -> i64
79func rl_may_access(req_ukey: *u8, rel: *u8) -> i64
97func rl_add_personal(ukey: *u8, name: *u8, title: *u8, title_n: i64) -> i64
131func rl_list_personal_json(ukey: *u8, out: *u8, cap: i64) -> i64
172func rl_promote_to_shared(req_ukey: *u8, full_slug: *u8) -> i64