@michengai/dsh-archive-manager 1.1.7 → 1.1.8

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
@@ -4,6 +4,13 @@
4
4
 
5
5
  Published release notes are retained below; new versions are added without removing earlier entries.
6
6
 
7
+ ## 1.1.8 - 2026-10-23
8
+
9
+ - Added primary sidebar navigation entry and dedicated workspace panel: users can now access Archive Manager directly from the first-level sidebar, opening a 960px centered workspace view. The entry can be toggled on or off at any time via the `sidebarEntry` switch in plugin configuration (`plugins.bundle.config` slot).
10
+ - Added toggleable online updates and host-level security locking: added an `onlineUpdate` switch in plugin configuration. Disabling it immediately hides the "Check for updates" button and version badge in the header, and rejects update requests at the endpoint level. Environments requiring security compliance or curated catalog distribution can enforce `updater: false` (or `onlineUpdate: false`) in Cordis patch configuration to disable the updater at startup and lock the UI toggle.
11
+ - Added baseURI dynamic endpoint resolution for reverse proxies: API requests now resolve against document `baseURI` to preserve path prefixes when DSH is hosted under a reverse proxy or subdirectory, preventing 404 errors on update and settings routes.
12
+ - Unified the online feedback button icon to use the host's native `IconEditOutlineRegular`.
13
+
7
14
  ## 1.1.7 - 2026-10-22
8
15
 
