webring/src/random.ts

14 lines
309 B
TypeScript
Raw Normal View History

import { randomEntry } from './webring.ts';
export function redirectRandom(req: Request) {
const url = randomEntry()?.url ?? new URL(req.url).origin;
return new Response('', {
status: 303,
headers: {
location: url,
'cache-control': 'no-cache, no-store, no-transform',
},
});
}