code wiki / _hdl_build / nx_manga_add.nx
nx_manga_add.nx
buildroot/runtime/_hdl_build/nx_manga_add.nx
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
imports: nx_syscalls.nxnx_reader_zoomserve.nxnx_reader_library.nx
imported by: nx_manga_add_gate.nxnx_media_server.nx
structs
| none |
consts
| 11 | const MA_MAGIC_2000: i64 = 2000 |
| 12 | const MA_MAGIC_16777619: i64 = 16777619 |
| 13 | const MA_MAGIC_4096: i64 = 4096 |
| 14 | const MA_MAGIC_1024: i64 = 1024 |
| 16 | const MA_GET_ELF: *u8 = "./_offc/nx_manga_get.elf" |
| 17 | const MA_IMPORT_ELF: *u8 = "./_offc/nx_media_import.elf" // the POLITE general importer (robots-honored) |
| 18 | const MA_BODY_CAP: i64 = 4096 |
functions
| 22 | func ma_form_val(body: *u8, blen: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 61 | func ma_url_ok(url: *u8, n: i64) -> i64 |
| 78 | func ma_derive_slug(title: *u8, tn: i64, url: *u8, un: i64, out: *u8) -> i64 |
| 110 | func ma_fork_detached(elf: *u8, url: *u8, slug: *u8, ukey: *u8, title: *u8) -> i64 |
| 130 | func ma_run_get(url: *u8, slug: *u8, ukey: *u8, title: *u8) -> i64 { return ma_fork_detached(MA_GET_ELF, url, slug, ukey, title) } |
| 133 | func ma_run_import(url: *u8, slug: *u8, ukey: *u8) -> i64 { return ma_fork_detached(MA_IMPORT_ELF, url, slug, ukey, 0 as *u8) } |
| 137 | func ma_handle_import(cfd: i64, req: *u8, body_off: i64, body_len: i64, ukey: *u8) -> i64 |
| 161 | func ma_handle_add(cfd: i64, req: *u8, body_off: i64, body_len: i64, ukey: *u8) -> i64 |
| 187 | func ma_dlfind(buf: *u8, n: i64, key: *u8) -> i64 called by 1: ma_dlint |
| 193 | func ma_dlint(buf: *u8, n: i64, key: *u8) -> i64 |
| 199 | func ma_handle_dlstatus(cfd: i64, path: *u8, plen: i64, ukey: *u8) -> i64 |