From f17e47dd268dfd1908b344c7a5d7661abec6a696 Mon Sep 17 00:00:00 2001 From: ImJustChew Date: Sat, 28 Sep 2024 15:48:20 +0900 Subject: [PATCH] fix: move nthumods ocr url to env, closes #500 --- .env | 3 ++- src/lib/headless_ais.ts | 2 +- src/lib/scrapers/course.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.env b/.env index af1645f7..b87cbb9b 100644 --- a/.env +++ b/.env @@ -7,4 +7,5 @@ GITHUB_CLIENT_ID=Iv23lisqArfcAbBMGOXe CLOUDFLARE_KV_SHORTLINKS_NAMESPACE=4f141ed7ad0b4113b8e61a53710b653f CLOUDFLARE_WORKER_ACCOUNT_ID=50396718bfac13dffb7727aad0e82150 NEXT_PUBLIC_ALGOLIA_APP_ID=NT48R1WDTS -NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=6dfe4655a78904f8b01432e7db3b8d64 \ No newline at end of file +NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=6dfe4655a78904f8b01432e7db3b8d64 +NTHUMODS_OCR_BASE_URL=https://ocr.nthumods.com \ No newline at end of file diff --git a/src/lib/headless_ais.ts b/src/lib/headless_ais.ts index e145d880..2e1c000d 100644 --- a/src/lib/headless_ais.ts +++ b/src/lib/headless_ais.ts @@ -207,7 +207,7 @@ export const signInToCCXP = async ( //fetch the image from the url and send as base64 console.log("Fetching CAPTCHA"); answer = await fetch( - `https://ocr.nthumods.com/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/auth_img.php?pwdstr=${pwdstr}`, + `${process.env.NTHUMODS_OCR_BASE_URL}/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/auth_img.php?pwdstr=${pwdstr}`, ).then((res) => res.text()); console.log("Time taken", Date.now() - startTime); startTime = Date.now(); diff --git a/src/lib/scrapers/course.ts b/src/lib/scrapers/course.ts index 689d9987..5836ff0a 100644 --- a/src/lib/scrapers/course.ts +++ b/src/lib/scrapers/course.ts @@ -51,7 +51,7 @@ export const scrapeArchivedCourses = async (semester: string) => { //fetch the image from the url and send as base64 console.log("ACIXSTORE: ", ACIXSTORE); answer = await fetch( - `https://ocr.nthumods.com/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/JH/mod/auth_img/auth_img.php?ACIXSTORE=${ACIXSTORE}`, + `${process.env.NTHUMODS_OCR_BASE_URL}/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/JH/mod/auth_img/auth_img.php?ACIXSTORE=${ACIXSTORE}`, ).then((res) => res.text()); console.log(answer); if (answer.length == 3) break;