dsh-long-plugins 2.4.0 → 2.4.1

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/client/client.js CHANGED
@@ -3998,7 +3998,7 @@ window.__ModuleLoader__.load({
3998
3998
  }
3999
3999
  }
4000
4000
  // 「dsh-long」设置区(模块开关+补丁状态)始终注册——独立于任何模块开关, 否则禁用 RA-Span 会连带它一起消失
4001
- ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'dsh-long', order: 30, label: 'dsh-long' }, DshLongSettingsSection))
4001
+ ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'dsh-long', order: 60, label: 'dsh-long' }, DshLongSettingsSection))
4002
4002
  // .dsh-glass-* 布局类(设置区排版)的 CSS 始终注入(不随 glass 开关丢失; 体积小)
4003
4003
  ctx.effect(() => {
4004
4004
  const style = document.createElement('style')
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
3
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, Markdown-to-Word (md2docx), and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Markdown 转 Word(md2docx)、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "entry": {
6
6
  "name": "dsh-long-plugins",
7
7
  "inject": [
package/lib/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * (which honours `config.trustedHosts`); file paths are resolved inside
13
13
  * their configured root so traversal is impossible.
14
14
  */
15
- import { createReadStream } from "node:fs";
15
+ import { createReadStream, readFileSync } from "node:fs";
16
16
  import { readFile, writeFile } from "node:fs/promises";
17
17
  import { link, lstat, mkdir, open, readdir, rename, stat, unlink } from "node:fs/promises";
18
18
  import { homedir } from "node:os";
@@ -28,6 +28,8 @@ import ExcelJS from "exceljs";
28
28
  // 插件根下的 client/vendor 目录(存放 docx-preview / jszip 前端库,供 docx 预览端点读取)。
29
29
  // 用 module 级定位,让 createHandlers / 各 handler 都能访问(不依赖 apply 内的 PACKAGE_DIR)。
30
30
  const VENDOR_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..", "client", "vendor");
31
+ // 插件当前版本(读 package.json),用于「插件升级时」的配置迁移(如默认关闭回合导航/RA-Span)
32
+ const PLUGIN_VERSION = (() => { try { return JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf8")).version || ""; } catch { return ""; } })();
31
33
 
32
34
  export const name = "dsh-long-plugins";
33
35
 
@@ -1629,7 +1631,7 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1629
1631
  inputBox: { light: { color: "", opacity: 1 }, dark: { color: "", opacity: 1 } },
1630
1632
  zone: { session: { color: "#1a2332", mask: 0.45, opacity: 0.5 }, input: { color: "#1a2332", mask: 0.6, opacity: 0.55 } },
1631
1633
  // 各模块开关(「dsh-long」设置区):false=禁用该模块功能(避免与 DSH 新版自带功能冲突/按需关闭)
1632
- modules: { glass: true, uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: true },
1634
+ modules: { glass: false, uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: false },
1633
1635
  };
1634
1636
  const glassDir = resolve(homedir(), ".dsh-long-plugins");
1635
1637
  const glassFile = join(glassDir, "glass.json");
@@ -1661,6 +1663,16 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1661
1663
  await writeFile(glassFile, JSON.stringify(cfg, null, 2), "utf8");
1662
1664
  } catch (_) {}
1663
1665
  }
1666
+ // 插件升级时:版本号变化 → 默认关闭「会话导航」「RA-Span」(避免与 DSH 新版自带功能冲突)
1667
+ if (PLUGIN_VERSION && cfg._pluginVersion !== PLUGIN_VERSION) {
1668
+ try {
1669
+ cfg.modules = { glass: false, uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: false, ...(cfg.modules || {}) };
1670
+ cfg.modules.glass = false;
1671
+ cfg.modules.turnRuler = false;
1672
+ cfg._pluginVersion = PLUGIN_VERSION;
1673
+ await writeFile(glassFile, JSON.stringify(cfg, null, 2), "utf8");
1674
+ } catch (_) {}
1675
+ }
1664
1676
  return cfg;
1665
1677
  } catch { return { ...GLASS_DEFAULTS }; }
1666
1678
  }
@@ -1687,7 +1699,7 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1687
1699
  bgColor: cfg.bgColor || "#1a2332", bgMask: cfg.bgMask ?? 0.28,
1688
1700
  bgBlur: cfg.bgBlur ?? 0, bgOpacity: cfg.bgOpacity ?? 1,
1689
1701
  turnRuler: (cfg.modules && cfg.modules.turnRuler) !== false,
1690
- modules: { glass: true, uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: true, ...(cfg.modules || {}) },
1702
+ modules: { glass: false, uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: false, ...(cfg.modules || {}) },
1691
1703
  bgImage: imgMeta,
1692
1704
  },
1693
1705
  bgImage: imgMeta,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, Markdown-to-Word (md2docx), and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Markdown 转 Word(md2docx)、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。",
5
5
  "type": "module",
6
6
  "license": "MIT",