yz-yuki-plugin 2.0.8-7 → 2.0.8-9

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/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # 2.0.8
2
+ * 优化屏蔽关键词日志
2
3
  * 添加微博登录功能(待续)
3
4
  * 更新B站动态标题获取
4
5
  * 合并分支dev与dev3,减少维护成本
@@ -191,7 +191,9 @@ class BiliTask {
191
191
  if (getWhiteWords && Array.isArray(getWhiteWords) && getWhiteWords.length > 0) {
192
192
  // 构建白名单关键字正则表达式,转义特殊字符
193
193
  const whiteWords = new RegExp(getWhiteWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
194
- if (!whiteWords.test(`${extentData?.title}${extentData?.content}`)) {
194
+ const content = `${extentData?.title}${extentData?.content}`;
195
+ if (!whiteWords.test(content)) {
196
+ logger.info(`UP主 "${upName}" B站动态:白名单关键词已开启,但动态消息未匹配,已跳过推送`);
195
197
  return; // 如果动态消息不在白名单中,则直接返回
196
198
  }
197
199
  }
@@ -201,7 +203,10 @@ class BiliTask {
201
203
  if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
202
204
  // 构建屏蔽关键字正则表达式,转义特殊字符
203
205
  const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
204
- if (banWords.test(`${extentData?.title}${extentData?.content}`)) {
206
+ const content = `${extentData?.title}${extentData?.content}`;
207
+ const matched = content.match(banWords);
208
+ if (matched) {
209
+ logger.info(`UP主 "${upName}" B站动态:触发屏蔽关键词 "${matched.join(', ')}" ,已跳过推送`);
205
210
  return; // 如果动态消息包含屏蔽关键字,则直接返回
206
211
  }
207
212
  }
@@ -244,6 +249,7 @@ class BiliTask {
244
249
  // 构建白名单关键字正则表达式,转义特殊字符
245
250
  const whiteWords = new RegExp(getWhiteWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
246
251
  if (!whiteWords.test(dynamicMsg.msg.join(''))) {
252
+ logger.info(`UP主 "${upName}" B站动态:白名单关键词已开启,但动态消息未匹配,已跳过推送`);
247
253
  return; // 如果动态消息不在白名单中,则直接返回
248
254
  }
249
255
  }
@@ -253,8 +259,11 @@ class BiliTask {
253
259
  if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
254
260
  // 构建屏蔽关键字正则表达式,转义特殊字符
255
261
  const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
256
- if (banWords.test(dynamicMsg.msg.join(''))) {
257
- return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
262
+ const content = dynamicMsg.msg.join('');
263
+ const matched = content.match(banWords);
264
+ if (matched) {
265
+ logger.info(`UP主 "${upName}" B站动态:触发屏蔽关键词 "${matched.join(', ')}" ,已跳过推送`);
266
+ return; // 如果动态消息包含屏蔽关键字,则直接返回
258
267
  }
259
268
  }
260
269
  else if (getBanWords && !Array.isArray(getBanWords)) {
@@ -156,7 +156,9 @@ class WeiboTask {
156
156
  if (getWhiteWords && Array.isArray(getWhiteWords) && getWhiteWords.length > 0) {
157
157
  // 构建白名单关键字正则表达式,转义特殊字符
158
158
  const whiteWords = new RegExp(getWhiteWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
159
- if (!whiteWords.test(`${data?.title}${data?.content}`)) {
159
+ const content = `${data?.title}${data?.content}`;
160
+ if (!whiteWords.test(content)) {
161
+ logger.info(`博主 "${upName}" 微博动态:白名单关键词已开启,但动态消息未匹配,已跳过推送`);
160
162
  return; // 如果动态消息不在白名单中,则直接返回
161
163
  }
162
164
  }
@@ -166,8 +168,11 @@ class WeiboTask {
166
168
  if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
167
169
  // 构建屏蔽关键字正则表达式,转义特殊字符
168
170
  const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
169
- if (banWords.test(`${data?.title}${data?.content}`)) {
170
- return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
171
+ const content = `${data?.title}${data?.content}`;
172
+ const matched = content.match(banWords);
173
+ if (matched) {
174
+ logger.info(`博主 "${upName}" 微博动态:触发屏蔽关键词 "${matched.join(', ')}" ,已跳过推送`);
175
+ return; // 如果动态消息包含屏蔽关键字,则直接返回
171
176
  }
172
177
  }
173
178
  else if (getBanWords && !Array.isArray(getBanWords)) {
@@ -210,6 +215,7 @@ class WeiboTask {
210
215
  // 构建白名单关键字正则表达式,转义特殊字符
211
216
  const whiteWords = new RegExp(getWhiteWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
212
217
  if (!whiteWords.test(dynamicMsg.msg.join(''))) {
218
+ logger.info(`博主 "${upName}" 微博动态:白名单关键词已开启,但动态消息未匹配,已跳过推送`);
213
219
  return; // 如果动态消息不在白名单中,则直接返回
214
220
  }
215
221
  }
@@ -219,8 +225,11 @@ class WeiboTask {
219
225
  if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
220
226
  // 构建屏蔽关键字正则表达式,转义特殊字符
221
227
  const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
222
- if (banWords.test(dynamicMsg.msg.join(''))) {
223
- return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
228
+ const content = dynamicMsg.msg.join('');
229
+ const matched = content.match(banWords);
230
+ if (matched) {
231
+ logger.info(`博主 "${upName}" 微博动态:触发屏蔽关键词 "${matched.join(', ')}" ,已跳过推送`);
232
+ return; // 如果动态消息包含屏蔽关键字,则直接返回
224
233
  }
225
234
  }
226
235
  else if (getBanWords && !Array.isArray(getBanWords)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.8-7",
3
+ "version": "2.0.8-9",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "debug": "^4.3.6",
33
33
  "jsdom": "^25.0.1",
34
34
  "json5": "^2.2.3",
35
- "jsxp": "^1.2.1",
35
+ "jsxp": "^1.2.3",
36
36
  "lodash": "^4.17.21",
37
37
  "md5": "^2.3.0",
38
38
  "moment": "^2.30.1",
@@ -64,9 +64,9 @@
64
64
  "icqq": "^0.6.10",
65
65
  "jsdom": "^24.1.1",
66
66
  "json5": "^2.2.3",
67
- "jsxp": "^1.2.1",
67
+ "jsxp": "^1.2.3",
68
68
  "lodash": "^4.17.21",
69
- "lvyjs": "^0.2.19",
69
+ "lvyjs": "^0.2.21",
70
70
  "md5": "^2.3.0",
71
71
  "node-fetch": "^3.3.2",
72
72
  "postcss": "^8.4.47",