code wiki / _hdl_build / nx_siteedit_daemon.nx
nx_siteedit_daemon.nx
buildroot/runtime/_hdl_build/nx_siteedit_daemon.nx
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
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
structs
| none |
consts
| 24 | const SED_MAGIC_3600: i64 = 3600 |
| 25 | const SED_MAGIC_86400: i64 = 86400 |
| 26 | const SED_MAGIC_8192: i64 = 8192 |
| 28 | const SED_REQCAP: i64 = 65536 |
| 29 | const SED_OUTCAP: i64 = 262144 |
| 30 | const SED_CFGCAP: i64 = 32768 |
functions
| 33 | func sed_resp(out: *u8, status: *u8, ctype: *u8, body: *u8, blen: i64) -> i64 called by 8: sed_shellsed_landingsed_editor_pagesed_editor_rawsed_result_pagesed_history_page+2 calls 2: sd_catsd_catn |
| 48 | func sed_cfg_ok(b: *u8, n: i64) -> i64 |
| 77 | func sed_write_atomic(path: *u8, b: *u8, n: i64) -> i64 called by 2: sed_do_restoresed_handle calls 6: sys_mmapsd_catsys_openat_wrsys_writesys_closesys_renameat |
| 92 | func sed_version_keep(path: *u8) -> i64 called by 2: sed_do_restoresed_handle calls 8: sys_mmapsys_read_filesd_catsd_catnsys_now_realtime_secsys_openat_wr+2 |
| 110 | func sed_backup_index(docroot: *u8) -> i64 |
| 132 | func sed_shell(domain: *u8, out: *u8) -> i64 |
| 154 | func sed_esc(src: *u8, n: i64, out: *u8, start: i64) -> i64 called by 1: sed_editor_raw |
| 168 | func sed_splice(body: *u8, b: i64, sraw: *u8, srn: i64) -> i64 |
| 176 | func sed_landing(out: *u8, b64: *u8, b64n: i64) -> i64 |
| 188 | func sed_editor_page(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64 |
| 215 | func sed_editor_raw(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64 |
| 239 | func sed_result_page(msg: *u8, msglen: i64, sraw: *u8, srn: i64, out: *u8) -> i64 |
| 253 | func sed_relage(now: i64, past: i64, body: *u8, b: i64) -> i64 |
| 265 | func sed_history_page(cfgpath: *u8, sraw: *u8, srn: i64, out: *u8) -> i64 |
| 300 | func sed_do_restore(cfgpath: *u8, path: *u8, pn: i64, sraw: *u8, srn: i64, out: *u8) -> i64 called by 1: sed_handle calls 9: sys_mmapsh_qs_epochsd_catsed_result_pagesh_version_pathsys_read_file+3 |
| 320 | func sed_view_version(cfgpath: *u8, path: *u8, pn: i64, out: *u8) -> i64 |
| 333 | func sed_handle(ctx: *NxAuthContext, domain: *u8, cfgpath: *u8, docroot: *u8, req: *u8, req_n: i64, out: *u8) -> i64 called by 2: mainmain calls 30: sys_mmapsd_find_pathsd_startssd_body_offsd_form_fieldsd_urldecode+24 |
| 668 | func main(argc: i64, argv: *i64) -> i64 |