code wiki / _hdl_build / nx_onsite_api.nx
nx_onsite_api.nx
buildroot/runtime/_hdl_build/nx_onsite_api.nx
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
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
structs
| none |
consts
| 10 | const OA_MAGIC_8096: i64 = 8096 |
| 11 | const OA_MAGIC_16384: i64 = 16384 |
| 12 | const OA_MAGIC_262144: i64 = 262144 |
| 14 | const OA_REG: *u8 = "knowledge/index/onsite_sites.tsv" as *u8 |
| 15 | const OA_PAGE: *u8 = "web_assets/nishi_embed_demo.html" as *u8 |
functions
| 17 | func 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 } |
| 18 | func 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 } |
| 19 | func oa_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 22 | func oa_param(req: *u8, rn: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 48 | func oa_search(site: *u8, q: *u8, out_path: *u8) -> i64 |
| 72 | func oa_to_json(body: *u8, bo0: i64, out: *u8, n: i64) -> i64 |
| 109 | func oa_find(req: *u8, rn: i64, pat: *u8) -> i64 |
| 115 | func main(argc: i64, argv: *i64) -> i64 |