diff --git a/server.js b/server.js index f336772..2996db7 100644 --- a/server.js +++ b/server.js @@ -497,6 +497,35 @@ async function handleApi(req,res,pathname){ return json(res,404,{error:'API endpoint not found'}); } +// Serve /my/:id and /join/:id with personalized Open Graph / Twitter tags so a +// shared personal referral link previews nicely (social scrapers don't run JS, +// so the per-ID meta must be in the static HTML). Strips any baked-in og/twitter +// tags and injects a fresh, ID-specific set using the branded card image. +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.saasy.top'; + const url=kind==='join'?`${base}/join/${id}`:`${base}/my/${id}`; + const title=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' + ? `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`; + const og=[ + ``, + ``, + ``, + ``, + ``, + ``, + `` + ].join(''); + html=html.replace(/]*>/gi,''); + html=html.replace(/(
]*>)/i,`$1${og}`); + res.writeHead(200,securityHeaders({'Content-Type':'text/html; charset=utf-8','Cache-Control':'no-cache'})); + res.end(html); +} const server=http.createServer(async(req,res)=>{ try{ const u=new URL(req.url,`http://${req.headers.host||'localhost'}`),pathname=decodeURIComponent(u.pathname); @@ -510,6 +539,10 @@ const server=http.createServer(async(req,res)=>{ const body=`${ok?`Position #${safeId} will no longer receive alert emails. You can turn them back on anytime from your dashboard.`:'We could not process that unsubscribe link. You can manage alerts from your dashboard.'}
Open dashboard