nx_archive_server.nx
buildroot/runtime/nx_archive_server.nx
about
nx_archive_server.nx -- sovereign localhost HTTP server for the time machine (R5 serve side). Binds 0.0.0.0:18801 (ARCSRV_PORT -- the bind DERIVES from that const, see below),
serves files under web_assets/ (path-traversal rejected), Content-Type by extension. "/" -> a landing page. Also
hosts the SUPERVISED do-not-recover blocklist: GET /blocklist renders it live from seg_store (justification +
per-entry action), GET /blocklist/approve?id=N and /blocklist/retract?id=N are the operator ACTIONS (flip status on
seg_store, then 303 back to /blocklist). Pending entries never block until approved here. Fetch stack. license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_blocklist_view.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
| 17 | const ARCSRV_PORT: i64 = 18801 |
| 18 | const K_MAGIC_8192: i64 = 8192 |
| 19 | const K_MAGIC_2048: i64 = 2048 |
| 20 | const K_MAGIC_2097152: i64 = 2097152 |
| 37 | const ARC_TOGGLE: *u8 = "<div style='position:fixed;top:0;right:0;z-index:99999;background:#111;color:#eee;font:13px system-ui;padding:6px 11px;opacity:.92;border-radius:0 0 0 8px'><label><input type=checkbox onchange='nxT(this.checked)'> enhanced</label></div><script>function nxT(on){var a=document.images,i;for(i=0;i<a.length;i++){var m=a[i];if(!m.getAttribute('data-nxo'))m.setAttribute('data-nxo',m.getAttribute('src'));var o=m.getAttribute('data-nxo');if(on){m.onerror=function(){this.onerror=null;this.src=this.getAttribute('data-nxo')};m.src=o+'.enh.png'}else{m.onerror=null;m.src=o}}}</script>" as *u8 |
| 49 | const AS_RECLEN_OFF: i64 = 16 |
| 50 | const AS_NAME_OFF: i64 = 19 |
| 51 | const AS_DIRBUF: i64 = 262144 |
| 52 | const AS_DT_DIR: i64 = 4 |
functions
| 22 | func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 23 | func ap(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { buf[off+i]=s[i]; i=i+1 } return off+i } called by 1: as_dirlist |
| 24 | func apn(buf: *u8, off: i64, v: i64) -> i64 { if v==0 { buf[off]=0x30 as u8; return off+1 } var m: i64=v; 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 o: i64=off; var q: i64=k-1; while q>=0 { buf[o]=t[q]; o=o+1; q=q-1 } return o } |
| 25 | func endswith(path: *u8, plen: i64, ext: *u8, elen: i64) -> i64 { if plen<elen { return 0 } var i: i64=0; while i<elen { if (path[plen-elen+i] as i64) != (ext[i] as i64) { return 0 } i=i+1 } return 1 } called by 1: ctype |
| 56 | func as_dirlist(path: *u8, req: *u8, pst: i64, pen: i64, out: *u8) -> i64 |
| 123 | func ctype(path: *u8, plen: i64) -> *u8 calls 1: endswith |
| 164 | func has_dotdot(buf: *u8, off: i64, len: i64) -> i64 { var i: i64=off; while i+1<off+len { if (buf[i] as i64)==0x2e { if (buf[i+1] as i64)==0x2e { return 1 } } i=i+1 } return 0 } |
| 166 | func path_eq(req: *u8, pst: i64, plen: i64, lit: *u8, litlen: i64) -> i64 { if plen!=litlen { return 0 } var i: i64=0; while i<litlen { if (req[pst+i] as i64)!=(lit[i] as i64) { return 0 } i=i+1 } return 1 } |
| 167 | func path_starts(req: *u8, pst: i64, plen: i64, lit: *u8, litlen: i64) -> i64 { if plen<litlen { return 0 } var i: i64=0; while i<litlen { if (req[pst+i] as i64)!=(lit[i] as i64) { return 0 } i=i+1 } return 1 } |
| 169 | func qid(req: *u8, qst: i64, qen: i64, idbuf: *u8) -> i64 |
| 181 | func main() -> i64 |