forked from epesooj/webring
13 lines
309 B
TypeScript
13 lines
309 B
TypeScript
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',
|
|
},
|
|
});
|
|
}
|