code wiki / _hdl_build / nx_ad_banner.nx
nx_ad_banner.nx
buildroot/runtime/_hdl_build/nx_ad_banner.nx
about
nx_ad_banner.nx -- LIB: the BANNER GENERATOR for the performance ad engine. Advertisers generate real
STATIC or DYNAMIC display banners (IAB-sized, themed) for placement in the one-ad-per-page slot.
EXTENDS nx_ad_serve's clean "Brought to you by" model from a text byline to a full creative, while
KEEPING every privacy/security invariant BY CONSTRUCTION:
* ZERO third-party JS -- no <script>/<iframe>/<object>/<embed>/src= ; DYNAMIC = pure CSS @keyframes
animation (no JS), so a banner can NEVER carry a surveillance auction or third-party script.
* SELF-CONTAINED -- no external fetch (no src=, no url(http...)) -> no off-site beacon. Visuals
are CSS (solid + accent) + text only; no <img src>. No per-user targeting -- "systems not people".
* BOUNDARY-ESCAPED -- sponsor/headline/body/cta are external input -> HTML-escaped (rule 12); the
click LINK is scheme-validated (https/http/ relative only) so a `javascript:`/`data:` URI XSS is
neutralised to '#'.
* SCOPED -- a per-banner class suffix scopes the inline <style> so multiple previews on
one builder page never collide.
DRY: composes nx_ad_serve (as_append / as_append_escaped / as_has_thirdparty_js / as_len / as_contains).
IAB sizes + themes are NAMED here (code-default tier of the config hierarchy); migrate to
adcfg:bannersizes in the sovereign store (nx_ad_store) as a follow-on. license_tier: ORIGINAL
dependencies 2 imports · 4 importers
imports: nx_ad_serve.nxnx_syscalls.nx
imported by: nx_ad_banner_builder.nxnx_ad_banner_exceed_gate.nxnx_ad_banner_gate.nxnx_ad_emitter_apply.nx
structs
| none |
consts
| 20 | const AB_STATIC: i64 = 0 |
| 21 | const AB_DYNAMIC: i64 = 1 |
functions
| 23 | func ab_startswith(buf: *u8, pfx: *u8) -> i64 called by 1: ab_safe_link |
| 29 | func ab_uitoa(out: *u8, off: i64, v: i64) -> i64 |
| 38 | func ab_safe_link(link: *u8) -> i64 |
| 45 | func ab_suffix(a: *u8, b: *u8, out: *u8) -> i64 |
| 58 | func ab_upper(c: i64) -> i64 { if c >= 97 { if c <= 122 { return c - 32 } } return c } |
| 60 | func ab_initials(business: *u8, out: *u8) -> i64 |
| 86 | func ab_emit_banner(business: *u8, headline: *u8, body: *u8, cta: *u8, link: *u8, |
| 144 | func ab_pl(tpl: *u8, i: i64, pat: *u8) -> i64 { var j: i64 = 0; while pat[j] != (0 as u8) { if tpl[i+j] != pat[j] { return 0 } j = j + 1 } return 1 } |
| 145 | func ab_apply_tpl(out: *u8, off: i64, tpl: *u8, accent: *u8, actxt: *u8, ini: *u8, sfx: *u8) -> i64 |
| 162 | func ab_emit_banner_c(business: *u8, headline: *u8, body: *u8, cta: *u8, link: *u8, |
| 197 | func ab_iab_size(name: *u8, wout: *i64, hout: *i64) -> i64 |