code wiki / _hdl_build / nx_siteedit_daemon.nx

nx_siteedit_daemon.nx

buildroot/runtime/_hdl_build/nx_siteedit_daemon.nx

43623 B721 linesdepth 17pulls 53 transitivereach 1 importersview sourcekind servicetopic siteedit
docsdependenciesstructsconstsfunctions

about

nx_siteedit_daemon.nx -- the SITE-VISUALS editor for admin.<domain>/site: the client edits their site's .site BLUEPRINT (title/hero/cards/trust/footer = the site's DATA), previews the regenerated whole-site at /preview/, and publishes it to the live docroot -- all through the SAME canonical Modern Auth realm as the doc portal (same keysfile/storefile/realm => ONE client account works on both; login happens against POST /admin/login on the same host, this daemon only VALIDATES tokens). GET /site -> editor SPA shell (public shell; every action below needs the session) GET /site/config -> the current .site blueprint bytes POST /site/save -> body = the new blueprint; VALIDATED (title|/hero|/card|/footer| present, bounded, no NUL) -> prior config preserved as <config>.v<epoch> (additive, rule 13) -> atomic rename into place. Never a silent partial write. POST /site/preview -> sb_build_site(config, <docroot>/preview, domain) -> site visible at https://<domain>/preview/ (served hot; visitors' pages untouched) POST /site/publish -> preview-build FIRST (proves the config builds), then live docroot pages (.prev-index.html backup kept for instant revert) -- the client's call. Composes: nx_site_build (sb_build_site, gated 8/8) + nx_status_daemon sd_* + Modern Auth validate. Loopback HTTP daemon behind proxy_routes row `admin.<d> /site <port>`. Every response carries Content-Length (the buffered-proxy contract). license_tier: ORIGINAL

dependencies 6 imports · 1 importers

nx_status_daemon.nx nx_modern_auth_flow.nx nx_syscalls.nx nx_site_build.nx nx_cms_visual_builder.nx nx_siteedit_history.nx nx_siteedit_daemon.nx nx_siteedit_gate.nx

imports: nx_status_daemon.nxnx_modern_auth_flow.nxnx_syscalls.nxnx_site_build.nxnx_cms_visual_builder.nxnx_siteedit_history.nx

imported by: nx_siteedit_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_write sd_atoi sd_len sys_mmap nx_uas_server_keys_load_or sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close _uas_hex_dec _uas_nib nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_opq_derive_keypair sys_mmap ↻ _voprf_load_context_string u256_alloc nx_scratch nx_scratch_init sys_mmap ↻ nx_scratch_oom sys_write ↻ sys_exit sys_mmap ↻ nx_opq_hash_to_scalar sys_mmap ↻ nx_h2c_expand_message_xmd_ sys_mmap ↻ _h2c_i2osp_1 _h2c_i2osp_2 u256_alloc ↻ _opq_reduce_48be_mod_n

structs

none

consts

24const SED_MAGIC_3600: i64 = 3600
25const SED_MAGIC_86400: i64 = 86400
26const SED_MAGIC_8192: i64 = 8192
28const SED_REQCAP: i64 = 65536
29const SED_OUTCAP: i64 = 262144
30const SED_CFGCAP: i64 = 32768

functions

33func sed_resp(out: *u8, status: *u8, ctype: *u8, body: *u8, blen: i64) -> i64
48func sed_cfg_ok(b: *u8, n: i64) -> i64
called by 2: sed_do_restoresed_handle calls 1: sb_lm
77func sed_write_atomic(path: *u8, b: *u8, n: i64) -> i64
92func sed_version_keep(path: *u8) -> i64
110func sed_backup_index(docroot: *u8) -> i64
132func sed_shell(domain: *u8, out: *u8) -> i64
called by 1: sed_handle calls 3: sys_mmapsd_catsed_resp
154func sed_esc(src: *u8, n: i64, out: *u8, start: i64) -> i64
called by 1: sed_editor_raw
168func sed_splice(body: *u8, b: i64, sraw: *u8, srn: i64) -> i64
176func sed_landing(out: *u8, b64: *u8, b64n: i64) -> i64
188func sed_editor_page(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64
215func sed_editor_raw(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64
239func sed_result_page(msg: *u8, msglen: i64, sraw: *u8, srn: i64, out: *u8) -> i64
253func sed_relage(now: i64, past: i64, body: *u8, b: i64) -> i64
called by 1: sed_history_page calls 2: sd_catnsd_cat
265func sed_history_page(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64
300func sed_do_restore(cfgpath: *u8, path: *u8, pn: i64, sraw: *u8, srn: i64, out: *u8) -> i64
320func sed_view_version(cfgpath: *u8, path: *u8, pn: i64, out: *u8) -> i64
333func sed_handle(ctx: *NxAuthContext, domain: *u8, cfgpath: *u8, docroot: *u8, req: *u8, req_n: i64, out: *u8) -> i64
668func main(argc: i64, argv: *i64) -> i64