code wiki / _hdl_build / nx_media_server.nx
nx_media_server.nx
buildroot/runtime/_hdl_build/nx_media_server.nx
about
nx_media_server.nx -- SOVEREIGN media server (operator 2026-06-13: NO python, Nishi hardware-up).
Composes the PROVEN nx_http_server (socket/listen/accept/read/send) -- NO 3rd party. Serves the
/media browser + the FULL NAS library paginated (idx_*.wsl) + range-streamed files from the drvfs
NAS mounts (/mnt/nas_*). LAN-bound 0.0.0.0 (internal-network; operator-authorized 2026-06-16; PUBLIC-internet deferred to login-for-sites workstream). Fork-per-connection
for a concurrent grid. license_tier: ORIGINAL
dependencies 16 imports · 0 importers
diagram shows first 10 each side; +6 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_http_server.nxnx_book_search_lib.nx_pdf_reflow_lib.nxnx_site_auth.nxnx_modern_auth_flow.nxnx_base64.nxnx_galx_authz.nxnx_media_cover_lib.nxnx_token_counter.nxnx_reader_zoomserve.nxnx_reader_sync.nxnx_reader_library.nxnx_manga_add.nxnx_manga_search.nxnx_manga_shelf_lib.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
| 22 | const MS_MAGIC_2000000: i64 = 2000000 |
| 23 | const MS_MAGIC_8192: i64 = 8192 |
| 24 | const MS_MAGIC_262144: i64 = 262144 |
| 25 | const MS_MAGIC_4096: i64 = 4096 |
| 26 | const MS_MAGIC_120000: i64 = 120000 |
| 27 | const MS_MAGIC_900000: i64 = 900000 |
| 28 | const MS_MAGIC_16777216: i64 = 16777216 |
| 29 | const MS_MAGIC_5000: i64 = 5000 |
| 30 | const MS_MAGIC_65536: i64 = 65536 |
| 31 | const MS_MAGIC_1469598103: i64 = 1469598103 |
| 32 | const MS_MAGIC_72057594037927931: i64 = 72057594037927931 |
| 33 | const MS_MAGIC_4194304: i64 = 4194304 |
| 34 | const MS_MAGIC_1024: i64 = 1024 |
| 35 | const MS_MAGIC_32768: i64 = 32768 |
| 36 | const MS_MAGIC_2097152: i64 = 2097152 |
| 37 | const MS_MAGIC_86400: i64 = 86400 |
| 39 | const MS_PORT: i64 = 8790 |
| 40 | const MS_BROWSER: *u8 = "knowledge/staging/media/browser.html" |
| 41 | const MS_READER: *u8 = "knowledge/staging/media/reader.html" |
| 42 | const MS_CBX: *u8 = "knowledge/staging/media/cbx.html" |
| 43 | const MS_ZOOM: *u8 = "knowledge/staging/media/zoom.html" // organ-emitted by nx_reader_zoom_emit (guided-view tile zoom) |
| 44 | const MS_MANGA: *u8 = "knowledge/staging/media/manga.html" // organ-emitted by nx_manga_ui_emit (add + personal library UI) |
| 45 | const MS_SHELF: *u8 = "knowledge/staging/media/shelf.html" // organ-emitted by nx_manga_shelf_emit (LOCAL comics/manga series browse) |
| 46 | const MS_HEALTH: *u8 = "knowledge/staging/media/health.html" // organ-emitted by nx_media_health_emit (media-liveness dashboard) |
| 47 | const MS_HEALTH_JSON: *u8 = "knowledge/staging/media/mediahealth.json" // written by nx_movie_probe --sweep |
| 48 | const MS_READER_ROOT: *u8 = "knowledge/staging/media/reader/" |
| 584 | const MS_THUMB_ELF: *u8 = "/volume1/ai/galx/nx_galx_thumb.elf" |
| 585 | const MS_THUMB_MAX: *u8 = "384" |
functions
| 50 | func ms_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 51 | func ms_puts(s: *u8) -> i64 { sys_write(1, s, ms_slen(s)); return 0 } |
| 52 | func ms_app(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { dst[off+i] = src[i]; i = i + 1 } return off + n } called by 1: ms_apps |
| 53 | func ms_apps(dst: *u8, off: i64, s: *u8) -> i64 { return ms_app(dst, off, s, ms_slen(s)) } called by 11: ms_handle_listms_handle_filems_serve_staticms_handle_bookms_handle_llmpackms_serve_browser+5 calls 2: ms_appms_slen |
| 54 | func ms_dec(dst: *u8, off: i64, v: i64) -> i64 { let t: *u8 = sys_mmap(28); var m: i64=v; var k: i64=0; if m==0 {t[0]=48;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 { dst[off+i]=t[k-1-i]; i=i+1 } return off+k } called by 10: ms_handle_listms_handle_filems_serve_staticms_handle_bookms_handle_llmpackms_serve_browser+4 calls 1: sys_mmap |
| 55 | func ms_starts(p: *u8, plen: i64, pre: *u8) -> i64 { let m: i64 = ms_slen(pre); if m > plen { return 0 } var i: i64 = 0; while i < m { if p[i] != pre[i] { return 0 } i = i + 1 } return 1 } |
| 58 | func ms_qval(p: *u8, plen: i64, key: *u8, out: *u8, outcap: i64) -> i64 called by 10: ms_handle_listms_handle_filems_handle_bookms_handle_llmpackms_handle_removems_handle_open+4 calls 1: ms_slen |
| 79 | func ms_urldec(src: *u8, slen: i64, dst: *u8) -> i64 |
| 97 | func ms_ctype(path: *u8) -> *u8 |
| 110 | func ms_idxpath(t: *u8) -> *u8 |
| 120 | func ms_handle_list(cfd: i64, p: *u8, plen: i64) -> i64 |
| 175 | func ms_handle_file(cfd: i64, p: *u8, plen: i64, req: *u8, reqn: i64) -> i64 |
| 213 | func ms_contains(hay: *u8, hl: i64, needle: *u8) -> i64 |
| 227 | func ms_serve_static(cfd: i64, path: *u8, ctype: *u8) -> i64 |
| 245 | func ms_handle_book(cfd: i64, p: *u8, plen: i64) -> i64 |
| 279 | func ms_slug_safe(s: *u8) -> i64 |
| 301 | func ms_handle_llmpack(cfd: i64, p: *u8, plen: i64) -> i64 |
| 353 | func ms_serve_browser(cfd: i64) -> i64 |
| 367 | func ms_handle_remove(cfd: i64, p: *u8, plen: i64) -> i64 called by 1: ms_handle calls 8: sys_mmapms_qvalms_urldecgalx_media_path_okms_slensys_openat_append+2 |
| 379 | func ms_hexc(d: i64) -> i64 { if d < 10 { return 48 + d } return 87 + d } called by 1: ms_pathslug |
| 381 | func ms_pathslug(p: *u8, n: i64, out: *u8) -> i64 |
| 397 | func ms_run_extractor(extractor: *u8, path: *u8, slug: *u8, target: *u8) -> i64 |
| 420 | func ms_handle_open(cfd: i64, p: *u8, plen: i64) -> i64 |
| 586 | func ms_fexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 587 | func ms_thumb_run(src: *u8, outnew: *u8) -> i64 |
| 597 | func ms_cover_thumb(cfd: i64, full: *u8) -> i64 |
| 608 | func ms_handle_cover(cfd: i64, p: *u8, plen: i64) -> i64 |
| 619 | func ms_handle_search(cfd: i64, p: *u8, plen: i64) -> i64 |
| 666 | func ms_body_off(req: *u8, n: i64) -> i64 called by 1: ms_login |
| 672 | func ms_form_field(body: *u8, body_n: i64, name: *u8, name_n: i64, out_off: *i64, out_n: *i64) -> i64 called by 1: ms_login |
| 686 | func ms_emit_401(cfd: i64) -> i64 |
| 691 | func ms_login(ctx: *NxAuthContext, cfd: i64, req: *u8, req_n: i64) -> i64 called by 1: ms_handle calls 10: ms_body_offsys_mmapms_form_fieldms_urldecnx_modern_auth_loginb64_encode+4 |
| 724 | func ms_shell(cfd: i64) -> i64 |
| 746 | func ms_emit_403(cfd: i64) -> i64 |
| 753 | func ms_slug_guarded(ukey: *u8, path: *u8, plen: i64) -> i64 |
| 776 | func ms_handle(ctx: *NxAuthContext, cfd: i64) -> i64 |
| 902 | func main(argc: i64, argv: *i64) -> i64 |