mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Converted admin, auth, me and realtime routes.
This commit is contained in:
parent
6c9f1ad06b
commit
5205551ca8
25 changed files with 346 additions and 7 deletions
|
|
@ -13,7 +13,11 @@ export async function getJsonBody(request: Request) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function parseRequest(request: Request, schema?: ZodObject<any>) {
|
||||
export async function parseRequest(
|
||||
request: Request,
|
||||
schema?: ZodObject<any>,
|
||||
options?: { skipAuth: boolean },
|
||||
): Promise<any> {
|
||||
const url = new URL(request.url);
|
||||
let query = Object.fromEntries(url.searchParams);
|
||||
let body = await getJsonBody(request);
|
||||
|
|
@ -32,7 +36,7 @@ export async function parseRequest(request: Request, schema?: ZodObject<any>) {
|
|||
}
|
||||
}
|
||||
|
||||
const auth = !error ? await checkAuth(request) : null;
|
||||
const auth = !error && !options?.skipAuth ? await checkAuth(request) : null;
|
||||
|
||||
if (!error && !auth) {
|
||||
error = () => unauthorized();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue