mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-06 21:12:04 +08:00
13 lines
422 B
TypeScript
13 lines
422 B
TypeScript
import { Handlers } from "$fresh/server.ts";
|
|
import { get_task_manager } from "../../../server.ts";
|
|
|
|
export const handler: Handlers = {
|
|
GET(req, _ctx) {
|
|
const m = get_task_manager();
|
|
const f = m.db.get_random_file();
|
|
if (!f) return new Response("File not found.", { status: 404 });
|
|
const u = new URL(req.url);
|
|
return Response.redirect(`${u.origin}/api/file/${f.id}`);
|
|
},
|
|
};
|