code wiki / _hdl_build / nx_project_serve.nx

nx_project_serve.nx

buildroot/runtime/_hdl_build/nx_project_serve.nx

30928 B738 linesdepth 16pulls 53 transitivereach 2 importersview sourcekind librarytopic project
docsdependenciesstructsconstsfunctions

about

nx_project_serve.nx -- the /project GATEWAY core (pure request->response; sockets live in the _daemon wrapper, the gate drives THIS core with real tokens and no sockets -- the relate_serve idiom). Sits behind the sites.elf proxy row `nishifamily.com /project 8028 gated` (fail-closed 302 on down). Per request: resolve the OPAQUE no-cookie X-Nishi-Session token -> uid (olg_whoami, realm nishi_site_admin, the SAME keys/store the /login minter uses) -> handle (uid-hex over the login daemon's index file) -> person (data-driven map rows in serve.conf) -> the ROLE-SCOPED project page via pj_html_build (owner/team all tasks, contractor own-only, non-member 403 DENY -- fail-closed). Token-less top-level navigation -> the sessionStorage bootstrap (a bare 302 would loop: no-cookie navs carry no header). Present-but-invalid token -> 302 /login. /project/demo -> the public demo tenant. serve.conf (hot, per-request): `store <prefix>` `pid <id>` `demo <person>` `map <handle> <person>`. license_tier: ORIGINAL

dependencies 4 imports · 2 importers

nx_opaque_login.nx nx_hub_gw_decide.nx nx_site_lock_lib.nx nx_project.nx nx_project_serve.nx nx_project_serve_daemon.nx nx_project_serve_gate.nx

imports: nx_opaque_login.nxnx_hub_gw_decide.nxnx_site_lock_lib.nxnx_project.nx

imported by: nx_project_serve_daemon.nxnx_project_serve_gate.nx

structs

none

consts

16const PSV_MAGIC_719468: i64 = 719468
17const PSV_MAGIC_146097: i64 = 146097
18const PSV_MAGIC_146096: i64 = 146096
19const PSV_MAGIC_1460: i64 = 1460
20const PSV_MAGIC_36524: i64 = 36524
21const PSV_MAGIC_86400: i64 = 86400
22const PSV_MAGIC_65536: i64 = 65536
23const PSV_MAGIC_8192: i64 = 8192
24const PSV_MAGIC_262144: i64 = 262144
25const PSV_MAGIC_1024: i64 = 1024
26const PSV_MAGIC_16384: i64 = 16384
27const PSV_MAGIC_131072: i64 = 131072
28const PSV_MAGIC_16400: i64 = 16400
29const PSV_MAGIC_16383: i64 = 16383
31const PSV_BOOTSTRAP: *u8 = "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'><title>Nishi Project</title></head><body><script>(function(){var t=sessionStorage.getItem('nsess');if(!t){location='/login?return=/project';return}fetch(location.pathname,{headers:{'X-Nishi-Session':t}}).then(function(r){return r.ok?r.text():null}).then(function(x){if(x){document.open();document.write(x);document.close()}else{location='/login?return=/project'}})})();</script></body></html>"
32const PSV_DENY: *u8 = "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'><title>Nishi Project - no access</title></head><body><h1>Not a member of this project</h1><p>Your login is valid, but this account has no membership record on the project. Ask the project owner to add you.</p><p><a href='/login'>switch account</a></p></body></html>"

functions

35func ps_read_file(path: *u8, out: *u8, cap: i64) -> i64
called by 1: psv_handle calls 1: sys_read
52func ps_hex(dst: *u8, off: i64, src: *u8, n: i64) -> i64
67func ps_idx_lookup(idxbuf: *u8, idxlen: i64, uidhex: *u8, uxn: i64, out_h: *u8) -> i64
93func ps_conf_pair(b: *u8, n: i64, key: *u8, out1: *u8, out2: *u8) -> i64
called by 1: psv_handle calls 2: pj_tokpj_eq
121func ps_proj_store(b: *u8, n: i64, pid: *u8, out: *u8, cap: i64) -> i64
called by 1: psv_handle calls 2: pj_tokpj_eq
151func ps_pid_ok(s: *u8) -> i64
called by 1: psv_handle
170func ps_picker(confbuf: *u8, cl: i64, person: *u8, hb: *u8) -> i64
220func ps_map(b: *u8, n: i64, handle: *u8, out: *u8, cap: i64) -> i64
called by 1: psv_handle calls 2: pj_tokpj_eq
257func ps_civil(z0: i64, out: *i64) -> i64
called by 1: ps_today
277func ps_today(out: *u8) -> i64
297func ps_resp(resp: *u8, status: *u8, ctype: *u8, body: *u8, blen: i64) -> i64
called by 2: ps_textpsv_handle calls 2: pj_catpj_catn
311func ps_redirect(resp: *u8, loc: *u8) -> i64
called by 1: psv_handle calls 1: pj_cat
319func ps_text(resp: *u8, status: *u8, msg: *u8) -> i64
called by 1: psv_handle calls 2: ps_resppj_slen
325func psv_st_new(ctx: *NxAuthContext, confpath: *u8, idxpath: *u8) -> *i64
347func psv_handle(st: *i64, req: *u8, rn: i64, resp: *u8) -> i64
423func psv_req(dst: *u8, path: *u8, tok: *u8) -> i64
called by 1: psv_selftest calls 1: pj_cat
437func psv_selftest() -> i64
675func psv_daemon(argc: i64, argv: *i64) -> i64