code wiki / _hdl_build / nx_js_urlfold_gate.nx
nx_js_urlfold_gate.nx source
↩ module page · 62 lines · 4155 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"
10
11func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
12" as *u8); return ok }
13// is `needle` among the emitted urls (obuf/ooff/olen, n)?
14func g_among(obuf: *u8, ooff: *i64, olen: *i64, n: i64, needle: *u8) -> i64 {
15 var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1}
16 var i: i64=0
17 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 }
18 return 0
19}
20// does any emitted url CONTAIN `needle` (substring)?
21func g_any_has(obuf: *u8, ooff: *i64, olen: *i64, n: i64, needle: *u8) -> i64 {
22 var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1}
23 if nl==0 { return 0 }
24 var i: i64=0
25 while i<n {
26 var j: i64=0
27 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 }
28 i=i+1
29 }
30 return 0
31}
32
33func main() -> i64 {
34 gw("js-urlfold SOVEREIGN gate (reconstruct Unity-loader asset URLs from string constants, no JS exec)\n" as *u8)
35 // the real loader constant chain (BUILD_PATH is newline-terminated -- no semicolon -- exactly like the site)
36 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
37 var jl: i64=0; while js[jl]!=(0 as u8){jl=jl+1}
38
39 let obuf: *u8 = sys_mmap(65536)
40 let ooff: *i64 = sys_mmap(8*256) as *i64
41 let olen: *i64 = sys_mmap(8*256) as *i64
42 let n: i64 = nx_js_fold_urls(js, jl, obuf, ooff, olen, 256)
43 gw(" folded n=" as *u8); gn(n); gw(" :\n" as *u8)
44 var d: i64=0
45 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 }
46 var pass: i64=0
47
48 // T1 reconstructed CSS asset URL
49 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))
50 // T2 reconstructed JS loader URL (2-level: scriptsBaseUrl -> baseUrl -> host+BUILD_PATH)
51 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))
52 // T3 the base itself
53 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))
54 // T4 liar-kill: UNK references undefined MISSING -> must NOT fold to a garbage URL
55 var t4: i64 = 0
56 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 } }
57 pass = pass + grow("T4 liar-kill: unresolved `${MISSING}/nope.js` NOT emitted\x00" as *u8, t4)
58
59 gw("pass=" as *u8); gn(pass); gw("/4\n" as *u8)
60 if pass == 4 { gw("verdict=GREEN (sovereign JS URL folder: constants+templates reconstructed, no execution)\n" as *u8); sys_exit(0); return 0 }
61 gw("verdict=RED\n" as *u8); sys_exit(1); return 1
62}