mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
20 lines
542 B
TypeScript
20 lines
542 B
TypeScript
import { unauthorized, json } from 'lib/response';
|
|
import { canViewWebsite, checkAuth } from 'lib/auth';
|
|
import { getSessionData } from 'queries';
|
|
|
|
export async function GET(
|
|
request: Request,
|
|
{ params }: { params: Promise<{ websiteId: string; sessionId: string }> },
|
|
) {
|
|
const { websiteId, sessionId } = await params;
|
|
|
|
const auth = await checkAuth(request);
|
|
|
|
if (!auth || !(await canViewWebsite(auth, websiteId))) {
|
|
return unauthorized();
|
|
}
|
|
|
|
const data = await getSessionData(websiteId, sessionId);
|
|
|
|
return json(data);
|
|
}
|