wechaty-web-panel 1.6.45 → 1.6.46

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,6 +1,7 @@
1
1
  ## 更新日志
2
- ### V1.6.45(2024-03-31)
2
+ ### V1.6.46(2024-03-31)
3
3
  1、优化回调细节
4
+ 2、优化文件提取规则
4
5
 
5
6
  ### V1.6.44(2024-03-11)
6
7
  1、修复引用原文没有生效
@@ -502,10 +502,12 @@ exports.delHtmlTag = delHtmlTag;
502
502
  * @returns {*[]}
503
503
  */
504
504
  function extractImageLinks(text) {
505
- const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
506
- const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
505
+ const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
506
+ const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
507
507
  const mdRegexHttps = /!\[[^\]]*\]\((https?:\/\/\S+)\)/g;
508
508
  const mdRegexHttp = /!\[[^\]]*\]\((http?:\/\/\S+)\)/g;
509
+ const fileRegexHttp = /\[[^\]]*\]\((http?:\/\/\S+)\)/g;
510
+ const filesRegexHttp = /\[[^\]]*\]\((https?:\/\/\S+)\)/g;
509
511
  let imageLinks = [];
510
512
  let match;
511
513
  while ((match = httpRegex.exec(text)) !== null) {
@@ -514,7 +516,7 @@ function extractImageLinks(text) {
514
516
  while ((match = httpsRegex.exec(text)) !== null) {
515
517
  imageLinks.push(match[0]);
516
518
  }
517
- while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null) {
519
+ while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null || (match = fileRegexHttp.exec(text)) !== null || (match = filesRegexHttp.exec(text)) !== null) {
518
520
  imageLinks.push(match[1]);
519
521
  }
520
522
  imageLinks = Array.from(new Set(imageLinks));
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.45",
9
+ "version": "1.6.46",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -451,10 +451,12 @@ export function delHtmlTag(str) {
451
451
  * @returns {*[]}
452
452
  */
453
453
  export function extractImageLinks(text) {
454
- const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
455
- const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
454
+ const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
455
+ const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
456
456
  const mdRegexHttps = /!\[[^\]]*\]\((https?:\/\/\S+)\)/g;
457
457
  const mdRegexHttp = /!\[[^\]]*\]\((http?:\/\/\S+)\)/g;
458
+ const fileRegexHttp = /\[[^\]]*\]\((http?:\/\/\S+)\)/g;
459
+ const filesRegexHttp = /\[[^\]]*\]\((https?:\/\/\S+)\)/g;
458
460
  let imageLinks = [];
459
461
  let match;
460
462
  while ((match = httpRegex.exec(text)) !== null) {
@@ -463,7 +465,7 @@ export function extractImageLinks(text) {
463
465
  while ((match = httpsRegex.exec(text)) !== null) {
464
466
  imageLinks.push(match[0]);
465
467
  }
466
- while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null) {
468
+ while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null || (match = fileRegexHttp.exec(text)) !== null || (match = filesRegexHttp.exec(text)) !== null) {
467
469
  imageLinks.push(match[1]);
468
470
  }
469
471
  imageLinks = Array.from(new Set(imageLinks));
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.45",
6
+ "version": "1.6.46",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.45",
3
+ "version": "1.6.46",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {