Angle OG override in serveMemberPage (the real join-page server); remove dead first attempt

This commit is contained in:
martbost
2026-08-22 12:01:00 -05:00
parent 9c21cc3c99
commit 1dc60e8c4c
+12 -29
View File
@@ -777,13 +777,20 @@ function serveMemberPage(req,res,file,kind,id){
let html; try{ html=fs.readFileSync(file,'utf8'); }catch(e){ return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404); }
const base='https://rmcircle.team';
const url=kind==='join'?`${base}/join/${id}`:`${base}/my/${id}`;
const title=kind==='join'
const ANGLE_OG={
pocket:{t:'You already spent it this week.',d:'The pocket-change illusion, called out in 105 seconds. Watch.',i:'/v/og-angle-pocket.jpg'},
phone:{t:"Everybody's making money on your phone. Except you.",d:'90 seconds that flips it. Watch.',i:'/v/og-angle-phone.jpg'},
two:{t:"You know two people. That's all this takes.",d:'The #1 excuse, retired in 90 seconds. Watch.',i:'/v/og-angle-two.jpg'},
graveyard:{t:'Your side-hustle graveyard has enough tenants.',d:"This one's built different. 90 seconds. Watch.",i:'/v/og-angle-graveyard.jpg'}
};
const angle=kind==='join'?ANGLE_OG[new URL(req.url,'http://x').searchParams.get('v')]:null;
const title=angle?angle.t:(kind==='join'
? `You're invited to the RM Circle team by Member #${id}`
: `Member #${id}'s RM Circle team — live on the blockchain`;
const desc=kind==='join'
: `Member #${id}'s RM Circle team — live on the blockchain`);
const desc=angle?angle.d:(kind==='join'
? `A team-first crypto build where every payout is verified on Polygon. See Member #${id}'s real on-chain position and join their team. No income is guaranteed.`
: `Member #${id}'s live position, team, and payments — read straight from the blockchain. Get your 2, help your 2. No income is guaranteed.`;
const img=`${base}/og-card.jpg`;
: `Member #${id}'s live position, team, and payments — read straight from the blockchain. Get your 2, help your 2. No income is guaranteed.`);
const img=angle?`${base}${angle.i}`:`${base}/og-card.jpg`;
const og=[
`<meta property="og:type" content="website">`,
`<meta property="og:site_name" content="RM Circle Team Build">`,
@@ -819,30 +826,6 @@ const server=http.createServer(async(req,res)=>{
if(pathname==='/')file=path.join(PUBLIC_DIR,'index.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==='/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==='/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==='/weekly-rhythm'||pathname==='/weekly-rhythm/')file=path.join(PUBLIC_DIR,'weekly-rhythm.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='';
}
// angle links get message-matched social previews (crawlers don't run JS)
if(file&&file.endsWith('join.html')){
const av=new URL(req.url,'http://x').searchParams.get('v');
const OG={
pocket:{t:'You already spent it this week.',d:'The pocket-change illusion, called out in 105 seconds. Watch.',i:'og-angle-pocket.jpg'},
phone:{t:"Everybody's making money on your phone. Except you.",d:'90 seconds that flips it. Watch.',i:'og-angle-phone.jpg'},
two:{t:"You know two people. That's all this takes.",d:'The #1 excuse, retired in 90 seconds. Watch.',i:'og-angle-two.jpg'},
graveyard:{t:'Your side-hustle graveyard has enough tenants.',d:"This one's built different. 90 seconds. Watch.",i:'og-angle-graveyard.jpg'}
};
const a=OG[av];
if(a){
let html=fs.readFileSync(file,'utf8');
const esc=x=>x.replace(/&/g,'&amp;').replace(/"/g,'&quot;');
html=html
.replace(/<meta property="og:title" content="[^"]*">/,`<meta property="og:title" content="${esc(a.t)}">`)
.replace(/<meta property="og:description" content="[^"]*">/,`<meta property="og:description" content="${esc(a.d)}">`)
.replace(/<meta property="og:image" content="[^"]*">/,`<meta property="og:image" content="https://rmcircle.team/v/${a.i}">`)
.replace(/<meta property="og:site_name" content="[^"]*">/,'')
.replace(/<meta name="twitter:title" content="[^"]*">/,`<meta name="twitter:title" content="${esc(a.t)}">`)
.replace(/<meta name="twitter:description" content="[^"]*">/,`<meta name="twitter:description" content="${esc(a.d)}">`)
.replace(/<meta name="twitter:image" content="[^"]*">/,`<meta name="twitter:image" content="https://rmcircle.team/v/${a.i}">`);
return send(res,200,html,{'Content-Type':'text/html; charset=utf-8','Cache-Control':'public, max-age=300'});
}
}
if(file&&staticFile(req,res,file))return;return staticFile(req,res,path.join(PUBLIC_DIR,'404.html'),404);
}catch(e){console.error(e);json(res,500,{error:'Internal server error'});}
});