code wiki / _hdl_build / nx_onsite_api.nx

nx_onsite_api.nx

buildroot/runtime/_hdl_build/nx_onsite_api.nx

8749 B167 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind servicetopic onsite
docsdependenciesstructsconstsfunctions

about

nx_onsite_api.nx -- the SAME-ORIGIN HTTP face of the reusable onsite search, so <nishi-embed> can actually search in a real browser. Two routes: GET / -> the <nishi-embed> demo page (web_assets/nishi_embed_demo.html) GET /api/onsite?site=&q= -> {"items":[{"url":..,"title":..}]} (what <nishi-embed> consumes) Search REUSES the proven client (/tmp/nx_onsite_search.sov.elf) by fork+exec over the sites registry (knowledge/index/onsite_sites.tsv) -- ZERO search reimplementation; the daemon just wraps it as JSON. Page + API are the SAME origin (the embed's same-origin, credentials-omitted fetch = no cross-origin, no tracking). Usage: nx_onsite_api [port] (default 8096). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_onsite_api.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap sys_socket sys_setsockopt sys_bind sys_listen sys_write oa_strlen sys_accept sys_fork sys_close sys_read oa_find oa_strlen ↻ oa_param oa_strlen ↻ oa_search sys_fork ↻ sys_openat_wr sys_dup3 sys_mmap ↻ oa_strlen ↻ sys_execve_clean sys_close ↻ sys_execve sys_exit sys_wait4 sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻ oa_to_json oa_cat oa_cat ↻ oa_u sys_mmap ↻ sys_exit ↻

structs

none

consts

10const OA_MAGIC_8096: i64 = 8096
11const OA_MAGIC_16384: i64 = 16384
12const OA_MAGIC_262144: i64 = 262144
14const OA_REG: *u8 = "knowledge/index/onsite_sites.tsv" as *u8
15const OA_PAGE: *u8 = "web_assets/nishi_embed_demo.html" as *u8

functions

17func oa_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i }
called by 2: oa_to_jsonmain
18func oa_u(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var o: i64=off; var i: i64=0; while i<k{dst[o]=t[k-1-i];o=o+1;i=i+1} return o }
called by 1: main calls 1: sys_mmap
19func oa_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
22func oa_param(req: *u8, rn: i64, key: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 1: oa_strlen
72func oa_to_json(body: *u8, bo0: i64, out: *u8, n: i64) -> i64
called by 1: main calls 1: oa_cat
109func oa_find(req: *u8, rn: i64, pat: *u8) -> i64
called by 1: main calls 1: oa_strlen
115func main(argc: i64, argv: *i64) -> i64