Spaces:
Sleeping
Sleeping
Download src/pages/api/auth/me.js from TXAVLOG/dptxa-proxy: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/spaces/TXAVLOG/dptxa-proxy/resolve/main/src/pages/api/auth/me.js
- Command line
-
hf download hf://spaces/TXAVLOG/dptxa-proxy/src/pages/api/auth/me.js
-
curl -L -o me.js https://huggingface.co/spaces/TXAVLOG/dptxa-proxy/resolve/main/src/pages/api/auth/me.js
651 Bytes
| export const GET = async ({ cookies }) => { | |
| const token = cookies.get('auth_token')?.value; | |
| if (!token) { | |
| return new Response(JSON.stringify({ user: null }), { | |
| status: 200, | |
| headers: { 'Content-Type': 'application/json' } | |
| }); | |
| } | |
| try { | |
| const userData = JSON.parse(Buffer.from(token, 'base64').toString('utf-8')); | |
| return new Response(JSON.stringify({ user: userData }), { | |
| status: 200, | |
| headers: { 'Content-Type': 'application/json' } | |
| }); | |
| } catch (err) { | |
| return new Response(JSON.stringify({ user: null }), { | |
| status: 200, | |
| headers: { 'Content-Type': 'application/json' } | |
| }); | |
| } | |
| }; | |