diff --git a/chain.js b/chain.js index af90bb6..4937dbc 100644 --- a/chain.js +++ b/chain.js @@ -859,4 +859,29 @@ async function getIncome(id) { }; } -module.exports = { startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, nextOpenPosition, depthFrom, memberIdByAccount, liveDirects, balanceOf, CONTRACT }; +// Live upgrade payment path for /who-gets-paid (Marty, 2026-09-26): the buyer plus up to 16 +// matrix uplines, read straight from the contract (not the snapshot, so a level or direct that +// changed a minute ago is already reflected). Mirrors _payUpline's walk: it starts at the +// buyer's matrix parent and stops at the root (#1), an empty upline, or 16 steps. +const ROOT_ID = 1; +async function paymentPath(id) { + const pick = m => ({ id: m.id, level: m.level, tier: m.tier, directCount: m.directCount, uplineId: m.uplineId, referrerId: m.referrerId }); + const b = await fetchMember(id); + if (!b) return { found: false }; + const buyer = pick(Object.assign({ id }, b)); + const uplines = []; + let cur = b.uplineId, stopped = null; + for (let i = 0; i < 16; i++) { + if (!cur) { stopped = 'empty'; break; } + if (cur === ROOT_ID) { stopped = 'root'; break; } + const m = await fetchMember(cur); + if (!m) { stopped = 'empty'; break; } + uplines.push(pick(Object.assign({ id: cur }, m))); + cur = m.uplineId; + } + if (!stopped) stopped = 'max'; + await fetchCosts().catch(() => {}); + return { found: true, buyer, uplines, stopped, costs: costs ? { up: costs.up } : null, at: Date.now() }; +} + +module.exports = { paymentPath, startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, nextOpenPosition, depthFrom, memberIdByAccount, liveDirects, balanceOf, CONTRACT }; diff --git a/public/who-gets-paid.html b/public/who-gets-paid.html new file mode 100644 index 0000000..34597a2 --- /dev/null +++ b/public/who-gets-paid.html @@ -0,0 +1,111 @@ +Who Gets Paid | RM Circle Team Build + + + + + + + + +
+
+
Live from the contract
+

Who gets paid when a position upgrades?

+

Enter any position number. The page reads that position and everyone above it straight from the blockchain, then walks the contract's rule one generation at a time, from the buyer upward, until it finds who gets paid. Use "what if" on anyone who is passed over to see what it would take for them to catch it.

+ +
+
+
+ + + + +
+ +
Enter a position number to start.
+
    + +
    +

    Read live from the contract at 0x33Bd…4fB2DAF. The next level shown is the position's real next purchase; higher levels and "what if" changes are simulations of the same rule. This shows mechanics only, not a promise of income.

    +
    + +
    +
    The rule
    +

    How the contract picks who gets paid

    +

    An upgrade is never split. 100% of it goes to one upline in the matrix, or to the fee wallet if nobody qualifies.

    +
      +
    1. Skip. Skip a number of uplines equal to the buyer's current level minus one, without checking them. Buying Ascensus from Scintilla skips none.
    2. +
    3. Check. From there, look at each upline in turn: do they hold at least the level the buyer is leaving, and do they have 2 directs?
    4. +
    5. Pay or pass. The first upline that passes both checks is paid the full amount and the search ends. Anyone who fails is passed over.
    6. +
    7. Stop. If the search reaches position #1 (the root) or has taken 16 steps, the whole payment goes to the fee wallet.
    8. +
    +
    // upgrade() · the number that drives everything
    +_payUpline(id, currentLevel - 1, cost);               // levelIndex = the buyer's level - 1
    +
    +// _payUpline() · skip, then check
    +if (i < levelIndex) { upline = u.uplineId; continue; }   // skip this many
    +if (u.level > levelIndex && u.directCount >= 2) {        // the first to pass gets 100%
    +
    + + + + + + + + + + +
    BuyinglevelIndexUplines skippedCatcher must hold
    Ascensus00Scintilla or higher
    Fabrica11Ascensus or higher
    Culmen22Fabrica or higher
    Apex33Culmen or higher
    Fastigium44Apex or higher
    Vertex55Fastigium or higher
    Corona66Vertex or higher
    +

    Every row also needs 2 directs. The amount is set by the buyer's tier; Standard is exactly half of Premium. The search follows the matrix (where each member was placed), not the sponsor line. Can the contract change? See the security review →

    +
    +
    + + + + diff --git a/public/who-gets-paid.js b/public/who-gets-paid.js new file mode 100644 index 0000000..885db6d --- /dev/null +++ b/public/who-gets-paid.js @@ -0,0 +1,128 @@ +/* /who-gets-paid (Marty, 2026-09-26): enter any position, read it and its matrix uplines live + from /api/public/payment-path, and walk the contract's _payUpline rule one step at a time from + the buyer upward. "What if" lets a viewer give a passed-over upline the level or direct they + are missing and see where the payment would land instead. The rule here is the contract's: + skip levelIndex uplines; pay the first with level > levelIndex and directCount >= 2; + stop at the root (#1) or after 16 steps and send it to the fee wallet. */ +(function () { + var NAMES = ['Scintilla', 'Ascensus', 'Fabrica', 'Culmen', 'Apex', 'Fastigium', 'Vertex', 'Corona']; + var $ = function (id) { return document.getElementById(id); }; + var form = $('wgpForm'), idIn = $('wgpId'), sel = $('wgpLvl'), buyWrap = $('wgpBuyWrap'); + var runBtn = $('wgpRun'), resetBtn = $('wgpReset'), buyerEl = $('wgpBuyer'), sumEl = $('wgpSum'); + var chainEl = $('wgpChain'), legend = $('wgpLegend'); + var data = null, overrides = {}, timer = null; + + function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); } + function fmt(n) { return Number(n || 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); } + function lvName(l) { return NAMES[l - 1] || ('level ' + l); } + function eff(u) { var o = overrides[u.id] || {}; return { level: o.level || u.level, directCount: o.directCount != null ? o.directCount : u.directCount, what: !!(o.level || o.directCount != null) }; } + function price(li) { + var t = data.buyer.tier === 2 ? 2 : 1; + return data.costs && data.costs.up && data.costs.up[t] ? data.costs.up[t][li] : null; + } + + function evaluate(li) { + var steps = [], paid = null, U = data.uplines; + for (var i = 0; i < U.length; i++) { + var e = eff(U[i]); + if (i < li) { steps.push({ s: 'skip', why: 'Skipped: ' + (i + 1) + ' of ' + li + ' skipped without checking.' }); continue; } + var lvOk = e.level > li, dOk = e.directCount >= 2; + if (lvOk && dOk) { steps.push({ s: 'paid', why: 'Holds ' + lvName(e.level) + ', needs ' + lvName(li + 1) + ' or higher, and has ' + e.directCount + ' directs. Paid in full; the search ends.' }); paid = i; break; } + var need = []; + if (!lvOk) need.push('needs ' + lvName(li + 1) + ' or higher (holds ' + lvName(e.level) + ')'); + if (!dOk) need.push('needs 2 directs (has ' + e.directCount + ')'); + steps.push({ s: 'fail', why: 'Passed over: ' + need.join(' and ') + '.', fix: { id: U[i].id, level: lvOk ? null : li + 1, directs: dOk ? null : 2 } }); + } + return { steps: steps, paid: paid }; + } + + function draw(li, upto) { + var r = evaluate(li), U = data.uplines, b = data.buyer; + var html = '
  1. buyer#' + b.id + '' + lvName(b.level) + ' · ' + b.directCount + ' direct' + (b.directCount === 1 ? '' : 's') + ' · buying ' + lvName(li + 1) + '
  2. '; + for (var i = 0; i < U.length; i++) { + var u = U[i], e = eff(u), st = (i < r.steps.length && i < upto) ? r.steps[i] : null; + var cls = st ? st.s : 'idle', tag = st ? (st.s === 'skip' ? 'skipped' : st.s === 'fail' ? 'passed over' : 'paid') : ''; + var why = ''; + if (st) { + why = '' + esc(st.why); + if (st.fix && upto >= r.steps.length) why += ''; + why += ''; + } + html += '
  3. up ' + (i + 1) + '#' + u.id + '' + lvName(e.level) + ' · ' + e.directCount + ' direct' + (e.directCount === 1 ? '' : 's') + '' + tag + '' + why + '
  4. '; + } + var done = upto >= r.steps.length, amt = price(li); + var amtTxt = amt != null ? fmt(amt) + ' POL' : 'the upgrade'; + if (done && r.paid === null) { + var reason = data.stopped === 'root' && U.length < 16 ? 'The next upline is #1, the root. The search stops there.' : 'The search used all 16 steps.'; + html += '
  5. stopfee' + (data.stopped === 'root' && U.length < 16 ? '#1 root reached' : '16 steps used') + 'fee wallet' + reason + ' Nobody qualified, so the full ' + amtTxt + ' goes to the fee wallet.
  6. '; + } + chainEl.innerHTML = html; + if (done) { + var wi = Object.keys(overrides).length ? ' (with your what-if changes)' : ''; + sumEl.innerHTML = r.paid !== null + ? '#' + U[r.paid].id + ' would be paid ' + amtTxt + '' + wi + '. ' + li + ' upline' + (li === 1 ? '' : 's') + ' skipped, ' + (r.paid - li) + ' passed over.' + : 'Nobody in reach qualifies, so the full ' + amtTxt + ' would go to the fee wallet' + wi + '. Skipped ' + Math.min(li, U.length) + ', checked ' + Math.max(0, U.length - li) + '.'; + } else sumEl.textContent = 'Checking ' + (upto + 1) + ' up…'; + } + + function run(animate) { + if (!data) return; + if (timer) { clearInterval(timer); timer = null; } + var li = Number(sel.value), total = evaluate(li).steps.length; + var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if (!animate || reduce) { draw(li, total); return; } + var k = 0; draw(li, 0); + timer = setInterval(function () { k++; draw(li, k); if (k >= total) { clearInterval(timer); timer = null; } }, 380); + } + + function showBuyer() { + var b = data.buyer, t = b.tier === 2 ? 'Premium' : 'Standard'; + buyerEl.innerHTML = + '
    Position#' + b.id + '
    ' + + '
    Level' + lvName(b.level) + '
    ' + + '
    Tier' + t + '
    ' + + '
    Directs' + b.directCount + '
    ' + + '
    Matrix parent' + (b.uplineId ? '#' + b.uplineId : '—') + '
    '; + buyerEl.hidden = false; + sel.innerHTML = ''; + for (var L = b.level + 1; L <= 8; L++) { + var li = L - 2, o = document.createElement('option'), p = price(li); + o.value = li; + o.textContent = NAMES[L - 1] + (p != null ? ' · ' + fmt(p) + ' POL' : '') + (L === b.level + 1 ? ' (its real next upgrade)' : ' (what if)'); + sel.appendChild(o); + } + var canBuy = b.level < 8; + buyWrap.hidden = !canBuy; runBtn.hidden = !canBuy; legend.hidden = !canBuy; + if (!canBuy) { chainEl.innerHTML = ''; sumEl.innerHTML = '#' + b.id + ' already holds Corona, the top level, so it has no upgrade left to buy.'; } + } + + function load(id) { + if (!id) return; + if (timer) { clearInterval(timer); timer = null; } + overrides = {}; resetBtn.hidden = true; + sumEl.textContent = 'Reading #' + id + ' and its uplines from the blockchain…'; + chainEl.innerHTML = ''; buyerEl.hidden = true; + try { history.replaceState(null, '', '/who-gets-paid?id=' + id); } catch (e) {} + fetch('/api/public/payment-path?id=' + encodeURIComponent(id)).then(function (r) { + return r.json().then(function (j) { if (!r.ok) throw new Error(j.error || 'Lookup failed.'); return j; }); + }).then(function (j) { + data = j; showBuyer(); + if (data.buyer.level < 8) run(false); + }).catch(function (e) { data = null; sumEl.textContent = e.message || 'Lookup failed. Try again.'; }); + } + + form.addEventListener('submit', function (e) { e.preventDefault(); var id = parseInt(idIn.value, 10); if (id > 0) load(id); else sumEl.textContent = 'Enter a position number, like 1191.'; }); + runBtn.addEventListener('click', function () { run(true); }); + sel.addEventListener('change', function () { run(false); }); + resetBtn.addEventListener('click', function () { overrides = {}; resetBtn.hidden = true; run(false); }); + chainEl.addEventListener('click', function (e) { + var bt = e.target.closest('button[data-fix]'); if (!bt) return; + var id = Number(bt.dataset.fix), o = overrides[id] || {}; + if (bt.dataset.level) o.level = Number(bt.dataset.level); + if (bt.dataset.directs) o.directCount = Number(bt.dataset.directs); + overrides[id] = o; resetBtn.hidden = false; run(false); + }); + + var q = new URLSearchParams(location.search).get('id'); + if (q && /^\d+$/.test(q)) { idIn.value = q; load(Number(q)); } +})(); diff --git a/server.js b/server.js index 59b7f71..55ee8fa 100644 --- a/server.js +++ b/server.js @@ -625,6 +625,7 @@ async function handleTranslate(req,res){ // frame-src includes 'self' so our own pages (the Page Builder preview framing // a member's /p/ page) are not blocked by our own policy. +const pathCache=new Map(); // /api/public/payment-path results, 60 s const CSP_BASE="default-src 'self'; script-src 'self' https://polhunter.com https://www.networkadspace.com https://networkadspace.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; media-src 'self' https://coolify-saasytop.nyc3.digitaloceanspaces.com; connect-src 'self' https://polhunter.com; font-src 'self' data:; form-action 'self'; frame-src 'self' https://www.youtube-nocookie.com"; // polhunter.com: the PolHunter embed on /training (2026-09-19) function securityHeaders(extra={}) { // Public pages must render inside safelist / traffic-exchange iframes, so framing stays open here; admin.html re-locks it via ADMIN_FRAME_HEADERS. @@ -709,6 +710,21 @@ async function handleApi(req,res,pathname){ if(owner||!data||!data.nextStep||data.nextStep.funded==null)return {data,owner}; return {data:Object.assign({},data,{nextStep:Object.assign({},data.nextStep,{funded:null})}),owner}; } + // /who-gets-paid: live upgrade payment path for any position (public, rate-limited, 60 s cache) + if(req.method==='GET'&&pathname==='/api/public/payment-path'){ + const ip=String(req.headers['x-forwarded-for']||req.socket.remoteAddress||'').split(',')[0].trim(); + if(memberLookupLimited(ip))return json(res,429,{error:'Too many lookups. Give it a minute.'}); + const id=Number(new URL(req.url,'http://x').searchParams.get('id')||0); + if(!Number.isInteger(id)||id<1||id>281474976710655)return json(res,400,{error:'Enter a position number.'}); + const hit=pathCache.get(id); + if(hit&&Date.now()-hit.ts<60000)return json(res,200,hit.data,{'Cache-Control':'public, max-age=30'}); + try{ + const r=await Promise.race([chain.paymentPath(id),new Promise((_,rej)=>setTimeout(()=>rej(new Error('Blockchain lookup timed out. Try again.')),25000))]); + if(!r.found)return json(res,404,{error:'Position #'+id+' does not exist.'}); + pathCache.set(id,{ts:Date.now(),data:r}); + return json(res,200,r,{'Cache-Control':'public, max-age=30'}); + }catch(e){return json(res,502,{error:e.message||'Lookup failed.'});} + } if(req.method==='GET'&&pathname==='/api/public/member'){ const ip=String(req.headers['x-forwarded-for']||req.socket.remoteAddress||'').split(',')[0].trim(); if(memberLookupLimited(ip))return json(res,429,{error:'Too many lookups — give it a minute.'}); @@ -1888,7 +1904,7 @@ const server=http.createServer(async(req,res)=>{ if((mj=pathname.match(/^\/join\/(\d{1,15})$/)))return serveMemberPage(req,res,path.join(PUBLIC_DIR,'join.html'),'join',mj[1]); } let file; - if(pathname==='/')file=path.join(PUBLIC_DIR,'index.html');else if(pathname==='/app'||pathname==='/app/')file=path.join(PUBLIC_DIR,'app.html');else if(pathname==='/start'||pathname==='/start/')file=path.join(PUBLIC_DIR,'start.html');else if(pathname==='/training'||pathname==='/training/')file=path.join(PUBLIC_DIR,'training.html');else if(pathname==='/presentation'||pathname==='/presentation/'||pathname==='/webinar'||pathname==='/webinar/')file=path.join(PUBLIC_DIR,'presentation.html');else if(pathname==='/admin'||pathname==='/admin/')file=path.join(PUBLIC_DIR,'admin.html');else if(pathname==='/my'||pathname==='/my/'||/^\/my\/\d{1,15}$/.test(pathname))file=path.join(PUBLIC_DIR,'my.html');else if(pathname==='/contract'||pathname==='/contract/')file=path.join(PUBLIC_DIR,'contract.html');else if(pathname==='/disclaimer'||pathname==='/disclaimer/')file=path.join(PUBLIC_DIR,'disclaimer.html');else if(pathname==='/privacy'||pathname==='/privacy/')file=path.join(PUBLIC_DIR,'privacy.html');else if(pathname==='/refunds'||pathname==='/refunds/')file=path.join(PUBLIC_DIR,'refunds.html');else if(pathname==='/how-pay-works'||pathname==='/how-pay-works/')file=path.join(PUBLIC_DIR,'how-pay-works.html');else if(pathname==='/tools'||pathname==='/tools/')file=path.join(PUBLIC_DIR,'tools.html');else if(pathname==='/fast-start'||pathname==='/fast-start/')file=path.join(PUBLIC_DIR,'fast-start.html');else if(pathname==='/flyers'||pathname==='/flyers/')file=path.join(PUBLIC_DIR,'flyers.html');else if(pathname==='/weekly-rhythm'||pathname==='/weekly-rhythm/')file=path.join(PUBLIC_DIR,'weekly-rhythm.html');else if(pathname==='/generation-pay'||pathname==='/generation-pay/')file=path.join(PUBLIC_DIR,'generation-pay.html');else if(pathname==='/replays'||pathname==='/replays/')file=path.join(PUBLIC_DIR,'replays.html');else if(pathname==='/suite'||pathname==='/suite/')file=path.join(PUBLIC_DIR,'suite.html');else if(pathname==='/suite/copy'||pathname==='/suite/copy/')file=path.join(PUBLIC_DIR,'suite-copy.html');else if(pathname==='/suite/page'||pathname==='/suite/page/')file=path.join(PUBLIC_DIR,'suite-page.html');else if(pathname==='/suite/email'||pathname==='/suite/email/')file=path.join(PUBLIC_DIR,'suite-email.html');else if(pathname==='/suite/video'||pathname==='/suite/video/')file=path.join(PUBLIC_DIR,'suite-video.html');else if(pathname==='/suite/traffic'||pathname==='/suite/traffic/')file=path.join(PUBLIC_DIR,'suite-traffic.html');else if(pathname==='/suite/voice'||pathname==='/suite/voice/')file=path.join(PUBLIC_DIR,'suite-voice.html');else if(pathname==='/suite/split'||pathname==='/suite/split/')file=path.join(PUBLIC_DIR,'suite-split.html');else if(pathname==='/suite/funnel'||pathname==='/suite/funnel/')file=path.join(PUBLIC_DIR,'suite-funnel.html');else if(pathname==='/suite/leader'||pathname==='/suite/leader/')file=path.join(PUBLIC_DIR,'suite-leader.html');else if(pathname==='/suite/founder'||pathname==='/suite/founder/')file=path.join(PUBLIC_DIR,'suite-founder.html');else if(pathname==='/wallet-check'||pathname==='/wallet-check/')file=path.join(PUBLIC_DIR,'wallet-check.html');else if(pathname==='/suite/brand'||pathname==='/suite/brand/')file=path.join(PUBLIC_DIR,'suite-brand.html');else if(pathname==='/suite/grants'||pathname==='/suite/grants/')file=path.join(PUBLIC_DIR,'suite-grants.html');else if(pathname==='/suite/intel'||pathname==='/suite/intel/')file=path.join(PUBLIC_DIR,'suite-intel.html');else if(pathname==='/direct-join'||pathname==='/direct-join/'){if(!getSession(req)){res.writeHead(302,{Location:'/admin'});return res.end();}file=path.join(ROOT,'private','direct-join.html');}else if(pathname==='/join-now'||pathname==='/join-now/'){if(!getConfig().dappFallbackPublic){res.writeHead(302,{Location:'/start'});return res.end();}file=path.join(ROOT,'private','join-now.html');}else if(/^\/join\/\d{1,15}$/.test(pathname))file=path.join(PUBLIC_DIR,'join.html');else if(pathname==='/join'||pathname==='/join/'){res.writeHead(302,{Location:'/join-now'});return res.end();}else{ + if(pathname==='/')file=path.join(PUBLIC_DIR,'index.html');else if(pathname==='/app'||pathname==='/app/')file=path.join(PUBLIC_DIR,'app.html');else if(pathname==='/start'||pathname==='/start/')file=path.join(PUBLIC_DIR,'start.html');else if(pathname==='/training'||pathname==='/training/')file=path.join(PUBLIC_DIR,'training.html');else if(pathname==='/presentation'||pathname==='/presentation/'||pathname==='/webinar'||pathname==='/webinar/')file=path.join(PUBLIC_DIR,'presentation.html');else if(pathname==='/admin'||pathname==='/admin/')file=path.join(PUBLIC_DIR,'admin.html');else if(pathname==='/my'||pathname==='/my/'||/^\/my\/\d{1,15}$/.test(pathname))file=path.join(PUBLIC_DIR,'my.html');else if(pathname==='/contract'||pathname==='/contract/')file=path.join(PUBLIC_DIR,'contract.html');else if(pathname==='/disclaimer'||pathname==='/disclaimer/')file=path.join(PUBLIC_DIR,'disclaimer.html');else if(pathname==='/privacy'||pathname==='/privacy/')file=path.join(PUBLIC_DIR,'privacy.html');else if(pathname==='/refunds'||pathname==='/refunds/')file=path.join(PUBLIC_DIR,'refunds.html');else if(pathname==='/how-pay-works'||pathname==='/how-pay-works/')file=path.join(PUBLIC_DIR,'how-pay-works.html');else if(pathname==='/who-gets-paid'||pathname==='/who-gets-paid/')file=path.join(PUBLIC_DIR,'who-gets-paid.html');else if(pathname==='/tools'||pathname==='/tools/')file=path.join(PUBLIC_DIR,'tools.html');else if(pathname==='/fast-start'||pathname==='/fast-start/')file=path.join(PUBLIC_DIR,'fast-start.html');else if(pathname==='/flyers'||pathname==='/flyers/')file=path.join(PUBLIC_DIR,'flyers.html');else if(pathname==='/weekly-rhythm'||pathname==='/weekly-rhythm/')file=path.join(PUBLIC_DIR,'weekly-rhythm.html');else if(pathname==='/generation-pay'||pathname==='/generation-pay/')file=path.join(PUBLIC_DIR,'generation-pay.html');else if(pathname==='/replays'||pathname==='/replays/')file=path.join(PUBLIC_DIR,'replays.html');else if(pathname==='/suite'||pathname==='/suite/')file=path.join(PUBLIC_DIR,'suite.html');else if(pathname==='/suite/copy'||pathname==='/suite/copy/')file=path.join(PUBLIC_DIR,'suite-copy.html');else if(pathname==='/suite/page'||pathname==='/suite/page/')file=path.join(PUBLIC_DIR,'suite-page.html');else if(pathname==='/suite/email'||pathname==='/suite/email/')file=path.join(PUBLIC_DIR,'suite-email.html');else if(pathname==='/suite/video'||pathname==='/suite/video/')file=path.join(PUBLIC_DIR,'suite-video.html');else if(pathname==='/suite/traffic'||pathname==='/suite/traffic/')file=path.join(PUBLIC_DIR,'suite-traffic.html');else if(pathname==='/suite/voice'||pathname==='/suite/voice/')file=path.join(PUBLIC_DIR,'suite-voice.html');else if(pathname==='/suite/split'||pathname==='/suite/split/')file=path.join(PUBLIC_DIR,'suite-split.html');else if(pathname==='/suite/funnel'||pathname==='/suite/funnel/')file=path.join(PUBLIC_DIR,'suite-funnel.html');else if(pathname==='/suite/leader'||pathname==='/suite/leader/')file=path.join(PUBLIC_DIR,'suite-leader.html');else if(pathname==='/suite/founder'||pathname==='/suite/founder/')file=path.join(PUBLIC_DIR,'suite-founder.html');else if(pathname==='/wallet-check'||pathname==='/wallet-check/')file=path.join(PUBLIC_DIR,'wallet-check.html');else if(pathname==='/suite/brand'||pathname==='/suite/brand/')file=path.join(PUBLIC_DIR,'suite-brand.html');else if(pathname==='/suite/grants'||pathname==='/suite/grants/')file=path.join(PUBLIC_DIR,'suite-grants.html');else if(pathname==='/suite/intel'||pathname==='/suite/intel/')file=path.join(PUBLIC_DIR,'suite-intel.html');else if(pathname==='/direct-join'||pathname==='/direct-join/'){if(!getSession(req)){res.writeHead(302,{Location:'/admin'});return res.end();}file=path.join(ROOT,'private','direct-join.html');}else if(pathname==='/join-now'||pathname==='/join-now/'){if(!getConfig().dappFallbackPublic){res.writeHead(302,{Location:'/start'});return res.end();}file=path.join(ROOT,'private','join-now.html');}else if(/^\/join\/\d{1,15}$/.test(pathname))file=path.join(PUBLIC_DIR,'join.html');else if(pathname==='/join'||pathname==='/join/'){res.writeHead(302,{Location:'/join-now'});return res.end();}else{ const safe=path.normalize(pathname).replace(/^([.][.][/\\])+/, '').replace(/^[/\\]+/,'');file=path.join(PUBLIC_DIR,safe);if(!file.startsWith(PUBLIC_DIR))file=''; } if(file&&staticFile(req,res,file))return;return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404);