Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(updates): hide HTML comment markers in release notes

t8y2cb16b0f8bec1
diff --git a/apps/desktop/src/components/layout/UpdateDialog.spec.ts b/apps/desktop/src/components/layout/UpdateDialog.spec.ts
index bfaa95c286..3c5bc1d886 100644
--- a/apps/desktop/src/components/layout/UpdateDialog.spec.ts
+++ b/apps/desktop/src/components/layout/UpdateDialog.spec.ts
@@ -402,6 +402,15 @@ describe("UpdateDialog release notes safety", () => {
expect(document.body.querySelector("script, img")).toBeNull();
expect(Array.from(document.body.querySelectorAll("a")).every((anchor) => anchor.href.startsWith("https://"))).toBe(true);
});
+
+ it("hides HTML comments such as the CNB mirror marker instead of rendering them as text", async () => {
+ await mountDialog(0, { releaseNotes: "### 安装\n- 条目\n\n<!-- dbx-cnb-mirror -->\n> 国内下载:[CNB 镜像](https://cnb.cool/dbxio.com/dbx/-/releases)" });
+ await vi.waitFor(() => {
+ expect(document.body.querySelector('a[href^="https://cnb.cool"]')).not.toBeNull();
+ });
+ expect(document.body.textContent).not.toContain("dbx-cnb-mirror");
+ expect(document.body.textContent).not.toContain("<!--");
+ });
});
describe("UpdateDialog older versions", () => {
diff --git a/apps/desktop/src/components/layout/UpdateDialog.vue b/apps/desktop/src/components/layout/UpdateDialog.vue
index 6d696df25b..ba5ba404f5 100644
--- a/apps/desktop/src/components/layout/UpdateDialog.vue
+++ b/apps/desktop/src/components/layout/UpdateDialog.vue
@@ -259,7 +259,8 @@ watch(
image: ({ text }) => escapeHtml(text),
},
});
- renderedNotes.value = marked.parse(notes) as string;
+ // 已发布正文里的 HTML 注释(如 CNB 镜像幂等标记)在 GitHub 上不可见,转义前先剥离,避免以字面文本露出
+ renderedNotes.value = marked.parse(notes.replace(/<!--[\s\S]*?-->/g, "")) as string;
},
{ immediate: true },
);