code wiki / _hdl_build / nx_js_urlfold_gate.nx
nx_js_urlfold_gate.nx source
↩ module page · 70 lines · 4536 B
1import "nx_gate_gn.nx"
2import "nx_gate_base.nx"
3// nx_js_urlfold_gate.nx -- SOVEREIGN referee for the JS constant/template URL folder. Feeds the ACTUAL
4// lustgoddess.com Unity-loader constant pattern (FALLBACK_HOST + BUILD_PATH -> host -> baseUrl -> scriptsBaseUrl
5// -> `${baseUrl}/rc/..css` / `${scriptsBaseUrl}/script_loader.js`) and proves the folder reconstructs the real
6// asset URLs by READING -- no JS execution. Liar-kill: a template referencing an UNDEFINED var must NOT fold to
7// a garbage URL. GREEN iff 4/4. license_tier: ORIGINAL expect_exit: 0
8import "nx_syscalls.nx"
9import "nx_js_urlfold.nx"
10import "nx_gate_verdict.nx"
11
12func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
13" as *u8); return ok }
14// is `needle` among the emitted urls (obuf/ooff/olen, n)?
15func g_among(obuf: *u8, ooff: *i64, olen: *i64, n: i64, needle: *u8) -> i64 {
16 var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1}
17 var i: i64=0
18 while i<n { if olen[i]==nl { var eq: i64=1; var k: i64=0; while k<nl { if obuf[ooff[i]+k]!=needle[k] { eq=0; k=nl } else { k=k+1 } } if eq==1 { return 1 } } i=i+1 }
19 return 0
20}
21// does any emitted url CONTAIN `needle` (substring)?
22func g_any_has(obuf: *u8, ooff: *i64, olen: *i64, n: i64, needle: *u8) -> i64 {
23 var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1}
24 if nl==0 { return 0 }
25 var i: i64=0
26 while i<n {
27 var j: i64=0
28 while j + nl <= olen[i] { var m: i64=1; var k: i64=0; while k<nl { if obuf[ooff[i]+j+k]!=needle[k] { m=0; k=nl } else { k=k+1 } } if m==1 { return 1 } j=j+1 }
29 i=i+1
30 }
31 return 0
32}
33
34func main() -> i64 {
35 gw("js-urlfold SOVEREIGN gate (reconstruct Unity-loader asset URLs from string constants, no JS exec)\n" as *u8)
36 // the real loader constant chain (BUILD_PATH is newline-terminated -- no semicolon -- exactly like the site)
37 let js: *u8 = "const FALLBACK_HOST = 'client.chickgoddess.com'; const BUILD_PATH = 'release_builds/2026_07_06_14_54'\x0alet host = FALLBACK_HOST; const baseUrl = \x60https://${host}/${BUILD_PATH}\x60; const scriptsBaseUrl = \x60${baseUrl}/scripts\x60; var css = \x60${baseUrl}/rc/adultwars_style.css\x60; var js1 = \x60${scriptsBaseUrl}/script_loader.js\x60; const UNK = \x60${MISSING}/nope.js\x60;" as *u8
38 var jl: i64=0; while js[jl]!=(0 as u8){jl=jl+1}
39
40 let obuf: *u8 = sys_mmap(65536)
41 let ooff: *i64 = sys_mmap(8*256) as *i64
42 let olen: *i64 = sys_mmap(8*256) as *i64
43 let n: i64 = nx_js_fold_urls(js, jl, obuf, ooff, olen, 256)
44 gw(" folded n=" as *u8); gn(n); gw(" :\n" as *u8)
45 var d: i64=0
46 while d<n { let bp: *u8=((obuf as i64)+ooff[d]) as *u8; gw(" " as *u8); sys_write(1,bp,olen[d]); gw("\n" as *u8); d=d+1 }
47 var pass: i64=0
48
49 // T1 reconstructed CSS asset URL
50 pass = pass + grow("T1 baseUrl+`/rc/..css` -> full CSS asset URL reconstructed\x00" as *u8, g_among(obuf, ooff, olen, n, "https://client.chickgoddess.com/release_builds/2026_07_06_14_54/rc/adultwars_style.css" as *u8))
51 // T2 reconstructed JS loader URL (2-level: scriptsBaseUrl -> baseUrl -> host+BUILD_PATH)
52 pass = pass + grow("T2 scriptsBaseUrl+`/script_loader.js` -> full JS URL (transitive fold)\x00" as *u8, g_among(obuf, ooff, olen, n, "https://client.chickgoddess.com/release_builds/2026_07_06_14_54/scripts/script_loader.js" as *u8))
53 // T3 the base itself
54 pass = pass + grow("T3 baseUrl const resolved to full https base\x00" as *u8, g_among(obuf, ooff, olen, n, "https://client.chickgoddess.com/release_builds/2026_07_06_14_54" as *u8))
55 // T4 liar-kill: UNK references undefined MISSING -> must NOT fold to a garbage URL
56 var t4: i64 = 0
57 if g_any_has(obuf, ooff, olen, n, "nope.js" as *u8) == 0 { if g_any_has(obuf, ooff, olen, n, "MISSING" as *u8) == 0 { t4 = 1 } }
58 pass = pass + grow("T4 liar-kill: unresolved `${MISSING}/nope.js` NOT emitted\x00" as *u8, t4)
59
60 gw("pass=" as *u8); gn(pass); gw("/4\n" as *u8)
61 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check
62 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled
63 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify.
64 let ctr__dry: *i64 = gv_ctr()
65 ctr__dry[0] = pass
66 ctr__dry[1] = 4
67 let rc__dry: i64 = gv_verdict("JS-URLFOLD-GATE" as *u8, ctr__dry, "sovereign JS URL folder: constants+templates reconstructed, no execution)" as *u8)
68 sys_exit(rc__dry)
69 return rc__dry
70}