koishi-plugin-group-analysis-mx 1.3.6 → 1.3.7

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.
@@ -72,9 +72,18 @@ class RendererService extends koishi_1.Service {
72
72
  return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==';
73
73
  }
74
74
  }
75
- /** 不做 emoji 处理(与 ChatLuna 原版一致)。Chromium 能正常渲染 emoji,之前的处理反而制造问题。 */
75
+ /** 渲染前清除所有 emoji 字符(用户环境 Chromium emoji 字体,保留 unicode emoji 会渲染成方框)。 */
76
76
  async injectEmojiFont(html) {
77
- return html;
77
+ if (!html || typeof html !== 'string')
78
+ return html;
79
+ try {
80
+ // 移除绝大多数 emoji(含变体选择符/ZWJ/旗帜),让图片里不出现方框
81
+ return html.replace(/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}\u{1F1E6}-\u{1F1FF}\u{2190}-\u{21FF}\u{FE0F}\u{200D}\u{2B00}-\u{2BFF}\u{1F300}-\u{1F9FF}]/gu, '');
82
+ }
83
+ catch (e) {
84
+ this.ctx.logger.warn('emoji 过滤失败:', e);
85
+ return html;
86
+ }
78
87
  }
79
88
  async init() {
80
89
  const resourcesDir = __dirname + '/../../resources';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-group-analysis-mx",
3
3
  "description": "群聊分析插件 - 生成精美群聊统计报告,支持 AI 话题总结(独立版,不依赖 ChatLuna)",
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",