mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-19 11:11:13 +10:00
feat: very basic screenshot api
This commit is contained in:
17
server/api/v1/screenshots/[id]/index.get.ts
Normal file
17
server/api/v1/screenshots/[id]/index.get.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// get a specific screenshot
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import screenshotManager from "~/server/internal/screenshots";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await aclManager.getUserIdACL(h3, ["screenshots:read"]);
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const screenshotId = getRouterParam(h3, "id");
|
||||
if (!screenshotId)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Missing screenshot ID",
|
||||
});
|
||||
|
||||
return await screenshotManager.get(screenshotId);
|
||||
});
|
||||
Reference in New Issue
Block a user