Profile read endpoint answers 200 signedIn:false for visitors, so a shared /my link logs no console error

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-16 17:05:05 -05:00
parent 7d07fc01f1
commit dd74ded287
3 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -1449,7 +1449,9 @@ async function handleApi(req,res,pathname){
// Telegram Mini App bridge) can read or write one; /my/<id> is public and can not.
if(req.method==='GET'&&pathname==='/api/public/profile'){
const s=messages.authFromCookie(req);
if(!s)return json(res,401,{error:'Not signed in.'});
// 200 with signedIn:false, not 401: a shared /my/<id> link is opened by people
// who are not members, and a 401 there prints a console error that reads like a broken page.
if(!s)return json(res,200,{ok:true,signedIn:false});
return json(res,200,Object.assign({ok:true,id:s.id,suggest:profiles.suggest(s.id)},profiles.status(s.id)));
}
if(req.method==='POST'&&pathname==='/api/public/profile/username'){