webring/functions/random.ts

7 lines
225 B
TypeScript
Raw Normal View History

import { randomEntry } from '../src/webring';
export const onRequestGet: PagesFunction = async (context) => {
const url = randomEntry()?.url ?? new URL(context.request.url).origin;
return Response.redirect(url, 303);
};