nx_synth_diag.nx source
↩ module page · 60 lines · 3943 B
1// nx_synth_diag.nx -- diagnose the broken /synth visuals: is the page served at /synth (no trailing slash) so
2// RELATIVE image URLs (src=wave.png) mis-resolve to nishifamily.com/wave.png (404)? Fetches the page + both the
3// correct and the mis-resolved image paths + the trailing-slash form, and prints status + a marker. Sovereign
4// TLS client (public edge, works off-LAN). license_tier: ORIGINAL expect_exit: 0
5import "nx_syscalls.nx"
6import "nx_x509_trust_store.nx"
7import "nx_trust_store_load_from_certdata.nx"
8import "nx_https_fetch_follow.nx"
9const K_MAGIC_4194304: i64 = 4194304
10const K_MAGIC_1048576: i64 = 1048576
11
12func lw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
13func ln(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} 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 i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
14func lfind(buf: *u8, n: i64, needle: *u8) -> i64 {
15 var nl: i64 = 0; while needle[nl] != (0 as u8) { nl = nl + 1 }
16 if nl == 0 { return 0 }
17 var i: i64 = 0
18 while i + nl <= n {
19 var j: i64 = 0; var ok: i64 = 1
20 while j < nl { if (buf[i+j]&0xff) != (needle[j]&0xff) { ok = 0; j = nl } else { j = j + 1 } }
21 if ok == 1 { return i }
22 i = i + 1
23 }
24 return 0 - 1
25}
26func probe(store: *TrustStore, url: *u8, out: *u8, cap: i64, needle: *u8) -> i64 {
27 let status: *i64 = sys_mmap(8) as *i64
28 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status)
29 lw(url); lw(" status="); ln(status[0]); lw(" bytes="); ln(n)
30 if lfind(out, n, needle) >= 0 { lw(" [has '"); lw(needle); lw("']") }
31 lw("\n")
32 return status[0]
33}
34
35func main() -> i64 {
36 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304)
37 if r <= 0 { lw("DIAG: certdata load failed\n"); sys_exit(1); return 1 }
38 let store: *TrustStore = r as *TrustStore
39 let cap: i64 = K_MAGIC_1048576
40 let out: *u8 = sys_mmap(cap)
41 lw("=== /synth visual diagnostic (live) ===\n")
42 lw("-- INTERACTIVE STUDIO API (new /synth/api route -> daemon :18796) --\n")
43 probe(store, "https://nishifamily.com/synth/api/health" as *u8, out, cap, "\"ok\":1" as *u8) // proxied to the live daemon?
44 probe(store, "https://nishifamily.com/synth/api/move?id=10" as *u8, out, cap, "PNG" as *u8) // NEW move (jumping jack) renders LIVE
45 probe(store, "https://nishifamily.com/synth/api/coach?err=65" as *u8, out, cap, "wrist" as *u8) // COACH: scores form + names the joint, LIVE
46 lw("-- page now carries the LIVE studio controls + assets still served (route is additive) --\n")
47 probe(store, "https://nishifamily.com/synth" as *u8, out, cap, "Grade me" as *u8) // coach control present on the page?
48 lw("-- referenced images (expect 200 + PNG) --\n")
49 probe(store, "https://nishifamily.com/synth/wave.png" as *u8, out, cap, "PNG" as *u8)
50 probe(store, "https://nishifamily.com/synth/wave_photo.png" as *u8, out, cap, "PNG" as *u8)
51 probe(store, "https://nishifamily.com/synth/variants.png" as *u8, out, cap, "PNG" as *u8)
52 probe(store, "https://nishifamily.com/synth/beastman.png" as *u8, out, cap, "PNG" as *u8)
53 probe(store, "https://nishifamily.com/synth/wolfwalk.png" as *u8, out, cap, "PNG" as *u8)
54 lw("-- mesh downloads (expect 200; glb has the glTF magic) --\n")
55 probe(store, "https://nishifamily.com/synth/wolf.glb" as *u8, out, cap, "glTF" as *u8)
56 probe(store, "https://nishifamily.com/synth/wolf.stl" as *u8, out, cap, "facet" as *u8)
57 probe(store, "https://nishifamily.com/synth/wolf.obj" as *u8, out, cap, "nishi_variant" as *u8)
58 lw("VERIFY: page 200 + absolute markers, all 5 images 200+PNG, meshes 200 -> the Edge visual bug is fixed LIVE.\n")
59 sys_exit(0); return 0
60}