forked from yoimiya-kokomi/Miao-Yunzai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
统一使用 node-fetch,删除 axios (yoimiya-kokomi#224)
- Loading branch information
1 parent
cd818ed
commit 233d027
Showing
3 changed files
with
59 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
const os = require("os"); | ||
const { existsSync } = require("fs"); | ||
const arch = os.arch(); | ||
let skipDownload = false; | ||
let executablePath; | ||
|
||
// win32 存在 Edge 优先选择 | ||
if (process.platform == "win32") { | ||
if (existsSync("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe")) { | ||
skipDownload = true; | ||
executablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"; | ||
} | ||
} else if (process.platform == "linux") { | ||
// 如果 arm64 架构且存在 Chromium,跳过下载 | ||
if ((arch == "arm64" || arch == "aarch64") && existsSync("/usr/bin/chromium")) { | ||
skipDownload = true; | ||
executablePath = "/usr/bin/chromium"; | ||
} else if (existsSync("/usr/bin/chromium")) { | ||
// 不论什么架构,如果存在 Chromium,跳过下载且配置路径 | ||
skipDownload = true; | ||
executablePath = "/usr/bin/chromium"; | ||
} | ||
} | ||
|
||
/** | ||
* @type {import("puppeteer").Configuration} | ||
*/ | ||
module.exports = { | ||
skipDownload, | ||
executablePath, | ||
}; | ||
const os = require("os"); | ||
const { existsSync } = require("fs"); | ||
const arch = os.arch(); | ||
let skipDownload = false; | ||
let executablePath; | ||
|
||
// win32 存在 Edge 优先选择 | ||
if (process.platform == "win32") { | ||
if (existsSync("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe")) { | ||
skipDownload = true; | ||
executablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"; | ||
} | ||
} else if (process.platform == "linux") { | ||
// 如果 arm64 架构且存在 Chromium,跳过下载 | ||
if ((arch == "arm64" || arch == "aarch64") && existsSync("/usr/bin/chromium")) { | ||
skipDownload = true; | ||
executablePath = "/usr/bin/chromium"; | ||
} else if (existsSync("/usr/bin/chromium")) { | ||
// 不论什么架构,如果存在 Chromium,跳过下载且配置路径 | ||
skipDownload = true; | ||
executablePath = "/usr/bin/chromium"; | ||
} | ||
} | ||
|
||
/** | ||
* @type {import("puppeteer").Configuration} | ||
*/ | ||
module.exports = { | ||
skipDownload, | ||
executablePath, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters