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 = require('jsxp/.puppeteerrc');
44
+ module.exports = { skipDownload, executablePath };
package/README.md CHANGED
@@ -29,6 +29,7 @@ sudo yum install chromium # CentOS Stream 8
29
29
  #查看版本
30
30
  chromium-browser --version
31
31
  ```
32
+ > 注意,如果windows下手动安装chromium浏览器,或安装了其他修改版chrome浏览器,出现找不到浏览器,需要手动将`可执行文件路径`添加到 [./.puppeteerrc.cjs](./.puppeteerrc.cjs) 的路径列表中。
32
33
 
33
34
  # 🌰一、安装插件
34
35
 
@@ -216,8 +216,9 @@ class BiliTask {
216
216
  if (dynamicMsg === undefined || dynamicMsg === 'continue') {
217
217
  return 'return'; // 如果动态消息构建失败,则直接返回
218
218
  }
219
- if (biliConfigData.banWords.length > 0) {
220
- const banWords = new RegExp(biliConfigData.banWords.join('|'), 'g'); // 构建屏蔽关键字正则表达式
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
- if (weiboConfigData.banWords.length > 0) {
187
- const banWords = new RegExp(weiboConfigData.banWords.join('|'), 'g'); // 构建屏蔽关键字正则表达式
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.6-2",
3
+ "version": "2.0.6-3",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",