dsh-deepseek-chat 0.1.9 → 0.1.10
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/README.md +4 -4
- package/lib/build-manifest.json +8 -8
- package/lib/client.js +173 -78
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
CHAT模式 加载真实的 [DeepSeek Chat 官网](https://chat.deepseek.com/),使用官网的聊天功能和账号历史;HARNESS模式 为原 DSH 工作区。
|
|
6
6
|
|
|
7
|
-
当前版本 **0.1.
|
|
7
|
+
当前版本 **0.1.10** · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
|
|
8
8
|
|
|
9
9
|
## 功能预览
|
|
10
10
|
|
|
@@ -76,7 +76,7 @@ dsh plugin --profile desktop add https://github.com/xingxingbk-git/dsh-deepseek-
|
|
|
76
76
|
将构建生成的 `.tgz` 文件交给 DSH 官方插件管理器安装,或使用 CLI:
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.
|
|
79
|
+
dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.10.tgz
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
将路径替换成你的实际安装包;使用其他 profile 时替换 `desktop`。**安装或更新后,完整退出并重新打开 DSH**,让新插件生效。
|
|
@@ -98,7 +98,7 @@ dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.9.tgz
|
|
|
98
98
|
## 使用限制
|
|
99
99
|
|
|
100
100
|
- **兼容范围:**目前针对 DSH 0.2.0-rc.2 桌面版适配,其他版本和平台待验证;DSH Web版暂不支持本插件的 CHAT 模式。
|
|
101
|
-
- **官网导航:**左侧列表依赖官网页面结构,只镜像已加载的导航,不是官方历史 API
|
|
101
|
+
- **官网导航:**左侧列表依赖官网页面结构,只镜像已加载的导航,不是官方历史 API。结构不匹配时恢复官网原导航并自动重新识别;恢复后同步左侧列表和 CHAT设置。
|
|
102
102
|
- **新建快捷键:**本版适配顶部“新会话”的鼠标/Enter 点击;原 Harness 快捷键和菜单仍执行 Harness 行为,可能创建 Harness 会话并退出 CHAT。
|
|
103
103
|
- **登录记忆:**不共享 Safari/Chrome 登录,独立于 DSH 平台账号。授权过期、撤销或官网实现变化时需要重新登录;新版独立登录、退出重登、完整卸载和其他平台仍需扩大实机验证。
|
|
104
104
|
- **网页状态:**手动模式切换保留网页;插件停用、卸载或 DSH 完全退出会销毁容器,插件不备份未发送草稿,也不能代替官网停止生成。
|
|
@@ -123,7 +123,7 @@ pnpm install --frozen-lockfile
|
|
|
123
123
|
pnpm package:plugin
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
生成 `artifacts/dsh-deepseek-chat-0.1.
|
|
126
|
+
生成 `artifacts/dsh-deepseek-chat-0.1.10.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
|
|
127
127
|
|
|
128
128
|
修改源码后执行 `pnpm release:prepare`,并将源码与整个 `lib/` 一起提交。`pnpm check:distribution` 会检查编译产物与源码、版本及安装入口是否一致;旧产物或缺失文件会使检查失败。安装用户不需要执行这些开发命令。
|
|
129
129
|
|
package/lib/build-manifest.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
3
|
"name": "dsh-deepseek-chat",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.10",
|
|
5
5
|
"inputs": {
|
|
6
6
|
"assets/icon.svg": "ad1b0fda90c1c1f2a0b9208bc86f5fe8c21d505a1208576be4e3110b26b4f79c",
|
|
7
7
|
"cordis.patch.yml": "05edb71cd276de1251ae67644ec68b54efc26258814956fa0e932d36da741bdc",
|
|
8
|
-
"package.json": "
|
|
8
|
+
"package.json": "d3604956f5a0cedab38287d3d665bab0653af9940d9adfb2301ffd1c13715a38",
|
|
9
9
|
"pnpm-lock.yaml": "c4f600b0d599b85f6181d295cd5f9f06f1eb0435eeeb2e7cf1a376b3c6a4ca15",
|
|
10
10
|
"scripts/build.mjs": "a9a2961e09fb16b99e206c4d191c9e970a4a3999979df9a626fa310c0fdee5b1",
|
|
11
11
|
"scripts/check-artifact.mjs": "6fec38fb74e41dfeacef7147280c69854087d0665747d7d65137cc98f9dc673b",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"scripts/client-contract.mjs": "1e212575218fc985f4405e2eac98b33a969494ff6b2144b1204a6d66963ba894",
|
|
14
14
|
"scripts/distribution-manifest.mjs": "e746c447b03b0e9a86efce7827bbd5d9184c6ccd1f1f0f1c9eb12abfe1b2f3b7",
|
|
15
15
|
"src/authorization.ts": "5f0c1b69e43541ce606349047788df72e442e9cbb3267c8c0caf2c0f556a5589",
|
|
16
|
-
"src/client.ts": "
|
|
16
|
+
"src/client.ts": "3b60eb6a9f3625c9b1c344713907631f9213ba54f797a2d4c67e4ffe7d4e6da6",
|
|
17
17
|
"src/core/mode.ts": "2fe56c319706d86746010bd5551f4ee47e31e12a0ee28effffb719b0696ad70c",
|
|
18
18
|
"src/index.ts": "59edf0d6af2feec3e08da322cabc07a2dc83868312c4daa1074b2a5b12892f57",
|
|
19
19
|
"src/protocol.ts": "5194007a0c06f7b293cc34579ccdc150c23c35b825091667f37a7293594bd29f",
|
|
20
20
|
"src/server.ts": "295c52235fa399967a594b76b1f4c869adccc978ee3c0f3f8f3a12894b81ef9b",
|
|
21
21
|
"src/sidebar-adapter.ts": "edcc051bbcaabb2d09055b231f57253a50a6d9e75acf18adafbf262001b18a48",
|
|
22
|
-
"src/styles.ts": "
|
|
23
|
-
"src/ui.tsx": "
|
|
24
|
-
"src/web-surface.tsx": "
|
|
22
|
+
"src/styles.ts": "24a03f8c96b8966aae0a1b7df2a6bbb13390ee22ec17a7ff9126f7da2259c8cf",
|
|
23
|
+
"src/ui.tsx": "fd08c974ea997794d06a2270f4d0da789ce879327dc7149fcd4f63d3ffca35e3",
|
|
24
|
+
"src/web-surface.tsx": "ad423c66b639ea853a59e7ef1b656226e3b0e8df5d21aefb95df967022e6fef3",
|
|
25
25
|
"src/website-header.ts": "ac4972a28a5f0968de4d5f98d54fbac853f901c7eda00c0849984a2e66f291f3",
|
|
26
|
-
"src/website-navigation.ts": "
|
|
26
|
+
"src/website-navigation.ts": "0c70ef6a518d2ba051be0f9094d92cad33ead42815c52742a93835247331dd1c",
|
|
27
27
|
"src/website-notice.ts": "65c781bec41e6c2e541d9512cc0051864d64fc3204b3ba5f2e005bdc955f39c9",
|
|
28
28
|
"src/website-session-store.ts": "8ef6d49465e0034f12b763a666b4a90c8c9819fb8baea06dcaba340fd97d72f1",
|
|
29
29
|
"src/website-session.ts": "f2434fafc40adb15b5f16fc8b6152bd8df7e85f5210330a1337502c9a08136d8",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"tsconfig.json": "1ad0b3b39537564a180dc7f4084ceb3098b567f509320c77d71bc37aaf4f1879"
|
|
32
32
|
},
|
|
33
33
|
"artifacts": {
|
|
34
|
-
"lib/client.js": "
|
|
34
|
+
"lib/client.js": "c380faa909eb794101949a7621dab657508cd393e67b246f33912fc50bf08a96",
|
|
35
35
|
"lib/index.js": "e9c50cc544f24c60d086538ab1283ae0ed2811f23c9bb469916a2e89c3ffb38d",
|
|
36
36
|
"lib/types/authorization.d.ts": "130649eed3635e75c3f50c13de93c52440a27f1b88136ab2297552570c013d49",
|
|
37
37
|
"lib/types/client.d.ts": "a79702d5d86c75e81f1e954b3e9f4a562a6b3082d68d798d6a1b37bd41b908a7",
|
package/lib/client.js
CHANGED
|
@@ -14797,7 +14797,7 @@ window.__ModuleLoader__.load({
|
|
|
14797
14797
|
.dsh-chat-settings{font-family:var(--dsw-font-family,system-ui);color:var(--dsw-alias-label-primary);font-size:14px;min-width:0}.dsh-chat-settings h2{margin:0 0 20px;font-size:20px}
|
|
14798
14798
|
.dsh-chat-settings-pane-hidden{height:1px!important;min-height:1px!important;background:transparent!important;overflow:hidden!important}.dsh-chat-settings-card{border:1px solid var(--dsw-alias-border-primary,#ffffff15);border-radius:12px;padding:24px;background:var(--dsw-alias-bg-base,#202124)}.dsh-chat-settings-language{display:flex;align-items:center;justify-content:space-between;gap:24px;border-top:1px solid #ffffff15;padding-top:20px}.dsh-chat-settings-select{position:relative;display:inline-flex;flex:none;min-width:140px}.dsh-chat-settings-language select{box-sizing:border-box;width:100%;appearance:none;-webkit-appearance:none;font:inherit;color:inherit;background:var(--dsw-alias-bg-base,#202124);border:1px solid #ffffff25;border-radius:8px;padding:8px 38px 8px 12px;min-width:140px}.dsh-chat-settings-select-arrow{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:12px;height:12px;pointer-events:none}.dsh-chat-settings-language select:disabled+.dsh-chat-settings-select-arrow{opacity:.4}.dsh-chat-settings-account p,.dsh-chat-settings-progress{font-size:12px;color:var(--dsw-alias-label-secondary,#aaa)}
|
|
14799
14799
|
.dsh-chat-settings-pane{position:relative;height:min(500px,calc(100vh - 340px));min-height:220px;border-radius:12px;overflow:hidden;background:#292a2d}
|
|
14800
|
-
.dsh-chat-settings-account{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}.dsh-chat-settings-account button{padding:8px 14px;border:1px solid #ff5f64;border-radius:8px;background:transparent;color:#ff5f64;cursor:pointer;font:inherit}.dsh-chat-settings-account button:disabled{opacity:.4;cursor:default}
|
|
14800
|
+
.dsh-chat-settings-account{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px;min-width:0}.dsh-chat-settings-account>div{flex:1 1 0%;min-width:0;max-width:100%}.dsh-chat-settings-account strong{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-chat-settings-account button{flex-shrink:0;white-space:nowrap;padding:8px 14px;border:1px solid #ff5f64;border-radius:8px;background:transparent;color:#ff5f64;cursor:pointer;font:inherit}.dsh-chat-settings-account button:disabled{opacity:.4;cursor:default}
|
|
14801
14801
|
.dsh-chat-settings-error{color:#ff8585;line-height:1.5;font-size:12px}
|
|
14802
14802
|
`;
|
|
14803
14803
|
|
|
@@ -14916,7 +14916,7 @@ window.__ModuleLoader__.load({
|
|
|
14916
14916
|
] }),
|
|
14917
14917
|
searching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { className: "dsh-chat-navigation-search", "aria-label": "\u641C\u7D22\u5DF2\u52A0\u8F7D\u7684\u5B98\u7F51\u5BF9\u8BDD\u6807\u9898", placeholder: "\u641C\u7D22\u5BF9\u8BDD", value: query, onChange: (event) => setQuery(event.target.value), autoFocus: true }),
|
|
14918
14918
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-navigation-list", children: [
|
|
14919
|
-
navigation.authenticated === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
14919
|
+
navigation.authenticated === true && navigation.status === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
14920
14920
|
[...groups].map(([label, rows]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-chat-conversation-group", "aria-label": label, children: [
|
|
14921
14921
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: label }),
|
|
14922
14922
|
rows.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-conversation-row", title: item.title, "aria-current": navigation.selectedHref === item.href ? "page" : void 0, onClick: () => bridge.commandWebsite({ type: "open", href: item.href }), children: item.title }, item.href))
|
|
@@ -15006,18 +15006,19 @@ window.__ModuleLoader__.load({
|
|
|
15006
15006
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
|
|
15007
15007
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "CHAT\u8BBE\u7F6E" }),
|
|
15008
15008
|
enabled && navigation.authenticated === true && state.websiteAuthenticationStatus !== "signing-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card", children: [
|
|
15009
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-account", children: [
|
|
15009
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-account", role: "group", "aria-label": "DeepSeek \u5B98\u7F51\u8D26\u53F7", children: [
|
|
15010
15010
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
15011
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: navigation.accountName || "DeepSeek Chat" }),
|
|
15011
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { title: navigation.accountName || "DeepSeek Chat", children: navigation.accountName || "DeepSeek Chat" }),
|
|
15012
15012
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u5DF2\u767B\u5F55" })
|
|
15013
15013
|
] }),
|
|
15014
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.logoutWebsite(), children: "\u9000\u51FA\u767B\u5F55" })
|
|
15014
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: navigation.status !== "ready", onClick: () => bridge.logoutWebsite(), children: "\u9000\u51FA\u767B\u5F55" })
|
|
15015
15015
|
] }),
|
|
15016
15016
|
state.websiteSessionStatus === "saved" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: "\u5DF2\u8BB0\u4F4F\u7F51\u9875\u767B\u5F55\u3002\u4E0B\u6B21\u542F\u52A8\u4F1A\u7531\u5B98\u7F51\u9A8C\u8BC1\u5E76\u6062\u590D\uFF1B\u6388\u6743\u5931\u6548\u65F6\u9700\u91CD\u65B0\u767B\u5F55\u3002" }),
|
|
15017
|
+
navigation.status !== "ready" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-settings-progress", role: "status", children: "\u6B63\u5728\u91CD\u65B0\u8BC6\u522B\u5B98\u7F51\u9875\u9762\uFF0C\u8D26\u53F7\u767B\u5F55\u72B6\u6001\u4FDD\u6301\u4E0D\u53D8\u3002" }),
|
|
15017
15018
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-chat-settings-language", children: [
|
|
15018
15019
|
"\u7CFB\u7EDF\u8BED\u8A00",
|
|
15019
15020
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dsh-chat-settings-select", children: [
|
|
15020
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { "aria-label": "CHAT\u7CFB\u7EDF\u8BED\u8A00", value: language, disabled: settings?.pending || state.websiteAuthenticationStatus === "error", onChange: (event) => bridge.commandWebsite({ type: "setting", key: "language", value: event.target.value }), children: [
|
|
15021
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { "aria-label": "CHAT\u7CFB\u7EDF\u8BED\u8A00", value: language, disabled: navigation.status !== "ready" || settings?.pending || state.websiteAuthenticationStatus === "error", onChange: (event) => bridge.commandWebsite({ type: "setting", key: "language", value: event.target.value }), children: [
|
|
15021
15022
|
!language && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", hidden: true }),
|
|
15022
15023
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "system", children: "\u8DDF\u968F\u7CFB\u7EDF" }),
|
|
15023
15024
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "zh-CN", children: "\u7B80\u4F53\u4E2D\u6587" }),
|
|
@@ -15026,12 +15027,12 @@ window.__ModuleLoader__.load({
|
|
|
15026
15027
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: "dsh-chat-settings-select-arrow", viewBox: "0 0 12 12", "aria-hidden": "true", focusable: "false", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m2 4 4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
15027
15028
|
] })
|
|
15028
15029
|
] }),
|
|
15029
|
-
!language && !settings?.pending && !settings?.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-chat-settings-progress", role: "status", children: [
|
|
15030
|
+
!language && navigation.status === "ready" && !settings?.pending && !settings?.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-chat-settings-progress", role: "status", children: [
|
|
15030
15031
|
"\u5C1A\u672A\u8BFB\u53D6\u5230\u5B98\u7F51\u8BED\u8A00\u3002",
|
|
15031
15032
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.commandWebsite({ type: "settings-read" }), children: "\u91CD\u8BD5" })
|
|
15032
15033
|
] }),
|
|
15033
|
-
settings?.pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-settings-progress", role: "status", children: "\u6B63\u5728\u540C\u6B65\u7F51\u9875\u8BBE\u7F6E\u2026" }),
|
|
15034
|
-
settings?.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-chat-settings-error", role: "alert", children: [
|
|
15034
|
+
navigation.status === "ready" && settings?.pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-settings-progress", role: "status", children: "\u6B63\u5728\u540C\u6B65\u7F51\u9875\u8BBE\u7F6E\u2026" }),
|
|
15035
|
+
navigation.status === "ready" && settings?.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-chat-settings-error", role: "alert", children: [
|
|
15035
15036
|
settings.error,
|
|
15036
15037
|
" ",
|
|
15037
15038
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.commandWebsite({ type: "settings-read" }), children: "\u91CD\u8BD5" })
|
|
@@ -15056,9 +15057,9 @@ window.__ModuleLoader__.load({
|
|
|
15056
15057
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.logoutWebsite(), children: "\u91CD\u8BD5\u9000\u51FA\u767B\u5F55" })
|
|
15057
15058
|
] }),
|
|
15058
15059
|
enabled && state.websiteAuthenticationStatus !== "signing-out" && navigation.authenticated !== true && navigation.status !== "sign-in" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "status", children: [
|
|
15059
|
-
state.webError || (navigation.status === "unsupported" ? "\u6682\
|
|
15060
|
+
state.webError || (navigation.status === "unsupported" ? "\u5B98\u7F51\u9875\u9762\u5DF2\u6253\u5F00\uFF0C\u6682\u672A\u8BC6\u522B\u5230\u8D26\u53F7\u548C\u5BF9\u8BDD\u533A\u57DF\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002" : "\u6B63\u5728\u8BC6\u522B DeepSeek \u5B98\u7F51\u767B\u5F55\u72B6\u6001\u2026"),
|
|
15060
15061
|
" ",
|
|
15061
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.reloadWebsite(), children: "\u91CD\
|
|
15062
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.reloadWebsite(), children: "\u91CD\u65B0\u52A0\u8F7D" })
|
|
15062
15063
|
] }),
|
|
15063
15064
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: pane, className: `dsh-chat-settings-pane${enabled && state.websiteAuthenticationStatus === "signing-in" ? "" : " dsh-chat-settings-pane-hidden"}`, "aria-label": "CHAT\u5B98\u7F51\u767B\u5F55\u533A\u57DF" })
|
|
15064
15065
|
] });
|
|
@@ -15410,16 +15411,21 @@ window.__ModuleLoader__.load({
|
|
|
15410
15411
|
const missingSidebarMarker = "data-dsh-chat-sidebar-missing-at";
|
|
15411
15412
|
const fallbackMarker = "data-dsh-chat-fallback";
|
|
15412
15413
|
const fallbackErrorMarker = "data-dsh-chat-fallback-error";
|
|
15414
|
+
const profileMarker = "data-dsh-chat-profile";
|
|
15415
|
+
const profileProofMarker = "data-dsh-chat-profile-confirmed";
|
|
15416
|
+
const profileAvatarMarker = "data-dsh-chat-profile-avatar";
|
|
15417
|
+
const navigationWidthMarker = "data-dsh-chat-navigation-width";
|
|
15413
15418
|
const conversationError = "\u8BE5\u5BF9\u8BDD\u4E0D\u5728\u5F53\u524D\u5B98\u7F51\u5217\u8868\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u3002";
|
|
15414
15419
|
const styleId = "dsh-chat-website-navigation-style";
|
|
15415
15420
|
const preparingStyleId = "dsh-chat-website-preparing-style";
|
|
15416
|
-
const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, "data-dsh-chat-layout", "data-dsh-chat-content", "data-dsh-chat-web-chrome", "data-dsh-chat-
|
|
15417
|
-
const empty = (status) => ({ status, authenticated: false, conversations: [], selectedHref: null, canCreate: false, error: null });
|
|
15418
|
-
const clearSettings = () => {
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15421
|
+
const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, "data-dsh-chat-layout", "data-dsh-chat-content", "data-dsh-chat-web-chrome", "data-dsh-chat-settings-dialog", "data-dsh-chat-settings-host", "data-dsh-chat-settings-tabs", "data-dsh-chat-settings-pane", "data-dsh-chat-settings-layout", "data-dsh-chat-settings-chrome", "data-dsh-chat-settings-appearance", "data-dsh-chat-expanding", "data-dsh-chat-header-row", "data-dsh-chat-header-title", "data-dsh-chat-header-share", "data-dsh-chat-header-title-host", "data-dsh-chat-header-editor", "data-dsh-chat-header-native-depth"];
|
|
15422
|
+
const empty = (status) => ({ status, ...status === "sign-in" ? { authenticated: false } : {}, conversations: [], selectedHref: null, canCreate: false, error: null });
|
|
15423
|
+
const clearSettings = (preserveConfirmedPreferences = false) => {
|
|
15424
|
+
const confirmed = ["data-dsh-chat-language", "data-dsh-chat-theme", "data-dsh-chat-dark-complete", "data-dsh-chat-settings-restored"];
|
|
15425
|
+
for (const attr of [...doc.documentElement.attributes]) if (/^data-dsh-chat-(settings-|language$|theme$|dark-complete$)/.test(attr.name) && !(preserveConfirmedPreferences && confirmed.includes(attr.name))) doc.documentElement.removeAttribute(attr.name);
|
|
15426
|
+
};
|
|
15427
|
+
const restore = (preserveConfirmedPreferences = false) => {
|
|
15428
|
+
clearSettings(preserveConfirmedPreferences);
|
|
15423
15429
|
doc.getElementById(styleId)?.remove();
|
|
15424
15430
|
doc.getElementById("dsh-chat-header-style")?.remove();
|
|
15425
15431
|
doc.documentElement.style.removeProperty("--dsh-chat-title-inset");
|
|
@@ -15430,7 +15436,7 @@ window.__ModuleLoader__.load({
|
|
|
15430
15436
|
owned.forEach((attr) => doc.querySelectorAll(`[${attr}]`).forEach((node2) => node2.removeAttribute(attr)));
|
|
15431
15437
|
};
|
|
15432
15438
|
const fallback = (error51 = null) => {
|
|
15433
|
-
restore();
|
|
15439
|
+
restore(page.origin === origin && !/^\/sign_in\/?$/.test(page.pathname) && command.type !== "restore");
|
|
15434
15440
|
if (page.origin === origin && /^\/sign_in\/?$/.test(page.pathname)) return empty("sign-in");
|
|
15435
15441
|
if (!(command.type === "snapshot" && command.showOriginal)) {
|
|
15436
15442
|
doc.documentElement.setAttribute(fallbackMarker, "");
|
|
@@ -15438,6 +15444,8 @@ window.__ModuleLoader__.load({
|
|
|
15438
15444
|
}
|
|
15439
15445
|
return { ...empty("unsupported"), error: error51 === "open" ? conversationError : null };
|
|
15440
15446
|
};
|
|
15447
|
+
const fallbackNavigation = () => ({ ...empty("unsupported"), error: doc.documentElement.getAttribute(fallbackErrorMarker) === "open" ? conversationError : null });
|
|
15448
|
+
const isOriginalSnapshot = command.type === "snapshot" && command.showOriginal;
|
|
15441
15449
|
if (page.origin !== origin) return fallback();
|
|
15442
15450
|
if (command.type !== "restore") dismissWebsiteEnvironmentNotice(doc);
|
|
15443
15451
|
if (command.type === "restore" || command.type === "snapshot" && command.showOriginal) {
|
|
@@ -15445,9 +15453,7 @@ window.__ModuleLoader__.load({
|
|
|
15445
15453
|
if (command.type === "restore") return fallback();
|
|
15446
15454
|
restore();
|
|
15447
15455
|
}
|
|
15448
|
-
|
|
15449
|
-
return { ...empty("unsupported"), error: doc.documentElement.getAttribute(fallbackErrorMarker) === "open" ? conversationError : null };
|
|
15450
|
-
}
|
|
15456
|
+
const recovering = doc.documentElement.hasAttribute(fallbackMarker);
|
|
15451
15457
|
if (!(command.type === "snapshot" && command.showOriginal) && !doc.documentElement.hasAttribute("data-dsh-chat-observing") && doc.defaultView) {
|
|
15452
15458
|
doc.documentElement.setAttribute("data-dsh-chat-observing", "");
|
|
15453
15459
|
let queued = false;
|
|
@@ -15470,7 +15476,7 @@ window.__ModuleLoader__.load({
|
|
|
15470
15476
|
restore();
|
|
15471
15477
|
return empty("sign-in");
|
|
15472
15478
|
}
|
|
15473
|
-
if (!
|
|
15479
|
+
if (!isOriginalSnapshot && !recovering && !doc.documentElement.hasAttribute(presentedMarker) && !doc.documentElement.hasAttribute("data-dsh-chat-dark-complete")) {
|
|
15474
15480
|
doc.documentElement.setAttribute("data-dsh-chat-preparing", "");
|
|
15475
15481
|
if (!doc.getElementById(preparingStyleId)) {
|
|
15476
15482
|
const style = doc.createElement("style");
|
|
@@ -15499,8 +15505,8 @@ window.__ModuleLoader__.load({
|
|
|
15499
15505
|
};
|
|
15500
15506
|
const isNavigationColumn = (candidate) => {
|
|
15501
15507
|
const rect = candidate.getBoundingClientRect();
|
|
15502
|
-
const
|
|
15503
|
-
return rect.left >= -1 && rect.left <= 16 && rect.top >= -1 && rect.top <= 32 && rect.width >= 160 && rect.width <= 480 && rect.height >= Math.max(200,
|
|
15508
|
+
const viewportHeight2 = doc.defaultView?.innerHeight ?? 600;
|
|
15509
|
+
return rect.left >= -1 && rect.left <= 16 && rect.top >= -1 && rect.top <= 32 && rect.width >= 160 && rect.width <= 480 && rect.height >= Math.max(200, viewportHeight2 * 0.75) && !candidate.querySelector('textarea,[contenteditable="true"]');
|
|
15504
15510
|
};
|
|
15505
15511
|
const allLinks = [...doc.querySelectorAll("a[href]")].filter((link) => safeHref(link.getAttribute("href")));
|
|
15506
15512
|
let sidebar = doc.querySelector(`[${marker}]`);
|
|
@@ -15526,16 +15532,17 @@ window.__ModuleLoader__.load({
|
|
|
15526
15532
|
}
|
|
15527
15533
|
}
|
|
15528
15534
|
const newChat = sidebar ? findNew(sidebar) : null;
|
|
15535
|
+
const structureExpired = () => {
|
|
15536
|
+
const now = Date.now();
|
|
15537
|
+
const previous = Number(doc.documentElement.getAttribute(missingSidebarMarker));
|
|
15538
|
+
const started = Number.isFinite(previous) && previous > 0 ? previous : now;
|
|
15539
|
+
if (started !== previous) doc.documentElement.setAttribute(missingSidebarMarker, String(started));
|
|
15540
|
+
return now - started >= 5e3;
|
|
15541
|
+
};
|
|
15529
15542
|
if (!sidebar || !newChat) {
|
|
15530
|
-
if (
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
const started = Number.isFinite(previous) && previous > 0 ? previous : now;
|
|
15534
|
-
if (started !== previous) doc.documentElement.setAttribute(missingSidebarMarker, String(started));
|
|
15535
|
-
if (now - started < 5e3) return empty("loading");
|
|
15536
|
-
return fallback();
|
|
15537
|
-
}
|
|
15538
|
-
if (!(command.type === "snapshot" && command.showOriginal)) {
|
|
15543
|
+
if (recovering) return fallbackNavigation();
|
|
15544
|
+
if (isOriginalSnapshot || structureExpired()) return fallback();
|
|
15545
|
+
if (!doc.documentElement.hasAttribute(presentedMarker) && !doc.documentElement.hasAttribute("data-dsh-chat-expanding")) {
|
|
15539
15546
|
const compact = [...doc.querySelectorAll("div,header")].find((el) => {
|
|
15540
15547
|
const r = el.getBoundingClientRect();
|
|
15541
15548
|
const buttons = el.querySelectorAll('button,[role="button"]');
|
|
@@ -15547,18 +15554,12 @@ window.__ModuleLoader__.load({
|
|
|
15547
15554
|
});
|
|
15548
15555
|
const expandable = compact ?? mobileToggle;
|
|
15549
15556
|
if (expandable) {
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
expandable.setAttribute("data-dsh-chat-expanding", String(Date.now()));
|
|
15553
|
-
(compact?.querySelector('button,[role="button"]') ?? mobileToggle)?.click();
|
|
15554
|
-
return empty("loading");
|
|
15555
|
-
}
|
|
15556
|
-
if (Date.now() - started < 5e3) return empty("loading");
|
|
15557
|
+
doc.documentElement.setAttribute("data-dsh-chat-expanding", String(Date.now()));
|
|
15558
|
+
(compact?.querySelector('button,[role="button"]') ?? mobileToggle)?.click();
|
|
15557
15559
|
}
|
|
15558
15560
|
}
|
|
15559
|
-
return
|
|
15561
|
+
return empty("loading");
|
|
15560
15562
|
}
|
|
15561
|
-
doc.documentElement.removeAttribute(missingSidebarMarker);
|
|
15562
15563
|
let track = sidebar;
|
|
15563
15564
|
for (let depth = 0; depth < 5 && track.parentElement && track.parentElement !== doc.body; depth++) {
|
|
15564
15565
|
const parent = track.parentElement;
|
|
@@ -15569,21 +15570,101 @@ window.__ModuleLoader__.load({
|
|
|
15569
15570
|
const layout = track.parentElement;
|
|
15570
15571
|
const siblings = layout ? [...layout.children].filter((el) => el !== track && !el.matches('script,style,[role="dialog"],.ds-modal-content')) : [];
|
|
15571
15572
|
const content = siblings.find((el) => el.hasAttribute("data-dsh-chat-content")) ?? siblings.find((el) => el.querySelector('textarea,[contenteditable="true"]')) ?? siblings.find((el) => el.querySelector("._2be88ba > .the-header > ._9fcbeda")) ?? (siblings.length === 1 ? siblings[0] : void 0);
|
|
15572
|
-
const
|
|
15573
|
-
const
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15573
|
+
const trackRect = track.getBoundingClientRect();
|
|
15574
|
+
const contentRect = content?.getBoundingClientRect();
|
|
15575
|
+
const viewportWidth = doc.defaultView?.innerWidth ?? 0;
|
|
15576
|
+
const confirmedBoundary = track.hasAttribute(marker) && layout?.hasAttribute("data-dsh-chat-layout");
|
|
15577
|
+
const boundedContent = layout && content && content !== doc.body && content.isConnected && content.parentElement === layout && contentRect && contentRect.width > 0 && contentRect.height > 0 && contentRect.right <= viewportWidth + 1 && (confirmedBoundary || trackRect.left >= -1 && trackRect.left <= 16 && trackRect.width >= 160 && trackRect.width <= 480 && contentRect.left >= trackRect.right - 16);
|
|
15578
|
+
if (!boundedContent) {
|
|
15579
|
+
if (recovering) return fallbackNavigation();
|
|
15580
|
+
if (isOriginalSnapshot || structureExpired()) return fallback();
|
|
15581
|
+
return empty("loading");
|
|
15582
|
+
}
|
|
15583
|
+
doc.documentElement.removeAttribute(missingSidebarMarker);
|
|
15584
|
+
if (recovering) {
|
|
15585
|
+
doc.documentElement.removeAttribute(fallbackMarker);
|
|
15586
|
+
doc.documentElement.removeAttribute(fallbackErrorMarker);
|
|
15587
|
+
doc.documentElement.setAttribute(presentedMarker, "");
|
|
15588
|
+
}
|
|
15589
|
+
const viewportHeight = doc.defaultView?.innerHeight ?? 0;
|
|
15590
|
+
const nicknameLeaf = (row) => {
|
|
15591
|
+
const texts = doc.createTreeWalker(row, 4);
|
|
15592
|
+
let found = null;
|
|
15593
|
+
let text;
|
|
15594
|
+
while (text = texts.nextNode()) {
|
|
15595
|
+
const parent = text.parentElement;
|
|
15596
|
+
const excluded = parent?.closest('svg,script,style,[hidden],[aria-hidden="true"]');
|
|
15597
|
+
if (!parent || excluded && row.contains(excluded)) continue;
|
|
15598
|
+
const name2 = (text.textContent ?? "").trim();
|
|
15599
|
+
if (!name2) continue;
|
|
15600
|
+
if (found || parent.childElementCount !== 0 || name2.length > 100 || /[\r\n]/.test(name2)) return null;
|
|
15601
|
+
found = { element: parent, name: name2 };
|
|
15602
|
+
}
|
|
15603
|
+
return found;
|
|
15604
|
+
};
|
|
15605
|
+
const checkProfile = (row, image, geometry) => {
|
|
15606
|
+
if (!row.isConnected || !track.contains(row) || row === sidebar || row === track || row === layout || row.contains(newChat) || row.matches("a[href]") || image.closest("a[href]") || row.querySelector('a[href],textarea,input,[contenteditable="true"],[role="menu"],[role="dialog"],.ds-dropdown-menu,.ds-modal-content') || row.querySelectorAll("img").length !== 1 || !row.contains(image)) return null;
|
|
15607
|
+
if (geometry) {
|
|
15608
|
+
const bounds = row.getBoundingClientRect(), avatarBounds = image.getBoundingClientRect(), column = track.getBoundingClientRect();
|
|
15609
|
+
if (column.width < 160 || column.width > 480 || column.left < -1 || column.left > 16 || bounds.top < viewportHeight * 0.75 || bounds.bottom > viewportHeight + 1 || bounds.height < 24 || bounds.height > 100 || bounds.width < 80 || bounds.width > column.width + 1 || bounds.left < column.left - 1 || bounds.right > column.right + 1 || avatarBounds.width < 8 || avatarBounds.width > 80 || avatarBounds.height < 8 || avatarBounds.height > 80 || avatarBounds.left < bounds.left - 1 || avatarBounds.right > bounds.right + 1 || avatarBounds.top < bounds.top - 1 || avatarBounds.bottom > bounds.bottom + 1) return null;
|
|
15610
|
+
}
|
|
15611
|
+
const nickname = nicknameLeaf(row);
|
|
15612
|
+
return nickname ? { row, image, name: nickname.name } : null;
|
|
15613
|
+
};
|
|
15614
|
+
let identifiedProfile = null;
|
|
15615
|
+
for (const candidate of doc.querySelectorAll(`[${profileMarker}]`)) {
|
|
15616
|
+
const image = candidate.querySelector(`img[${profileAvatarMarker}]`);
|
|
15617
|
+
const valid = candidate.getAttribute(profileProofMarker) === "footer-v1" && image ? checkProfile(candidate, image, false) : null;
|
|
15618
|
+
if (!identifiedProfile && valid) identifiedProfile = valid;
|
|
15619
|
+
else {
|
|
15620
|
+
candidate.removeAttribute(profileMarker);
|
|
15621
|
+
candidate.removeAttribute(profileProofMarker);
|
|
15622
|
+
}
|
|
15623
|
+
}
|
|
15624
|
+
const findVisibleProfile = () => {
|
|
15625
|
+
for (const image of track.querySelectorAll("img")) {
|
|
15626
|
+
if (image.closest("a[href]")) continue;
|
|
15627
|
+
const bounds = image.getBoundingClientRect();
|
|
15628
|
+
if (bounds.top < viewportHeight * 0.75 || bounds.height < 8 || bounds.height > 80 || bounds.width < 8 || bounds.width > 80) continue;
|
|
15629
|
+
for (let row = image.parentElement, depth = 0; row && row !== track && depth < 5; row = row.parentElement, depth++) {
|
|
15630
|
+
const valid = checkProfile(row, image, true);
|
|
15631
|
+
if (valid) return valid;
|
|
15632
|
+
}
|
|
15633
|
+
}
|
|
15634
|
+
return null;
|
|
15635
|
+
};
|
|
15636
|
+
if (!identifiedProfile) identifiedProfile = findVisibleProfile();
|
|
15637
|
+
if (!identifiedProfile && confirmedBoundary && trackRect.width === 0 && viewportHeight > 0) {
|
|
15638
|
+
const sheet = doc.getElementById(styleId)?.sheet;
|
|
15639
|
+
if (sheet) {
|
|
15640
|
+
const inlineStyle = track.getAttribute("style"), disabled = sheet.disabled;
|
|
15641
|
+
const width = Number(track.getAttribute(navigationWidthMarker)) || Number.parseFloat(getComputedStyle(track).width);
|
|
15642
|
+
try {
|
|
15643
|
+
track.style.setProperty("visibility", "hidden", "important");
|
|
15644
|
+
track.style.setProperty("pointer-events", "none", "important");
|
|
15645
|
+
track.style.setProperty("position", "fixed", "important");
|
|
15646
|
+
track.style.setProperty("left", "0px", "important");
|
|
15647
|
+
track.style.setProperty("top", "0px", "important");
|
|
15648
|
+
track.style.setProperty("height", `${viewportHeight}px`, "important");
|
|
15649
|
+
if (Number.isFinite(width) && width >= 160 && width <= 480) track.style.setProperty("width", `${width}px`, "important");
|
|
15650
|
+
sheet.disabled = true;
|
|
15651
|
+
identifiedProfile = findVisibleProfile();
|
|
15652
|
+
} finally {
|
|
15653
|
+
sheet.disabled = disabled;
|
|
15654
|
+
if (inlineStyle === null) track.removeAttribute("style");
|
|
15655
|
+
else track.setAttribute("style", inlineStyle);
|
|
15656
|
+
}
|
|
15657
|
+
}
|
|
15658
|
+
}
|
|
15659
|
+
const profile = identifiedProfile?.row ?? null;
|
|
15660
|
+
if (identifiedProfile) {
|
|
15661
|
+
profile.setAttribute(profileMarker, "");
|
|
15662
|
+
profile.setAttribute(profileProofMarker, "footer-v1");
|
|
15663
|
+
identifiedProfile.image.setAttribute(profileAvatarMarker, "");
|
|
15664
|
+
}
|
|
15665
|
+
const accountName = identifiedProfile?.name ?? null;
|
|
15666
|
+
const authenticated = identifiedProfile ? true : void 0;
|
|
15667
|
+
const settings = authenticated === true ? adaptWebsiteSettings(doc, profile, command) : void 0;
|
|
15587
15668
|
const settingsRoot = doc.documentElement;
|
|
15588
15669
|
const conversations = [];
|
|
15589
15670
|
let group = "\u5BF9\u8BDD";
|
|
@@ -15616,6 +15697,7 @@ window.__ModuleLoader__.load({
|
|
|
15616
15697
|
}
|
|
15617
15698
|
if (command.type === "snapshot" && command.showOriginal) restore();
|
|
15618
15699
|
else {
|
|
15700
|
+
if (trackRect.width >= 160 && trackRect.width <= 480) track.setAttribute(navigationWidthMarker, String(trackRect.width));
|
|
15619
15701
|
track.setAttribute(marker, "");
|
|
15620
15702
|
sidebar.setAttribute(marker, "");
|
|
15621
15703
|
if (content && layout) {
|
|
@@ -15639,12 +15721,12 @@ window.__ModuleLoader__.load({
|
|
|
15639
15721
|
}
|
|
15640
15722
|
const selected = conversations.find((item) => item.href === safeHref(page.pathname));
|
|
15641
15723
|
if (!(command.type === "snapshot" && command.showOriginal)) adaptWebsiteHeader(doc, content, selected?.title ?? null, command.type === "snapshot" ? command.headerInset ?? (Number.parseInt(settingsRoot.style.getPropertyValue("--dsh-chat-title-inset")) || 24) : Number.parseInt(settingsRoot.style.getPropertyValue("--dsh-chat-title-inset")) || 24);
|
|
15642
|
-
const ready = settingsRoot.hasAttribute("data-dsh-chat-dark-complete") || Boolean(settings
|
|
15724
|
+
const ready = authenticated !== true || settingsRoot.hasAttribute("data-dsh-chat-dark-complete") || Boolean(settings?.error) || command.type === "snapshot" && command.showOriginal;
|
|
15643
15725
|
if (ready) {
|
|
15644
15726
|
settingsRoot.removeAttribute("data-dsh-chat-preparing");
|
|
15645
15727
|
if (!(command.type === "snapshot" && command.showOriginal)) settingsRoot.setAttribute(presentedMarker, "");
|
|
15646
15728
|
}
|
|
15647
|
-
return { status: ready ? "ready" : "loading", authenticated, conversations, selectedHref: safeHref(page.pathname), canCreate: newChat !== null, error: null, accountName, settings };
|
|
15729
|
+
return { status: ready ? "ready" : "loading", ...authenticated === void 0 ? {} : { authenticated }, conversations, selectedHref: safeHref(page.pathname), canCreate: newChat !== null, error: null, accountName, settings };
|
|
15648
15730
|
}
|
|
15649
15731
|
function websiteCommandScript(command) {
|
|
15650
15732
|
return `(() => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; return (${adaptWebsiteNavigation.toString()})(document,location,${JSON.stringify(command)}); })()`;
|
|
@@ -15655,15 +15737,15 @@ window.__ModuleLoader__.load({
|
|
|
15655
15737
|
if (!["loading", "ready", "sign-in", "unsupported"].includes(source.status) || !Array.isArray(source.conversations)) throw new Error("Invalid navigation response");
|
|
15656
15738
|
const validHref = (href) => typeof href === "string" && /^https:\/\/chat\.deepseek\.com\/a\/chat\/s\/[a-zA-Z0-9-]+$/.test(href);
|
|
15657
15739
|
const conversations = source.conversations.slice(0, 1e3).filter((item) => item && validHref(item.href) && typeof item.title === "string" && typeof item.group === "string").map((item) => ({ href: item.href, title: item.title.slice(0, 300), group: item.group.slice(0, 80) }));
|
|
15658
|
-
const authenticated = source.status
|
|
15740
|
+
const authenticated = source.status === "sign-in" ? false : source.authenticated === true ? true : source.authenticated === false ? false : void 0;
|
|
15659
15741
|
return {
|
|
15660
15742
|
status: source.status,
|
|
15661
|
-
authenticated,
|
|
15662
|
-
conversations: authenticated ? conversations : [],
|
|
15743
|
+
...authenticated === void 0 ? {} : { authenticated },
|
|
15744
|
+
conversations: authenticated === true ? conversations : [],
|
|
15663
15745
|
selectedHref: validHref(source.selectedHref) ? source.selectedHref : null,
|
|
15664
|
-
accountName: authenticated && typeof source.accountName === "string" ? source.accountName.slice(0, 100) : null,
|
|
15746
|
+
accountName: authenticated === true && typeof source.accountName === "string" ? source.accountName.slice(0, 100) : null,
|
|
15665
15747
|
settings: source.settings ? { language: typeof source.settings.language === "string" ? source.settings.language.slice(0, 80) : null, theme: typeof source.settings.theme === "string" ? source.settings.theme.slice(0, 80) : null, error: typeof source.settings.error === "string" ? source.settings.error.slice(0, 200) : null, pending: source.settings.pending === true, restored: source.settings.restored === true } : void 0,
|
|
15666
|
-
canCreate: authenticated && source.canCreate === true,
|
|
15748
|
+
canCreate: authenticated === true && source.canCreate === true,
|
|
15667
15749
|
error: typeof source.error === "string" ? source.error.slice(0, 300) : null
|
|
15668
15750
|
};
|
|
15669
15751
|
}
|
|
@@ -15982,13 +16064,15 @@ window.__ModuleLoader__.load({
|
|
|
15982
16064
|
if (snapshot.websiteAuthenticationStatus !== "signing-out") void bridge.clearWebsiteSession(generation);
|
|
15983
16065
|
}
|
|
15984
16066
|
} catch {
|
|
15985
|
-
if (
|
|
16067
|
+
if (currentProjection()) {
|
|
15986
16068
|
documentPresented = true;
|
|
15987
|
-
bridge.reportWebsiteNavigation(generation, {
|
|
16069
|
+
bridge.reportWebsiteNavigation(generation, { status: "unsupported", conversations: [], selectedHref: null, canCreate: false, error: null });
|
|
15988
16070
|
setPresentationReady(!snapshot.settingsViewport);
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
16071
|
+
if (currentProjection()) {
|
|
16072
|
+
try {
|
|
16073
|
+
await execute({ type: "restore" });
|
|
16074
|
+
} catch {
|
|
16075
|
+
}
|
|
15992
16076
|
}
|
|
15993
16077
|
}
|
|
15994
16078
|
}
|
|
@@ -16059,7 +16143,7 @@ window.__ModuleLoader__.load({
|
|
|
16059
16143
|
}, { signal: events.signal });
|
|
16060
16144
|
current.addEventListener("render-process-gone", () => {
|
|
16061
16145
|
needsRecovery.current = true;
|
|
16062
|
-
bridge.reportWebsiteNavigation(generation, {
|
|
16146
|
+
bridge.reportWebsiteNavigation(generation, { status: "unsupported", conversations: [], selectedHref: null, canCreate: false, error: null });
|
|
16063
16147
|
report(false, "\u7F51\u9875\u8FDB\u7A0B\u5DF2\u9000\u51FA\uFF0C\u8BF7\u70B9\u51FB\u300C\u91CD\u8BD5\u7F51\u9875\u300D\u3002");
|
|
16064
16148
|
}, { signal: events.signal });
|
|
16065
16149
|
const offOpen = nativeBrowser.onOpenRequested(reservation.native.lease, (url2) => {
|
|
@@ -16643,7 +16727,14 @@ window.__ModuleLoader__.load({
|
|
|
16643
16727
|
try {
|
|
16644
16728
|
next = parseWebsiteNavigation(value);
|
|
16645
16729
|
} catch {
|
|
16646
|
-
next = {
|
|
16730
|
+
next = { status: "unsupported", conversations: [], selectedHref: null, canCreate: false, error: null };
|
|
16731
|
+
}
|
|
16732
|
+
const previousNavigation = websiteNavigation;
|
|
16733
|
+
if (next.status === "unsupported" && !logoutRequested && !logoutFailed) {
|
|
16734
|
+
if (restoringPreferences || previousNavigation.settings?.pending) preferencesGeneration = -1;
|
|
16735
|
+
restoringPreferences = false;
|
|
16736
|
+
restorationSeen = false;
|
|
16737
|
+
settingsReadRequested = false;
|
|
16647
16738
|
}
|
|
16648
16739
|
if (newDocument || next.status === "sign-in") {
|
|
16649
16740
|
preferencesGeneration = -1;
|
|
@@ -16651,6 +16742,9 @@ window.__ModuleLoader__.load({
|
|
|
16651
16742
|
restorationSeen = false;
|
|
16652
16743
|
settingsReadRequested = false;
|
|
16653
16744
|
}
|
|
16745
|
+
if (newDocument && next.authenticated !== true && next.status !== "sign-in" && !logoutRequested && !logoutFailed) {
|
|
16746
|
+
websiteAuthenticationStatus = websiteSignInRequested ? "signing-in" : "loading";
|
|
16747
|
+
}
|
|
16654
16748
|
if (next.status === "sign-in") {
|
|
16655
16749
|
if (websiteHadSession || logoutRequested) restorationBlocked = true;
|
|
16656
16750
|
if (logoutVaultCleared) {
|
|
@@ -16674,7 +16768,7 @@ window.__ModuleLoader__.load({
|
|
|
16674
16768
|
publish();
|
|
16675
16769
|
return;
|
|
16676
16770
|
} else {
|
|
16677
|
-
websiteNavigation = next;
|
|
16771
|
+
websiteNavigation = !newDocument && next.authenticated !== true && previousNavigation.authenticated === true ? { ...next, status: next.status === "ready" ? "loading" : next.status, authenticated: true, accountName: previousNavigation.accountName, settings: next.settings ?? (previousNavigation.settings && { ...previousNavigation.settings, pending: next.status === "unsupported" ? false : previousNavigation.settings.pending }) } : next;
|
|
16678
16772
|
if (next.authenticated === true) {
|
|
16679
16773
|
if (!websiteHadSession && !logoutFailed) restorationBlocked = false;
|
|
16680
16774
|
if (!websiteHadSession) websiteAuthenticationRevision++;
|
|
@@ -16684,8 +16778,7 @@ window.__ModuleLoader__.load({
|
|
|
16684
16778
|
logoutVaultCleared = false;
|
|
16685
16779
|
websiteAuthenticationStatus = logoutFailed ? "error" : "signed-in";
|
|
16686
16780
|
if (!logoutFailed && websiteSessionStatus !== "error") websiteSessionError = null;
|
|
16687
|
-
} else if (
|
|
16688
|
-
else if (!websiteHadSession) websiteAuthenticationStatus = websiteSignInRequested ? "signing-in" : "loading";
|
|
16781
|
+
} else if (!websiteHadSession) websiteAuthenticationStatus = websiteSignInRequested ? "signing-in" : "loading";
|
|
16689
16782
|
}
|
|
16690
16783
|
const settings = websiteNavigation.settings;
|
|
16691
16784
|
if (restoringPreferences && settings?.restored === false) restorationSeen = true;
|
|
@@ -16693,7 +16786,7 @@ window.__ModuleLoader__.load({
|
|
|
16693
16786
|
if (settings?.error && !settings.pending) restoringPreferences = false;
|
|
16694
16787
|
restorePreferences();
|
|
16695
16788
|
readSettingsWhenReady();
|
|
16696
|
-
if (!restoringPreferences && settings?.restored && !settings.pending && !settings.error && !logoutFailed) {
|
|
16789
|
+
if (websiteNavigation.status === "ready" && !restoringPreferences && settings?.restored && !settings.pending && !settings.error && !logoutFailed) {
|
|
16697
16790
|
const language = /中文|Chinese/i.test(settings.language ?? "") ? "zh-CN" : /English|英语/i.test(settings.language ?? "") ? "en" : /^(System|跟随系统|系统|Follow system)$/i.test(settings.language ?? "") ? "system" : "";
|
|
16698
16791
|
if (language) persistPreference("language", language);
|
|
16699
16792
|
}
|
|
@@ -16712,6 +16805,7 @@ window.__ModuleLoader__.load({
|
|
|
16712
16805
|
commandWebsite: (command) => {
|
|
16713
16806
|
if (disposed || !mode.canEnter() || !navigationHandler) return;
|
|
16714
16807
|
if ((logoutRequested || logoutFailed) && command.type !== "logout" && command.type !== "snapshot") return;
|
|
16808
|
+
if (websiteNavigation.status !== "ready" && command.type !== "logout" && command.type !== "snapshot" && command.type !== "restore") return;
|
|
16715
16809
|
if (command.type === "settings-read" && (restoringPreferences || websiteNavigation.settings?.pending)) return;
|
|
16716
16810
|
if (command.type === "open" && !websiteNavigation.conversations.some((item) => item.href === command.href)) return;
|
|
16717
16811
|
if (command.type === "settings-read" || command.type === "setting" || command.type === "preferences" || command.type === "logout") {
|
|
@@ -16735,6 +16829,7 @@ window.__ModuleLoader__.load({
|
|
|
16735
16829
|
},
|
|
16736
16830
|
logoutWebsite: () => {
|
|
16737
16831
|
if (logoutRequested || !navigationHandler || !websiteHadSession && !logoutFailed) return;
|
|
16832
|
+
if (!logoutFailed && websiteNavigation.status !== "ready") return;
|
|
16738
16833
|
const generation = authorizationGeneration;
|
|
16739
16834
|
const handler = navigationHandler;
|
|
16740
16835
|
clearTimeout(logoutTimer);
|
|
@@ -16864,13 +16959,13 @@ window.__ModuleLoader__.load({
|
|
|
16864
16959
|
publish();
|
|
16865
16960
|
}
|
|
16866
16961
|
function readSettingsWhenReady() {
|
|
16867
|
-
if (!settingsViewport || !navigationHandler || websiteNavigation.authenticated !== true || settingsReadRequested || restoringPreferences || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
|
|
16962
|
+
if (!settingsViewport || !navigationHandler || websiteNavigation.status !== "ready" || websiteNavigation.authenticated !== true || settingsReadRequested || restoringPreferences || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
|
|
16868
16963
|
settingsReadRequested = true;
|
|
16869
16964
|
if (websiteNavigation.settings?.language && !websiteNavigation.settings.error) return;
|
|
16870
16965
|
void navigationHandler({ type: "settings-read" });
|
|
16871
16966
|
}
|
|
16872
16967
|
function restorePreferences() {
|
|
16873
|
-
if (!preferences || !navigationHandler || websiteNavigation.authenticated !== true || preferencesGeneration === authorizationGeneration || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
|
|
16968
|
+
if (!preferences || !navigationHandler || websiteNavigation.status !== "ready" || websiteNavigation.authenticated !== true || preferencesGeneration === authorizationGeneration || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
|
|
16874
16969
|
const language = preferences.language || DEFAULT_WEBSITE_LANGUAGE;
|
|
16875
16970
|
preferencesGeneration = authorizationGeneration;
|
|
16876
16971
|
restoringPreferences = true;
|