code wiki / _hdl_build / nx_cleanview.nx

nx_cleanview.nx

buildroot/runtime/_hdl_build/nx_cleanview.nx

11644 B169 linesdepth 22pulls 175 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_cleanview.nx -- one-shot CLI face of the ethical clean-serve engine, exposed as an MCP tool (nx_cleanview). TWO modes: nx_cleanview <url> -> the machine-readable SAFETY RECEIPT JSON (attacks neutralized + safe ads kept). nx_cleanview resolve <url> -> F108d: sovereign GUARDED JS-EXEC media resolution. Fetches the page over the SAME _best (Chrome-JA3) path clean-serve uses, then runs the page's inline JS through the guarded sniff (fork + CPU/mem cap, NO network in the child) to surface the runtime-constructed stream URL (VSK_HLS/DIRECT). This is the _best-HTML-passthrough integration design (do NOT re-fetch with a weaker path). External-<script src> _best-fetch enrichment = the next rung. Shares the daemon's exact clean core (cs_clean_page / cs_receipt_json) so the receipt can NEVER drift from /receipt. SSRF-guarded by construction (public http(s) only). Read-only, no persistent state, safe to fork-exec per call. license_tier: ORIGINAL

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_web_filter.nx nx_clean_serve.nx nx_video_sniff.nx nx_video_sniff_fetch.nx nx_cleanview.nx

imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_web_filter.nxnx_clean_serve.nxnx_video_sniff.nxnx_video_sniff_fetch.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 ncv_put ncv_write_all sys_write ncv_streq ncv_slen ncv_url_safe ncv_pfx_ci ncv_lc2 ncv_put ↻ ncv_putn sys_mmap ↻ ncv_write_all ↻ ncv_body_off sys_mmap ↻ vs_extract_script_srcs sys_mmap ↻ vs_ci_at vs_lc vs_script_src vs_ci_at ↻ nx_hls_resolve_uri hr_is_abs hls_find hls_slen hr_slen nx_hls_resolve_uri ↻ nx_hls_parse hls_starts hls_line_end hls_parse_dur_millis hls_find ↻ hls_parse_uint vs_sniff_page_bundled sys_mmap ↻ vs_extract_scripts vs_ci_at ↻ vs_sniff_guarded_dom sys_mmap_shared

structs

none

consts

21const NCV_MAGIC_8388608: i64 = 8388608
22const NCV_MAGIC_8192: i64 = 8192
23const NCV_MAGIC_8191: i64 = 8191
24const NCV_MAGIC_2560: i64 = 2560
25const NCV_MAGIC_65536: i64 = 65536
26const NCV_MAGIC_4194304: i64 = 4194304
27const NCV_MAGIC_1048576: i64 = 1048576
28const NCV_MAGIC_4000: i64 = 4000
66const NCV_SNIFF_CPU_SECS: i64 = 5
67const NCV_SRCCAP: i64 = 65536 // buffer for the extracted <script src> list
68const NCV_EXTCAP: i64 = 2097152 // concatenated external-bundle JS (2 MiB)
69const NCV_BUNCAP: i64 = 1048576 // one bundle response (1 MiB)
70const NCV_MAXSRC: i64 = 8 // fetch at most 8 external bundles (bounded; declared)

functions

31func ncv_put(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off]=s[i];off=off+1;i=i+1} return off }
called by 2: ncv_url_safemain
32func ncv_putn(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; if m==0 { dst[off]=48 as u8; return off+1 } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } var j: i64=0; while j<k { dst[off]=t[k-1-j]; off=off+1; j=j+1 } return off }
called by 2: ncv_url_safemain calls 1: sys_mmap
33func ncv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
34func ncv_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 }
called by 1: main
35func ncv_lc2(c: i64) -> i64 { if c>=65 { if c<=90 { return c+32 } } return c }
called by 1: ncv_pfx_ci
36func ncv_pfx_ci(s: *u8, sl: i64, p: *u8) -> i64 { var i: i64=0; while p[i]!=(0 as u8) { if i>=sl { return 0 } if ncv_lc2(s[i]&0xff)!=ncv_lc2(p[i]&0xff) { return 0 } i=i+1 } return 1 }
called by 1: ncv_url_safe calls 1: ncv_lc2
37func ncv_write_all(fd: i64, buf: *u8, n: i64) -> i64 { var off: i64=0; while off<n { let w: i64=sys_write(fd, ((buf as i64)+off) as *u8, n-off); if w<=0 { return off } off=off+w } return off }
called by 2: ncv_url_safemain calls 1: sys_write
39func ncv_body_off(buf: *u8, n: i64) -> i64
called by 2: ncv_url_safemain
44func ncv_url_safe(url: *u8, ulen: i64) -> i64
71func ncv_resolve(out: *u8, url: *u8, ulen: i64, store: *TrustStore) -> i64
135func main(argc: i64, argv: *i64) -> i64