yz-yuki-plugin 2.0.6-2 → 2.0.6-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.puppeteerrc.cjs
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const { existsSync } = require('fs');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const arch = os.arch();
|
|
5
|
+
|
|
6
|
+
let skipDownload = false;
|
|
7
|
+
let executablePath;
|
|
8
|
+
|
|
9
|
+
if (['linux', 'android'].includes(process.platform))
|
|
10
|
+
for (const item of ['chromium', 'chromium-browser', 'chrome', 'google-chrome'])
|
|
11
|
+
try {
|
|
12
|
+
const chromiumPath = execSync(`command -v ${item}`).toString().trim();
|
|
13
|
+
if (chromiumPath && existsSync(chromiumPath)) {
|
|
14
|
+
executablePath = chromiumPath;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
} catch (err) {}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {string} 浏览器 "可执行文件路径" 列表,可根据需要自行修改或添加
|
|
21
|
+
*/
|
|
22
|
+
if (!executablePath)
|
|
23
|
+
for (const item of [
|
|
24
|
+
// Windows
|
|
25
|
+
'C:/Program Files/Google/Chrome/Application/chrome.exe',
|
|
26
|
+
'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
|
|
27
|
+
// macOS
|
|
28
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
29
|
+
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge'
|
|
30
|
+
])
|
|
31
|
+
if (existsSync(item)) {
|
|
32
|
+
executablePath = item;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (executablePath || arch == 'arm64' || arch == 'aarch64') {
|
|
37
|
+
(typeof logger != 'undefined' ? logger : console).info(`[Chromium] ${executablePath}`);
|
|
38
|
+
skipDownload = true;
|
|
39
|
+
}
|
|
40
|
+
|
|
1
41
|
/**
|
|
2
42
|
* @type {import("puppeteer").Configuration}
|
|
3
43
|
*/
|
|
4
|
-
module.exports =
|
|
44
|
+
module.exports = { skipDownload, executablePath };
|
package/README.md
CHANGED
|
@@ -216,8 +216,9 @@ class BiliTask {
|
|
|
216
216
|
if (dynamicMsg === undefined || dynamicMsg === 'continue') {
|
|
217
217
|
return 'return'; // 如果动态消息构建失败,则直接返回
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
const getBanWords = biliConfigData?.banWords;
|
|
220
|
+
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
221
|
+
const banWords = new RegExp(getBanWords.join('|'), 'g'); // 构建屏蔽关键字正则表达式
|
|
221
222
|
if (banWords.test(dynamicMsg.msg.join(''))) {
|
|
222
223
|
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
223
224
|
}
|
|
@@ -183,8 +183,9 @@ class WeiboTask {
|
|
|
183
183
|
if (dynamicMsg === undefined || dynamicMsg === 'continue') {
|
|
184
184
|
return 'return'; // 如果动态消息构建失败或内部资源获取失败,则直接返回
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
const getBanWords = weiboConfigData?.banWords;
|
|
187
|
+
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
188
|
+
const banWords = new RegExp(getBanWords.join('|'), 'g'); // 构建屏蔽关键字正则表达式
|
|
188
189
|
if (banWords.test(dynamicMsg.msg.join(''))) {
|
|
189
190
|
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
190
191
|
}
|