Files
vces/routes/api/shares/[id].ts
T
2026-10-29 20:44:26 -03:00

16 lines
496 B
TypeScript

import { define } from "@/utils.ts";
import type { SharedFileEntry } from "@/src/files.ts";
import { get_shared_file, share_not_found } from "@/src/shares.ts";
export const handler = define.handlers({
async GET(ctx) {
const shared = await get_shared_file(ctx.params.id);
if (!shared) {
return share_not_found();
}
return Response.json({ size: shared.file.size, metadata: shared.share.metadata } satisfies SharedFileEntry, {
headers: { "Cache-Control": "no-store" },
});
},
});