Initial commit

This commit is contained in:
Zoe
2026-08-07 22:13:25 -05:00
commit 8006fd67f3
40 changed files with 11017 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import {
createError,
defineEventHandler,
getRequestHeader,
getRouterParam,
} from "h3";
import { dropStore, DropStoreError } from "../../utils/drop-store";
import { publicHeaders } from "../../utils/http";
export default defineEventHandler(async (event) => {
publicHeaders(event);
const id = String(getRouterParam(event, "id") || "").toUpperCase();
const access = getRequestHeader(event, "x-quickdrop-access") || "";
try {
return await dropStore.descriptor(id, access);
} catch (error) {
if (error instanceof DropStoreError && error.code === "expired")
throw createError({ statusCode: 410, statusMessage: "Drop expired." });
if (error instanceof DropStoreError && error.code === "forbidden")
throw createError({
statusCode: 403,
statusMessage: "Invalid access capability.",
});
throw createError({ statusCode: 404, statusMessage: "Drop not found." });
}
});