代码拉取完成,页面将自动刷新
同步操作将从 xsf-root/eSearch 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");
const download = require("download");
exports.default = async function () {
if (!fs.existsSync("./ocr/ppocr/默认")) {
fs.mkdirSync("./ocr/ppocr/默认", { recursive: true });
await download(
"https://github.com/xushengfeng/eSearch-OCR/releases/download/4.0.0/ch.zip",
"./ocr/ppocr/默认/",
{
extract: true,
rejectUnauthorized: false,
}
);
}
if (!fs.existsSync("./assets/onnx/seg")) {
fs.mkdirSync("./assets/onnx/seg", { recursive: true });
await download(
"https://github.com/xushengfeng/eSearch-seg/releases/download/1.0.0/seg.onnx",
"./assets/onnx/seg/",
{ rejectUnauthorized: false }
);
}
const arch = process.env["npm_config_arch"] || process.arch;
if (process.platform == "win32" && !fs.existsSync("./lib/win_rect.exe")) {
fs.writeFileSync(
"./lib/win_rect.exe",
await download("https://github.com/xushengfeng/win_rect/releases/download/0.1.0/win_rect.exe", {
rejectUnauthorized: false,
})
);
}
if (process.platform == "win32" && !fs.existsSync("./lib/copy.exe")) {
fs.writeFileSync(
"./lib/copy.exe",
await download("https://github.com/xushengfeng/ctrlc/releases/download/0.1.0/copy.exe", {
rejectUnauthorized: false,
})
);
}
if (!fs.existsSync("./lib/ffmpeg")) {
let o = {
win32: {
x64: "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n6.0-latest-win64-gpl-6.0.zip",
},
darwin: {
x64: "https://evermeet.cx/ffmpeg/ffmpeg-6.0.zip",
arm64: "https://www.osxexperts.net/ffmpeg6arm.zip",
},
};
if (o?.[process.platform]?.[arch]) {
fs.mkdirSync("./lib/ffmpeg");
await download(o[process.platform][process.arch], "./lib/ffmpeg/", {
extract: true,
rejectUnauthorized: false,
});
if (process.platform == "win32") {
fs.copyFileSync(
path.join("./lib/ffmpeg/", "ffmpeg-n6.0-latest-win64-gpl-6.0", "bin", "ffmpeg.exe"),
path.join("./lib/ffmpeg/", "ffmpeg.exe")
);
fs.rmSync(path.join("./lib/ffmpeg/", "ffmpeg-n6.0-latest-win64-gpl-6.0"), { recursive: true });
}
}
}
if (process.platform == "win32" && arch == "arm64") {
execSync("npm i node-screenshots-win32-arm64-msvc");
execSync("npm uninstall node-screenshots-win32-x64-msvc");
}
if (process.platform == "darwin" && arch == "arm64") {
execSync("npm i node-screenshots-darwin-arm64");
execSync("npm uninstall node-screenshots-darwin-x64");
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。