mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
chore: auto-fix lint & formatting [skip ci]
This commit is contained in:
parent
41ad1a036b
commit
df51b71121
22 changed files with 1419 additions and 1408 deletions
|
|
@ -64,11 +64,7 @@ export function requireGroup(event: H3Event, groupId: string): GroupAccess {
|
|||
}
|
||||
|
||||
/** Requires at least `min` role in the group (owner|admin|viewer). */
|
||||
export function requireGroupRole(
|
||||
event: H3Event,
|
||||
groupId: string,
|
||||
min: GroupRole,
|
||||
): GroupAccess {
|
||||
export function requireGroupRole(event: H3Event, groupId: string, min: GroupRole): GroupAccess {
|
||||
const access = requireGroup(event, groupId);
|
||||
if (!access.ok) return access;
|
||||
const auth = currentAuth(event);
|
||||
|
|
@ -98,7 +94,6 @@ export async function bearerUserId(event: H3Event): Promise<string> {
|
|||
if (!auth?.startsWith("Bearer "))
|
||||
throw createError({ statusCode: 401, statusMessage: "Missing authorization" });
|
||||
const userId = await findUserIdByToken(env.KV, auth.slice(7));
|
||||
if (!userId)
|
||||
throw createError({ statusCode: 401, statusMessage: "Invalid or expired token" });
|
||||
if (!userId) throw createError({ statusCode: 401, statusMessage: "Invalid or expired token" });
|
||||
return userId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue