diff --git a/server.js b/server.js index 85f5ce2..bd3bfad 100644 --- a/server.js +++ b/server.js @@ -712,18 +712,6 @@ 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 is PRIVATE (Marty, 2026-09-27): only a link carrying ?k= opens it, which sets a - // 30-day cookie; everyone else gets the site's 404, for the page and for its data. Not linked, not indexed. - if(req.method==='GET'&&(pathname==='/who-gets-paid'||pathname==='/who-gets-paid/')){ - const key=String(getConfig().privateToolsKey||'').trim(); - const k=new URL(req.url,'http://x').searchParams.get('k'); - if(key&&k!==null){ - if(k===key){res.writeHead(302,{Location:'/who-gets-paid','Set-Cookie':'rmc.priv='+encodeURIComponent(key)+'; Path=/; Max-Age=2592000; HttpOnly; SameSite=Lax; Secure','Cache-Control':'no-store'});return res.end();} - return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404); - } - if(!privateToolsOk(req))return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404); - return staticFile(req,res,path.join(PUBLIC_DIR,'who-gets-paid.html')); - } // /who-gets-paid: live upgrade payment path for any position (private: see above; rate-limited, 60 s cache) if(req.method==='GET'&&pathname==='/api/public/payment-path'){ if(!privateToolsOk(req))return json(res,404,{error:'Not found.'}); @@ -1918,6 +1906,18 @@ const server=http.createServer(async(req,res)=>{ if((mj=pathname.match(/^\/my\/(\d{1,15})$/)))return serveMemberPage(req,res,path.join(PUBLIC_DIR,'my.html'),'my',mj[1]); if((mj=pathname.match(/^\/join\/(\d{1,15})$/)))return serveMemberPage(req,res,path.join(PUBLIC_DIR,'join.html'),'join',mj[1]); } + // /who-gets-paid is PRIVATE (Marty, 2026-09-27): only a link carrying ?k= opens it, which sets a + // 30-day cookie; everyone else gets the site's 404, for the page and for its data. Not linked, not indexed. + if(req.method==='GET'&&(pathname==='/who-gets-paid'||pathname==='/who-gets-paid/')){ + const key=String(getConfig().privateToolsKey||'').trim(); + const k=new URL(req.url,'http://x').searchParams.get('k'); + if(key&&k!==null){ + if(k===key){res.writeHead(302,{Location:'/who-gets-paid','Set-Cookie':'rmc.priv='+encodeURIComponent(key)+'; Path=/; Max-Age=2592000; HttpOnly; SameSite=Lax; Secure','Cache-Control':'no-store'});return res.end();} + return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404); + } + if(!privateToolsOk(req))return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404); + return staticFile(req,res,path.join(PUBLIC_DIR,'who-gets-paid.html')); + } 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(false)file=null;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='';