code wiki / _hdl_build / nx_manga_add.nx

nx_manga_add.nx

buildroot/runtime/_hdl_build/nx_manga_add.nx

12185 B213 linesdepth 4pulls 4 transitivereach 2 importersview sourcekind librarytopic manga
docsdependenciesstructsconstsfunctions

about

nx_manga_add.nx -- the reader daemon's "Add manga" endpoint (lib; lib+gate split). POST /api/manga/add with a url-encoded body `url=<page>&title=<name>` -> derive a safe slug from the title (or a hash of the url) -> fork ./_offc/nx_manga_get.elf <url> <slug> <ukey> <title> so the download lands in the CALLER's PRIVATE area (reader/u_<ukey>/<slug>). Returns {"ok":1,"slug":..,"pages":N} on success (decided by cbx.json on disk, never exit code alone). The heavy download runs in the fork (its TLS mmaps reclaimed on exit); the handler waits and reports. FAIL-CLOSED: url must be http(s) and printable; title/slug sanitized; body cap. Reuses zs_*/rl_* (DRY). license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_reader_zoomserve.nx nx_reader_library.nx nx_manga_add.nx nx_manga_add_gate.nx nx_media_server.nx

imports: nx_syscalls.nxnx_reader_zoomserve.nxnx_reader_library.nx

imported by: nx_manga_add_gate.nxnx_media_server.nx

structs

none

consts

11const MA_MAGIC_2000: i64 = 2000
12const MA_MAGIC_16777619: i64 = 16777619
13const MA_MAGIC_4096: i64 = 4096
14const MA_MAGIC_1024: i64 = 1024
16const MA_GET_ELF: *u8 = "./_offc/nx_manga_get.elf"
17const MA_IMPORT_ELF: *u8 = "./_offc/nx_media_import.elf" // the POLITE general importer (robots-honored)
18const MA_BODY_CAP: i64 = 4096

functions

22func ma_form_val(body: *u8, blen: i64, key: *u8, out: *u8, cap: i64) -> i64
61func ma_url_ok(url: *u8, n: i64) -> i64
78func ma_derive_slug(title: *u8, tn: i64, url: *u8, un: i64, out: *u8) -> i64
110func ma_fork_detached(elf: *u8, url: *u8, slug: *u8, ukey: *u8, title: *u8) -> i64
130func ma_run_get(url: *u8, slug: *u8, ukey: *u8, title: *u8) -> i64 { return ma_fork_detached(MA_GET_ELF, url, slug, ukey, title) }
called by 1: ma_handle_add calls 1: ma_fork_detached
133func ma_run_import(url: *u8, slug: *u8, ukey: *u8) -> i64 { return ma_fork_detached(MA_IMPORT_ELF, url, slug, ukey, 0 as *u8) }
called by 1: ma_handle_import calls 1: ma_fork_detached
137func ma_handle_import(cfd: i64, req: *u8, body_off: i64, body_len: i64, ukey: *u8) -> i64
161func ma_handle_add(cfd: i64, req: *u8, body_off: i64, body_len: i64, ukey: *u8) -> i64
187func ma_dlfind(buf: *u8, n: i64, key: *u8) -> i64
called by 1: ma_dlint
193func ma_dlint(buf: *u8, n: i64, key: *u8) -> i64
called by 1: ma_handle_dlstatus calls 1: ma_dlfind
199func ma_handle_dlstatus(cfd: i64, path: *u8, plen: i64, ukey: *u8) -> i64