From f89c4903aadaec3496ddf12a14227a52daa1fd51 Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Thu, 5 Dec 2024 20:20:54 +0800 Subject: [PATCH] update AI engines --- functions/redirect.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/functions/redirect.js b/functions/redirect.js index 400b2607..64aabe84 100644 --- a/functions/redirect.js +++ b/functions/redirect.js @@ -1,10 +1,9 @@ -export default { - async fetch(req, _env) { - let url = req.url; - let iSlash = url.indexOf('?',11); - let nUrl = url.substring(iSlash+1); - return await goUrl(req, nUrl); - } +export async function onRequest(context) { + const { req, env } = context; + let url = req.url; + let iSlash = url.indexOf('?',11); + let nUrl = url.substring(iSlash+1); + return await goUrl(req, nUrl); } async function goUrl(request, url) {