From 65828c50553b16535882eba52aae0639e3878e79 Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Sat, 21 Mar 2026 18:23:47 +0900 Subject: [PATCH] refactor(utils): add support for custom BROWSER environment variable - Remove hardcoded Windows and Linux Chrome paths from constants. - Update `getChromePath` to check for a `BROWSER` environment variable first. - This allows overriding the default browser executable path at runtime without modifying source code. --- src/utils/constants.ts | 2 -- src/utils/index.ts | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index bc2502e..17cc1e6 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -15,8 +15,6 @@ export const puppeteerInitArgs = [ export const CHROME = { Windows: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', - // Windows: 'C:\\Users\\kyuus\\.cache\\puppeteer\\chrome\\win64-146.0.7680.153\\chrome-win64\\chrome.exe', - // Linux: '/usr/bin/google-chrome', Linux: '/usr/bin/chromium', Mac: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', }; \ No newline at end of file diff --git a/src/utils/index.ts b/src/utils/index.ts index 7a1b228..c299e16 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -6,6 +6,9 @@ export const redis = new RedisClient(process.env.REDIS); export const getBandaiRawCookieRedisKey = (email: string) => `bandai:cookies:${email}:raw`; export const getChromePath = () => { + if (process.env.BROWSER) { + return process.env.BROWSER; + } const platform = process.platform; if (platform === 'win32') return CHROME.Windows; if (platform === 'linux') return CHROME.Linux;