Files
Cloudflare-worker/alook-redirect
2026-04-11 00:32:29 +08:00

16 lines
497 B
Plaintext

export default {
async fetch(request) {
const url = new URL(request.url);
const shortUrl = url.searchParams.get("url");
if (!shortUrl) {
return new Response("缺少 url 参数", { status: 400 });
}
const alookUrl = "alook://" + shortUrl.replace("https://", "");
return new Response(
`<html><body><script>window.location.href=${JSON.stringify(alookUrl)};</script></body></html>`,
{ headers: { "Content-Type": "text/html;charset=utf-8" } }
);
}
};