9
16
  - Fixed session titles or blank-session visibility changing after disabling Archive Manager (#71). The plugin no longer replaces the official projection-cache table; ordinary cache reads and writes remain host-owned.
@@ -4,6 +4,13 @@
4
4
 
5
5
  以下发布说明会持续保留;新增版本时不再删除较早记录。
6
6
 
7
+ ## 1.1.8 - 2026-10-23
8
+
9
+ - 新增主侧边栏直接导航入口与工作区主面板:支持在主界面一级侧边栏展示归档管理器图标入口,点击可直接切换至专属工作区主面板(960px 居中版心与独立滚动容器);可在插件详情页(`plugins.bundle.config` 槽位)随时开启或关闭 `sidebarEntry` 开关。
10
+ - 新增在线更新控制开关与宿主安全锁定:详情页新增「在线更新」原生开关,关闭后即时隐藏标题区「检查更新」按钮与版本提示徽标,并阻断更新请求;支持面向精选索引或企业合规环境在 Cordis 配置文件中声明 `updater: false`(或 `onlineUpdate: false`)硬锁定,启动时强制禁用且界面开关自动置灰。
11
+ - 支持反向代理与带路径前缀部署:前端 API 请求统一基于页面 `baseURI` 解析动态基准地址,完美适配反向代理路径前缀与二级目录部署,避免反代环境下更新与设置接口 404。
12
+ - 设置页标题栏的在线反馈按钮统一对齐宿主原生 `IconEditOutlineRegular` 图标。
13
+
7
14
  ## 1.1.7 - 2026-10-22
8
15
 
9
16
  - 修复停用归档插件后会话标题或空白会话显示异常的问题(#71):插件不再替换官方投影缓存表,日常读写始终由宿主负责。
package/README.md CHANGED
@@ -95,6 +95,39 @@ dsh plugin --profile web add @michengai/dsh-archive-manager@latest --registry=ht
95
95
 
96
96
  Restart DSH Web, then hard-refresh your browser with `Ctrl+Shift+R`. Open **Settings → Archived sessions** to get started.
97
97
 
98
+ - **Reverse proxy deployment**: Supports hosting DSH behind prefix-stripping reverse proxies (e.g. `/app/dsh/`). API and update endpoints automatically resolve against the page base URI (`document.baseURI`), preventing 404 errors caused by lost prefix segments.
99
+
100
+ ## Plugin Configuration & Toggles
101
+
102
+ The plugin follows standard DSH bundle configuration conventions. Options are located at:
103
+ > **Sidebar → Plugins → Click `@michengai/dsh-archive-manager`** (the host's `plugins.bundle.config` slot).
104
+
105
+ Two native switches are available. Their values are persisted in `archive-manager/settings.json` under your local configuration directory and survive restarts; they are not two equivalent Cordis YAML options. `sidebarEntry` is managed through this UI, while `onlineUpdate` is also subject to the host lock described below:
106
+
107
+ ### 1. Sidebar Entry (`sidebarEntry`)
108
+ - **Default**: Disabled (`false`)
109
+ - **Description**: Displays a persistent **Archived sessions** navigation icon in the host's left primary sidebar.
110
+ - **Effect**:
111
+ - When enabled, clicking the sidebar icon opens the Archive Manager directly in the primary workspace with a **960px centered container** (matching host plugin manager conventions). This eliminates vertical scrolling constraints in narrow settings dialogs;
112
+ - When disabled, unregisters the sidebar entry cleanly (and resets active panel gracefully if currently viewing the panel, preventing blank views);
113
+ - The standard **Settings → Archived sessions** view remains active either way, and state is synchronized live across both entry points.
114
+
115
+ ### 2. Online Updates (`onlineUpdate` / `updater`)
116
+ - **Default**: Enabled (`true`)
117
+ - **Description**: Controls whether the plugin checks for and installs updates from npm.
118
+ - **Effect**:
119
+ - **Dynamic UI Sync**: Disabling the toggle hides the **Check for updates** button and version badge in the header immediately without requiring a full page reload;
120
+ - **Endpoint Guard**: When disabled, the update API route returns `HTTP 403` for all check and install requests, preventing unreviewed updates;
121
+ - **Host / Platform Lock**: For curated plugin indexes (such as VibeDev) or restricted enterprise environments, this can be locked directly via Cordis configuration (bundle patch) without needing UI interaction:
122
+ ```yaml
123
+ - insert:
124
+ - id: ui-workspace-archive-manager
125
+ name: '@michengai/dsh-archive-manager'
126
+ config:
127
+ updater: false # or onlineUpdate: false
128
+ ```
129
+ Once configured, the updater is disabled at startup, the update action stays hidden, and the online-update switch is disabled. The host lock takes precedence over the user's choice in settings.json and cannot be lifted through the UI. Removing the host lock restores the saved user preference.
130
+
98
131
  ## Usage
99
132
 
100
133
  | Goal | Action |
package/README.zh-CN.md CHANGED
@@ -99,6 +99,39 @@ dsh plugin --profile web add @michengai/dsh-archive-manager@latest --registry=ht
99
99
 
100
100
  安装后重启 DSH Web,并按 `Ctrl+Shift+R` 硬刷新浏览器。打开「设置 → 归档会话」即可使用。
101
101
 
102
+ - **反向代理部署**:支持将 DSH 部署在带路径前缀的反向代理后面(如 `/app/dsh/`),插件 API 与更新检查端点统一自动按页面基址(`document.baseURI`)相对解析,避免丢失代理路径前缀导致 404。
103
+
104
+ ## 插件配置与可选开关
105
+
106
+ 插件遵循 DSH 官方扩展配置规范,配置项位于:
107
+ > **主界面侧边栏「插件」→ 点击 `@michengai/dsh-archive-manager` 详情页**(对应宿主 `plugins.bundle.config` 槽位)。
108
+
109
+ 此处提供两个原生扁平行开关。界面开关值保存在本地配置 `archive-manager/settings.json` 中,重启后保留;它们不是两个等价的 Cordis YAML 配置项。`sidebarEntry` 只通过此界面管理,`onlineUpdate` 另受下述宿主锁定规则约束:
110
+
111
+ ### 1. 侧边栏入口 (`sidebarEntry`)
112
+ - **默认状态**:关闭(`false`)
113
+ - **功能说明**:在宿主左侧主导航栏增加常驻的 **「归档会话」** 图标入口。
114
+ - **生效效果**:
115
+ - 开启后,在侧边栏点击即可直达归档中心,并在主工作区以 **960px 居中版心**(对齐官方插件管理规范)展开完整大面板,彻底告别在设置弹窗狭窄视口内滚动的局限;
116
+ - 关闭后安全注销侧栏槽位(若当前正停留在归档大面板,会自动安全切回默认视图,防止悬空和白屏);
117
+ - 无论是否开启侧栏入口,DSH 原有的「设置 → 归档会话」入口始终保留,两处界面数据与操作 100% 实时同步。
118
+
119
+ ### 2. 在线更新 (`onlineUpdate` / `updater`)
120
+ - **默认状态**:开启(`true`)
121
+ - **功能说明**:控制是否允许在线检查并安装归档管理器的新版本。
122
+ - **生效效果**:
123
+ - **界面联动**:关闭开关后,归档管理面板标题旁的「检查更新」按钮与版本提示徽标将即时隐藏,无需刷新页面;开启后自动恢复展示;
124
+ - **接口安全拦截**:关闭后,服务端的更新路由对任何版本检查和安装请求均返回 `HTTP 403` 禁用状态,彻底杜绝在插件内安装未审核版本;
125
+ - **宿主/平台级锁定**:面向精选插件索引(如 VibeDev)或企业安全合规环境,支持直接在 Cordis 配置文件(bundle patch)中声明,无需进入界面手动配置:
126
+ ```yaml
127
+ - insert:
128
+ - id: ui-workspace-archive-manager
129
+ name: '@michengai/dsh-archive-manager'
130
+ config:
131
+ updater: false # 或 onlineUpdate: false
132
+ ```
133
+ 配置生效后,更新器在启动时即被禁用,更新入口隐藏,详情页在线更新开关置灰。宿主锁定优先于本地配置中的用户选择,界面不能解除锁定;宿主移除锁定后,重新按已保存的用户选择生效。
134
+
102
135
  ## 使用
103
136
 
104
137
  | 你想做什么 | 操作 |
@@ -0,0 +1,32 @@
1
+ function pageBaseHref() {
2
+ const doc = globalThis.document;
3
+ if (typeof doc === "undefined" || doc === null) return void 0;
4
+ const raw = doc.baseURI;
5
+ if (typeof raw !== "string" || raw === "") return void 0;
6
+ try {
7
+ const url = new URL(raw);
8
+ const lastSlash = url.pathname.lastIndexOf("/");
9
+ const lastSegment = url.pathname.slice(lastSlash + 1);
10
+ if (/\.(html?|php|aspx?|jsp)$/i.test(lastSegment)) {
11
+ url.pathname = url.pathname.slice(0, lastSlash + 1);
12
+ } else if (!url.pathname.endsWith("/")) {
13
+ url.pathname += "/";
14
+ }
15
+ return url.href;
16
+ } catch {
17
+ return void 0;
18
+ }
19
+ }
20
+ function resolveApiUrl(path) {
21
+ if (typeof path !== "string" || path.charAt(0) !== "/" || path.charAt(1) === "/") return path;
22
+ const base = pageBaseHref();
23
+ if (base === void 0) return path;
24
+ try {
25
+ return new URL(path.slice(1), base).href;
26
+ } catch {
27
+ return path;
28
+ }
29
+ }
30
+ export {
31
+ resolveApiUrl
32
+ };