15 lines
493 B
TypeScript
15 lines
493 B
TypeScript
import { define } from "@/utils.ts";
|
|
import { get_shared_file, share_not_found } from "@/src/shares.ts";
|
|
import { upload_response } from "@/src/storage.ts";
|
|
|
|
export const handler = define.handlers({
|
|
// Streams the encrypted file, the recipient decrypts it with the secret in the link
|
|
async GET(ctx) {
|
|
const shared = await get_shared_file(ctx.params.id);
|
|
if (!shared) {
|
|
return share_not_found();
|
|
}
|
|
return await upload_response(shared.file.storage_id) ?? share_not_found();
|
|
},
|
|
});
|