Ship Steam login, D1 player sync, and cached「我」dashboard.
Players get a fast TTL-backed homepage (local profile / Cloudflare D1) with dense UI polish; login unlocks /home without blocking on every OpenDota refresh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* GET /api/auth/me — current Steam session (or { authenticated: false }).
|
||||
*/
|
||||
import { jsonResponse, sessionFromRequest } from "./_steam_common.js";
|
||||
|
||||
export async function onRequestGet(context) {
|
||||
try {
|
||||
const session = await sessionFromRequest(context);
|
||||
if (!session) {
|
||||
return jsonResponse({ authenticated: false });
|
||||
}
|
||||
return jsonResponse({
|
||||
authenticated: true,
|
||||
steamid: session.steamid,
|
||||
account_id: session.account_id,
|
||||
personaname: session.personaname || null,
|
||||
avatar: session.avatar || null,
|
||||
});
|
||||
} catch {
|
||||
return jsonResponse({ authenticated: false });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user