dsh-auth-remote 0.1.1 → 0.1.3
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 +13 -0
- package/CHANGELOG.zh-CN.md +13 -0
- package/README.md +11 -3
- package/README.zh-CN.md +11 -3
- package/dist/client.js +169 -98
- package/dist/client.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/login.css +100 -73
- package/dist/login.css.map +2 -2
- package/dist/types/adapters/dsh/compatibility.d.ts +1 -0
- package/dist/types/adapters/dsh/compatibility.d.ts.map +1 -1
- package/docs/deployment.md +5 -3
- package/docs/deployment.zh-CN.md +5 -3
- package/docs/development.md +24 -7
- package/docs/development.zh-CN.md +24 -7
- package/docs/releasing.md +5 -5
- package/docs/releasing.zh-CN.md +5 -5
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,19 @@ This file records user-visible changes to the released package. Version numbers
|
|
|
8
8
|
|
|
9
9
|
No changes recorded yet.
|
|
10
10
|
|
|
11
|
+
## 0.1.3 - 2026-09-30
|
|
12
|
+
|
|
13
|
+
- Verify DSH 0.2.0-rc.2 and add it to the CLI, installation smoke, and browser CI matrix, retaining all previously tested versions.
|
|
14
|
+
- Use DSH 0.2.0-rc.2 as the default development, test, and release verification runtime; update pinned development dependencies and English/Chinese setup guides.
|
|
15
|
+
- Match the chat completion status used by both older DSH runtimes and 0.2.0-rc.2 in the HTTPS forwarding regression.
|
|
16
|
+
- Coordinate session-monitor redirects with security changes so a successful update retains its sign-in message and newly issued backup codes remain visible until acknowledged. Pending-operation protection expires after 30 seconds.
|
|
17
|
+
|
|
18
|
+
## 0.1.2 - 2026-09-29
|
|
19
|
+
|
|
20
|
+
- Align login and security settings with DSH typography, neutral colors, controls, and light/dark themes.
|
|
21
|
+
- Verify DSH 0.1.7-rc.1, 0.1.7-rc.2, and 0.2.0-rc.1 in the CLI/browser matrix; use 0.2.0-rc.1 as the default development runtime.
|
|
22
|
+
- Admit DSH versions `>=0.1.7-rc.1` without an upper version ceiling, retaining required authentication API and package identity checks. Later versions are forward-admitted, not individually verified.
|
|
23
|
+
|
|
11
24
|
## 0.1.1 - 2026-09-28
|
|
12
25
|
|
|
13
26
|
- Documented installation from the published npm package in English and Chinese.
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -8,6 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
暂无记录。
|
|
10
10
|
|
|
11
|
+
## 0.1.3 - 2026-09-30
|
|
12
|
+
|
|
13
|
+
- 验证 DSH 0.2.0-rc.2,将其加入 CLI、安装冒烟和浏览器 CI 矩阵,并保留之前已测试的所有版本。
|
|
14
|
+
- 默认开发、测试和发布验证运行时升级为 DSH 0.2.0-rc.2,同步更新锁定开发依赖及中英文安装指南。
|
|
15
|
+
- HTTPS 转发回归兼容旧版 DSH 与 0.2.0-rc.2 的聊天完成状态文案。
|
|
16
|
+
- 协调会话监控与安全变更的登录跳转,保留成功更新提示,并让新生成的备用码在确认保存前保持可见;操作等待期间的保护最多持续 30 秒。
|
|
17
|
+
|
|
18
|
+
## 0.1.2 - 2026-09-29
|
|
19
|
+
|
|
20
|
+
- 登录页和安全设置对齐 DSH 的字体、灰阶、控件与浅色/深色主题。
|
|
21
|
+
- CLI/浏览器矩阵验证 DSH 0.1.7-rc.1、0.1.7-rc.2 和 0.2.0-rc.1,默认开发运行时升级为 0.2.0-rc.1。
|
|
22
|
+
- DSH 版本准入改为 `>=0.1.7-rc.1`,去掉上限并保留必需的认证接口及包实例检查;后续版本属于向前准入,不宣称已逐版验证。
|
|
23
|
+
|
|
11
24
|
## 0.1.1 - 2026-09-28
|
|
12
25
|
|
|
13
26
|
- 中英文文档改为指导从已发布的 npm 包安装插件。
|
package/README.md
CHANGED
|
@@ -6,21 +6,29 @@ Single-user remote sign-in for DeepSeek Harness (DSH), with password, TOTP, one-
|
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
8
|
|
|
9
|
-
- Linux with `/proc`, Node.js 24 or newer, and
|
|
9
|
+
- Linux with `/proc`, Node.js 24 or newer, and a tested DSH runtime: **0.1.7-rc.1**, **0.1.7-rc.2**, **0.2.0-rc.1**, or **0.2.0-rc.2** (default). pnpm 12.5.1 is needed only when building from source.
|
|
10
10
|
- DSH's default `~/.dsh` data directory and a `web` profile. The account state belongs to that profile; it is not shared with another profile.
|
|
11
11
|
- For source browser tests, install Playwright Chromium with `pnpm exec playwright install chromium`. The tests use that managed browser and a dedicated, self-signed TLS fixture.
|
|
12
12
|
|
|
13
|
+
## DSH compatibility
|
|
14
|
+
|
|
15
|
+
Plugin 0.1.3 is tested against DSH **0.1.7-rc.1**, **0.1.7-rc.2**, **0.2.0-rc.1**, and **0.2.0-rc.2**. The default supported runtime is **0.2.0-rc.2**. The host peer declaration and runtime version check both use `>=0.1.7-rc.1`, with no upper bound. DSH's loader includes prereleases, so 0.2 and later releases are admitted without a per-version exemption or a plugin update solely to widen the range.
|
|
16
|
+
|
|
17
|
+
Later versions are forward-admitted, not claimed as tested. The plugin still verifies the required WebServer/Connection APIs, shared host package identity, and native authentication exchange. If those contracts change, authentication stays unavailable with a diagnostic; removing the version ceiling cannot guarantee compatibility with unknown API changes. CI runs CLI, installation smoke, and browser regressions on all four tested versions.
|
|
18
|
+
|
|
19
|
+
Plugin **0.1.3** makes DSH 0.2.0-rc.2 the default verified runtime. The open-ended compatibility range and theme integration were introduced in **0.1.2**. For source builds, see the [development guide](docs/development.md).
|
|
20
|
+
|
|
13
21
|
## Install from npm
|
|
14
22
|
|
|
15
23
|
With DSH installed, verify its version and install the published plugin into the default `web` profile:
|
|
16
24
|
|
|
17
25
|
```sh
|
|
18
26
|
dsh --version
|
|
19
|
-
dsh plugin --profile web add dsh-auth-remote@0.1.
|
|
27
|
+
dsh plugin --profile web add dsh-auth-remote@0.1.3
|
|
20
28
|
dsh plugin --profile web list
|
|
21
29
|
```
|
|
22
30
|
|
|
23
|
-
Check that `dsh --version` prints `0.
|
|
31
|
+
Check that `dsh --version` prints `0.2.0-rc.2` (or another tested version listed above) and the plugin list includes `dsh-auth-remote@0.1.3`. These commands use DSH's default data directory. For source builds and an isolated development runtime, see the [development guide](docs/development.md).
|
|
24
32
|
|
|
25
33
|
## Configure the web profile
|
|
26
34
|
|
package/README.zh-CN.md
CHANGED
|
@@ -6,21 +6,29 @@ DeepSeek Harness(DSH)的单用户远程登录插件,提供密码、TOTP、
|
|
|
6
6
|
|
|
7
7
|
## 前置条件
|
|
8
8
|
|
|
9
|
-
- Linux(含 `/proc`)、Node.js 24 或更高版本,以及已测试的 DSH **0.1.7-rc.1**
|
|
9
|
+
- Linux(含 `/proc`)、Node.js 24 或更高版本,以及已测试的 DSH **0.1.7-rc.1**、**0.1.7-rc.2**、**0.2.0-rc.1** 或 **0.2.0-rc.2**(默认)运行时。仅从源码构建时需要 pnpm 12.5.1。
|
|
10
10
|
- DSH 默认的 `~/.dsh` 数据目录和 `web` profile。账号状态属于该 profile,不与其他 profile 共用。
|
|
11
11
|
- 源码浏览器测试先执行 `pnpm exec playwright install chromium`。测试使用 Playwright 管理的浏览器和专用自签 TLS 夹具。
|
|
12
12
|
|
|
13
|
+
## DSH 兼容性
|
|
14
|
+
|
|
15
|
+
插件 0.1.3 已测试 DSH **0.1.7-rc.1**、**0.1.7-rc.2**、**0.2.0-rc.1** 和 **0.2.0-rc.2**,默认支持运行时为 **0.2.0-rc.2**。宿主 peer 声明和运行时版本检查统一使用 `>=0.1.7-rc.1`,不设版本上限。DSH 的加载器检查包含预发布版本,因此 0.2 及后续版本无需逐版豁免,也无需仅为放宽版本范围而更新插件。
|
|
16
|
+
|
|
17
|
+
后续版本属于向前准入,并不宣称已经逐版测试。插件仍检查必需的 WebServer/Connection 接口、宿主包实例一致性和原生认证交换。若这些约定改变,认证入口会保持不可用并给出诊断;取消版本上限不能保证未知接口变更后的兼容性。CI 在上述四个版本上运行 CLI、安装冒烟和浏览器回归。
|
|
18
|
+
|
|
19
|
+
插件 **0.1.3** 将 DSH 0.2.0-rc.2 设为默认已验证运行时。无版本上限的兼容范围和主题集成从插件 **0.1.2** 开始提供。源码构建参见[开发指南](docs/development.zh-CN.md)。
|
|
20
|
+
|
|
13
21
|
## 从 npm 安装
|
|
14
22
|
|
|
15
23
|
安装 DSH 后,核对版本并把已发布的插件安装到默认 `web` profile:
|
|
16
24
|
|
|
17
25
|
```sh
|
|
18
26
|
dsh --version
|
|
19
|
-
dsh plugin --profile web add dsh-auth-remote@0.1.
|
|
27
|
+
dsh plugin --profile web add dsh-auth-remote@0.1.3
|
|
20
28
|
dsh plugin --profile web list
|
|
21
29
|
```
|
|
22
30
|
|
|
23
|
-
确认 `dsh --version` 输出 `0.
|
|
31
|
+
确认 `dsh --version` 输出 `0.2.0-rc.2`(或上文列出的其他已测试版本),且插件列表中有 `dsh-auth-remote@0.1.3`。这些命令使用 DSH 默认数据目录。源码构建及隔离开发运行时参见[开发指南](docs/development.zh-CN.md)。
|
|
24
32
|
|
|
25
33
|
## 配置 web profile
|
|
26
34
|
|
package/dist/client.js
CHANGED
|
@@ -219,19 +219,19 @@ var require_bit_matrix = __commonJS({
|
|
|
219
219
|
this.data = new Uint8Array(size * size);
|
|
220
220
|
this.reservedBit = new Uint8Array(size * size);
|
|
221
221
|
}
|
|
222
|
-
BitMatrix.prototype.set = function(
|
|
223
|
-
const index =
|
|
222
|
+
BitMatrix.prototype.set = function(row, col, value, reserved) {
|
|
223
|
+
const index = row * this.size + col;
|
|
224
224
|
this.data[index] = value;
|
|
225
225
|
if (reserved) this.reservedBit[index] = true;
|
|
226
226
|
};
|
|
227
|
-
BitMatrix.prototype.get = function(
|
|
228
|
-
return this.data[
|
|
227
|
+
BitMatrix.prototype.get = function(row, col) {
|
|
228
|
+
return this.data[row * this.size + col];
|
|
229
229
|
};
|
|
230
|
-
BitMatrix.prototype.xor = function(
|
|
231
|
-
this.data[
|
|
230
|
+
BitMatrix.prototype.xor = function(row, col, value) {
|
|
231
|
+
this.data[row * this.size + col] ^= value;
|
|
232
232
|
};
|
|
233
|
-
BitMatrix.prototype.isReserved = function(
|
|
234
|
-
return this.reservedBit[
|
|
233
|
+
BitMatrix.prototype.isReserved = function(row, col) {
|
|
234
|
+
return this.reservedBit[row * this.size + col];
|
|
235
235
|
};
|
|
236
236
|
module2.exports = BitMatrix;
|
|
237
237
|
}
|
|
@@ -326,11 +326,11 @@ var require_mask_pattern = __commonJS({
|
|
|
326
326
|
let sameCountRow = 0;
|
|
327
327
|
let lastCol = null;
|
|
328
328
|
let lastRow = null;
|
|
329
|
-
for (let
|
|
329
|
+
for (let row = 0; row < size; row++) {
|
|
330
330
|
sameCountCol = sameCountRow = 0;
|
|
331
331
|
lastCol = lastRow = null;
|
|
332
332
|
for (let col = 0; col < size; col++) {
|
|
333
|
-
let module3 = data.get(
|
|
333
|
+
let module3 = data.get(row, col);
|
|
334
334
|
if (module3 === lastCol) {
|
|
335
335
|
sameCountCol++;
|
|
336
336
|
} else {
|
|
@@ -338,7 +338,7 @@ var require_mask_pattern = __commonJS({
|
|
|
338
338
|
lastCol = module3;
|
|
339
339
|
sameCountCol = 1;
|
|
340
340
|
}
|
|
341
|
-
module3 = data.get(col,
|
|
341
|
+
module3 = data.get(col, row);
|
|
342
342
|
if (module3 === lastRow) {
|
|
343
343
|
sameCountRow++;
|
|
344
344
|
} else {
|
|
@@ -355,9 +355,9 @@ var require_mask_pattern = __commonJS({
|
|
|
355
355
|
exports.getPenaltyN2 = function getPenaltyN2(data) {
|
|
356
356
|
const size = data.size;
|
|
357
357
|
let points = 0;
|
|
358
|
-
for (let
|
|
358
|
+
for (let row = 0; row < size - 1; row++) {
|
|
359
359
|
for (let col = 0; col < size - 1; col++) {
|
|
360
|
-
const last = data.get(
|
|
360
|
+
const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
|
|
361
361
|
if (last === 4 || last === 0) points++;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -368,12 +368,12 @@ var require_mask_pattern = __commonJS({
|
|
|
368
368
|
let points = 0;
|
|
369
369
|
let bitsCol = 0;
|
|
370
370
|
let bitsRow = 0;
|
|
371
|
-
for (let
|
|
371
|
+
for (let row = 0; row < size; row++) {
|
|
372
372
|
bitsCol = bitsRow = 0;
|
|
373
373
|
for (let col = 0; col < size; col++) {
|
|
374
|
-
bitsCol = bitsCol << 1 & 2047 | data.get(
|
|
374
|
+
bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
|
|
375
375
|
if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
|
|
376
|
-
bitsRow = bitsRow << 1 & 2047 | data.get(col,
|
|
376
|
+
bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
|
|
377
377
|
if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
@@ -411,9 +411,9 @@ var require_mask_pattern = __commonJS({
|
|
|
411
411
|
exports.applyMask = function applyMask(pattern, data) {
|
|
412
412
|
const size = data.size;
|
|
413
413
|
for (let col = 0; col < size; col++) {
|
|
414
|
-
for (let
|
|
415
|
-
if (data.isReserved(
|
|
416
|
-
data.xor(
|
|
414
|
+
for (let row = 0; row < size; row++) {
|
|
415
|
+
if (data.isReserved(row, col)) continue;
|
|
416
|
+
data.xor(row, col, getMaskAt(pattern, row, col));
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
};
|
|
@@ -1634,16 +1634,16 @@ var require_qrcode = __commonJS({
|
|
|
1634
1634
|
const size = matrix.size;
|
|
1635
1635
|
const pos = FinderPattern.getPositions(version);
|
|
1636
1636
|
for (let i = 0; i < pos.length; i++) {
|
|
1637
|
-
const
|
|
1637
|
+
const row = pos[i][0];
|
|
1638
1638
|
const col = pos[i][1];
|
|
1639
1639
|
for (let r = -1; r <= 7; r++) {
|
|
1640
|
-
if (
|
|
1640
|
+
if (row + r <= -1 || size <= row + r) continue;
|
|
1641
1641
|
for (let c = -1; c <= 7; c++) {
|
|
1642
1642
|
if (col + c <= -1 || size <= col + c) continue;
|
|
1643
1643
|
if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) {
|
|
1644
|
-
matrix.set(
|
|
1644
|
+
matrix.set(row + r, col + c, true, true);
|
|
1645
1645
|
} else {
|
|
1646
|
-
matrix.set(
|
|
1646
|
+
matrix.set(row + r, col + c, false, true);
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
}
|
|
@@ -1660,14 +1660,14 @@ var require_qrcode = __commonJS({
|
|
|
1660
1660
|
function setupAlignmentPattern(matrix, version) {
|
|
1661
1661
|
const pos = AlignmentPattern.getPositions(version);
|
|
1662
1662
|
for (let i = 0; i < pos.length; i++) {
|
|
1663
|
-
const
|
|
1663
|
+
const row = pos[i][0];
|
|
1664
1664
|
const col = pos[i][1];
|
|
1665
1665
|
for (let r = -2; r <= 2; r++) {
|
|
1666
1666
|
for (let c = -2; c <= 2; c++) {
|
|
1667
1667
|
if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
|
|
1668
|
-
matrix.set(
|
|
1668
|
+
matrix.set(row + r, col + c, true, true);
|
|
1669
1669
|
} else {
|
|
1670
|
-
matrix.set(
|
|
1670
|
+
matrix.set(row + r, col + c, false, true);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
@@ -1676,13 +1676,13 @@ var require_qrcode = __commonJS({
|
|
|
1676
1676
|
function setupVersionInfo(matrix, version) {
|
|
1677
1677
|
const size = matrix.size;
|
|
1678
1678
|
const bits = Version.getEncodedBits(version);
|
|
1679
|
-
let
|
|
1679
|
+
let row, col, mod;
|
|
1680
1680
|
for (let i = 0; i < 18; i++) {
|
|
1681
|
-
|
|
1681
|
+
row = Math.floor(i / 3);
|
|
1682
1682
|
col = i % 3 + size - 8 - 3;
|
|
1683
1683
|
mod = (bits >> i & 1) === 1;
|
|
1684
|
-
matrix.set(
|
|
1685
|
-
matrix.set(col,
|
|
1684
|
+
matrix.set(row, col, mod, true);
|
|
1685
|
+
matrix.set(col, row, mod, true);
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
|
|
@@ -1711,19 +1711,19 @@ var require_qrcode = __commonJS({
|
|
|
1711
1711
|
function setupData(matrix, data) {
|
|
1712
1712
|
const size = matrix.size;
|
|
1713
1713
|
let inc = -1;
|
|
1714
|
-
let
|
|
1714
|
+
let row = size - 1;
|
|
1715
1715
|
let bitIndex = 7;
|
|
1716
1716
|
let byteIndex = 0;
|
|
1717
1717
|
for (let col = size - 1; col > 0; col -= 2) {
|
|
1718
1718
|
if (col === 6) col--;
|
|
1719
1719
|
while (true) {
|
|
1720
1720
|
for (let c = 0; c < 2; c++) {
|
|
1721
|
-
if (!matrix.isReserved(
|
|
1721
|
+
if (!matrix.isReserved(row, col - c)) {
|
|
1722
1722
|
let dark = false;
|
|
1723
1723
|
if (byteIndex < data.length) {
|
|
1724
1724
|
dark = (data[byteIndex] >>> bitIndex & 1) === 1;
|
|
1725
1725
|
}
|
|
1726
|
-
matrix.set(
|
|
1726
|
+
matrix.set(row, col - c, dark);
|
|
1727
1727
|
bitIndex--;
|
|
1728
1728
|
if (bitIndex === -1) {
|
|
1729
1729
|
byteIndex++;
|
|
@@ -1731,9 +1731,9 @@ var require_qrcode = __commonJS({
|
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
1733
|
}
|
|
1734
|
-
|
|
1735
|
-
if (
|
|
1736
|
-
|
|
1734
|
+
row += inc;
|
|
1735
|
+
if (row < 0 || size <= row) {
|
|
1736
|
+
row -= inc;
|
|
1737
1737
|
inc = -inc;
|
|
1738
1738
|
break;
|
|
1739
1739
|
}
|
|
@@ -2032,12 +2032,12 @@ var require_svg_tag = __commonJS({
|
|
|
2032
2032
|
let lineLength = 0;
|
|
2033
2033
|
for (let i = 0; i < data.length; i++) {
|
|
2034
2034
|
const col = Math.floor(i % size);
|
|
2035
|
-
const
|
|
2035
|
+
const row = Math.floor(i / size);
|
|
2036
2036
|
if (!col && !newRow) newRow = true;
|
|
2037
2037
|
if (data[i]) {
|
|
2038
2038
|
lineLength++;
|
|
2039
2039
|
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
2040
|
-
path += newRow ? svgCmd("M", col + margin, 0.5 +
|
|
2040
|
+
path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
|
|
2041
2041
|
moveBy = 0;
|
|
2042
2042
|
newRow = false;
|
|
2043
2043
|
}
|
|
@@ -2165,7 +2165,42 @@ function assertRemoteHostCapability(ctx) {
|
|
|
2165
2165
|
var import_react = require("react");
|
|
2166
2166
|
var import_qrcode = __toESM(require_browser(), 1);
|
|
2167
2167
|
|
|
2168
|
+
// src/client/settings/navigation.ts
|
|
2169
|
+
var LoginNavigation = class {
|
|
2170
|
+
constructor(assign) {
|
|
2171
|
+
this.assign = assign;
|
|
2172
|
+
}
|
|
2173
|
+
assign;
|
|
2174
|
+
holds = 0;
|
|
2175
|
+
expired = false;
|
|
2176
|
+
navigating = false;
|
|
2177
|
+
hold(timeoutMs) {
|
|
2178
|
+
this.holds++;
|
|
2179
|
+
let active = true;
|
|
2180
|
+
let timer;
|
|
2181
|
+
const release = () => {
|
|
2182
|
+
if (!active) return;
|
|
2183
|
+
active = false;
|
|
2184
|
+
clearTimeout(timer);
|
|
2185
|
+
this.holds--;
|
|
2186
|
+
if (this.holds === 0 && this.expired) this.go("expired");
|
|
2187
|
+
};
|
|
2188
|
+
if (timeoutMs !== void 0) timer = setTimeout(release, timeoutMs);
|
|
2189
|
+
return release;
|
|
2190
|
+
}
|
|
2191
|
+
go(reason) {
|
|
2192
|
+
if (this.navigating) return;
|
|
2193
|
+
if (reason === "expired" && this.holds > 0) {
|
|
2194
|
+
this.expired = true;
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
this.navigating = true;
|
|
2198
|
+
this.assign(reason);
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2168
2202
|
// src/client/settings/api.ts
|
|
2203
|
+
var loginNavigation = new LoginNavigation((reason) => location.assign(loginLocation(reason)));
|
|
2169
2204
|
var SettingsFailure = class extends Error {
|
|
2170
2205
|
constructor(status, code, retryAfter) {
|
|
2171
2206
|
super(code);
|
|
@@ -2185,8 +2220,11 @@ function loginLocation(reason = "expired") {
|
|
|
2185
2220
|
target.searchParams.set("reason", reason);
|
|
2186
2221
|
return target.pathname + target.search;
|
|
2187
2222
|
}
|
|
2223
|
+
function holdLoginRedirect(timeoutMs) {
|
|
2224
|
+
return loginNavigation.hold(timeoutMs);
|
|
2225
|
+
}
|
|
2188
2226
|
function goToLogin(reason = "expired") {
|
|
2189
|
-
|
|
2227
|
+
loginNavigation.go(reason);
|
|
2190
2228
|
}
|
|
2191
2229
|
async function authRequest(path, body) {
|
|
2192
2230
|
const response = await fetch(path, {
|
|
@@ -2237,29 +2275,6 @@ function isUnauthorized(error) {
|
|
|
2237
2275
|
|
|
2238
2276
|
// src/client/settings/section.tsx
|
|
2239
2277
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2240
|
-
var field = {
|
|
2241
|
-
display: "block",
|
|
2242
|
-
width: "100%",
|
|
2243
|
-
maxWidth: 420,
|
|
2244
|
-
minHeight: 38,
|
|
2245
|
-
margin: "6px 0 14px",
|
|
2246
|
-
padding: "7px 10px",
|
|
2247
|
-
border: "1px solid currentColor",
|
|
2248
|
-
borderRadius: 6,
|
|
2249
|
-
background: "transparent",
|
|
2250
|
-
color: "inherit",
|
|
2251
|
-
font: "inherit"
|
|
2252
|
-
};
|
|
2253
|
-
var button = {
|
|
2254
|
-
padding: "8px 13px",
|
|
2255
|
-
border: "1px solid currentColor",
|
|
2256
|
-
borderRadius: 6,
|
|
2257
|
-
background: "transparent",
|
|
2258
|
-
color: "inherit",
|
|
2259
|
-
font: "inherit",
|
|
2260
|
-
cursor: "pointer"
|
|
2261
|
-
};
|
|
2262
|
-
var row = { display: "flex", flexWrap: "wrap", gap: 10, margin: "20px 0" };
|
|
2263
2278
|
var draft = {
|
|
2264
2279
|
panel: null,
|
|
2265
2280
|
binding: null,
|
|
@@ -2267,16 +2282,18 @@ var draft = {
|
|
|
2267
2282
|
message: null,
|
|
2268
2283
|
fields: {}
|
|
2269
2284
|
};
|
|
2285
|
+
var releaseBackupCodesRedirect;
|
|
2270
2286
|
function resetDraft() {
|
|
2287
|
+
releaseBackupCodesRedirect?.();
|
|
2288
|
+
releaseBackupCodesRedirect = void 0;
|
|
2271
2289
|
draft = { panel: null, binding: null, backupCodes: null, message: null, fields: {} };
|
|
2272
2290
|
}
|
|
2273
2291
|
function TextField(props) {
|
|
2274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "auth-remote-field", children: [
|
|
2275
2293
|
props.label,
|
|
2276
2294
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2277
2295
|
"input",
|
|
2278
2296
|
{
|
|
2279
|
-
style: field,
|
|
2280
2297
|
name: props.name,
|
|
2281
2298
|
defaultValue: draft.fields[props.name] ?? "",
|
|
2282
2299
|
onChange: (event) => {
|
|
@@ -2351,6 +2368,7 @@ function SecuritySection({
|
|
|
2351
2368
|
}, []);
|
|
2352
2369
|
async function submit(operation, done) {
|
|
2353
2370
|
if (busy) return;
|
|
2371
|
+
const release = holdLoginRedirect(3e4);
|
|
2354
2372
|
setBusy(true);
|
|
2355
2373
|
setMessage(null);
|
|
2356
2374
|
try {
|
|
@@ -2359,6 +2377,7 @@ function SecuritySection({
|
|
|
2359
2377
|
if (isUnauthorized(error)) goToLogin();
|
|
2360
2378
|
else setMessage(settingsError(error));
|
|
2361
2379
|
} finally {
|
|
2380
|
+
release();
|
|
2362
2381
|
setBusy(false);
|
|
2363
2382
|
}
|
|
2364
2383
|
}
|
|
@@ -2367,41 +2386,50 @@ function SecuritySection({
|
|
|
2367
2386
|
return new FormData(event.currentTarget);
|
|
2368
2387
|
}
|
|
2369
2388
|
if (backupCodes) {
|
|
2370
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
"
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2390
|
+
"section",
|
|
2391
|
+
{
|
|
2392
|
+
ref: sectionRef,
|
|
2393
|
+
className: "auth-remote-security",
|
|
2394
|
+
"aria-label": t("settingsSectionAria"),
|
|
2395
|
+
children: [
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("settingsBackupTitle") }),
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("settingsBackupDescription") }),
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "auth-remote-backup-codes", children: backupCodes.map((code) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: code }, code)) }),
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2400
|
+
"button",
|
|
2401
|
+
{
|
|
2402
|
+
className: "auth-remote-button",
|
|
2403
|
+
onClick: () => {
|
|
2404
|
+
goToLogin("updated");
|
|
2405
|
+
resetDraft();
|
|
2406
|
+
},
|
|
2407
|
+
children: t("settingsBackupSaved")
|
|
2408
|
+
}
|
|
2409
|
+
)
|
|
2410
|
+
]
|
|
2411
|
+
}
|
|
2412
|
+
);
|
|
2386
2413
|
}
|
|
2387
2414
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2388
2415
|
"section",
|
|
2389
2416
|
{
|
|
2390
2417
|
ref: sectionRef,
|
|
2391
2418
|
"aria-label": t("settingsSectionAria"),
|
|
2392
|
-
|
|
2419
|
+
className: "auth-remote-security",
|
|
2393
2420
|
children: [
|
|
2394
2421
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("settingsTitle") }),
|
|
2395
2422
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: me ? t("settingsAccountSummary", {
|
|
2396
2423
|
username: me.username,
|
|
2397
2424
|
totp: t(me.totpEnabled ? "settingsTotpEnabled" : "settingsTotpNotBound")
|
|
2398
2425
|
}) : t("settingsLoading") }),
|
|
2399
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "auth-remote-actions", children: [
|
|
2400
2427
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2401
2428
|
"button",
|
|
2402
2429
|
{
|
|
2403
|
-
|
|
2404
|
-
disabled: !me,
|
|
2430
|
+
className: "auth-remote-button",
|
|
2431
|
+
disabled: !me || busy,
|
|
2432
|
+
"aria-pressed": panel === "password",
|
|
2405
2433
|
onClick: () => {
|
|
2406
2434
|
setPanel("password");
|
|
2407
2435
|
setMessage(null);
|
|
@@ -2412,8 +2440,9 @@ function SecuritySection({
|
|
|
2412
2440
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2413
2441
|
"button",
|
|
2414
2442
|
{
|
|
2415
|
-
|
|
2416
|
-
disabled: !me,
|
|
2443
|
+
className: "auth-remote-button",
|
|
2444
|
+
disabled: !me || busy,
|
|
2445
|
+
"aria-pressed": panel === "totp",
|
|
2417
2446
|
onClick: () => {
|
|
2418
2447
|
setPanel("totp");
|
|
2419
2448
|
setBinding(null);
|
|
@@ -2425,8 +2454,9 @@ function SecuritySection({
|
|
|
2425
2454
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2426
2455
|
"button",
|
|
2427
2456
|
{
|
|
2428
|
-
|
|
2429
|
-
disabled: !me,
|
|
2457
|
+
className: "auth-remote-button",
|
|
2458
|
+
disabled: !me || busy,
|
|
2459
|
+
"aria-pressed": panel === "sessions",
|
|
2430
2460
|
onClick: () => {
|
|
2431
2461
|
setPanel("sessions");
|
|
2432
2462
|
setMessage(null);
|
|
@@ -2492,7 +2522,7 @@ function SecuritySection({
|
|
|
2492
2522
|
autoComplete: "new-password"
|
|
2493
2523
|
}
|
|
2494
2524
|
),
|
|
2495
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: t("settingsSavePassword") })
|
|
2496
2526
|
]
|
|
2497
2527
|
}
|
|
2498
2528
|
),
|
|
@@ -2537,7 +2567,15 @@ function SecuritySection({
|
|
|
2537
2567
|
autoComplete: "one-time-code"
|
|
2538
2568
|
}
|
|
2539
2569
|
),
|
|
2540
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2571
|
+
"button",
|
|
2572
|
+
{
|
|
2573
|
+
className: "auth-remote-button auth-remote-primary",
|
|
2574
|
+
disabled: busy,
|
|
2575
|
+
type: "submit",
|
|
2576
|
+
children: t("settingsStartBinding")
|
|
2577
|
+
}
|
|
2578
|
+
)
|
|
2541
2579
|
]
|
|
2542
2580
|
}
|
|
2543
2581
|
),
|
|
@@ -2574,7 +2612,15 @@ function SecuritySection({
|
|
|
2574
2612
|
autoComplete: "one-time-code"
|
|
2575
2613
|
}
|
|
2576
2614
|
),
|
|
2577
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2616
|
+
"button",
|
|
2617
|
+
{
|
|
2618
|
+
className: "auth-remote-button auth-remote-primary",
|
|
2619
|
+
disabled: busy,
|
|
2620
|
+
type: "submit",
|
|
2621
|
+
children: t("settingsDisableTotp")
|
|
2622
|
+
}
|
|
2623
|
+
)
|
|
2578
2624
|
]
|
|
2579
2625
|
}
|
|
2580
2626
|
)
|
|
@@ -2589,7 +2635,14 @@ function SecuritySection({
|
|
|
2589
2635
|
challenge: binding.challenge,
|
|
2590
2636
|
code: data.get("code")
|
|
2591
2637
|
}),
|
|
2592
|
-
(result) =>
|
|
2638
|
+
(result) => {
|
|
2639
|
+
if (!sectionRef.current?.isConnected) {
|
|
2640
|
+
goToLogin("updated");
|
|
2641
|
+
return;
|
|
2642
|
+
}
|
|
2643
|
+
releaseBackupCodesRedirect ??= holdLoginRedirect();
|
|
2644
|
+
setBackupCodes(result.backupCodes);
|
|
2645
|
+
}
|
|
2593
2646
|
);
|
|
2594
2647
|
},
|
|
2595
2648
|
children: [
|
|
@@ -2598,14 +2651,14 @@ function SecuritySection({
|
|
|
2598
2651
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
2599
2652
|
t("settingsManualSecret"),
|
|
2600
2653
|
" ",
|
|
2601
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: binding.secret })
|
|
2602
2655
|
] }),
|
|
2603
2656
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextField, { label: t("settingsNewCode"), name: "code", autoComplete: "one-time-code" }),
|
|
2604
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: t("settingsConfirmBinding") }),
|
|
2605
2658
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2606
2659
|
"button",
|
|
2607
2660
|
{
|
|
2608
|
-
|
|
2661
|
+
className: "auth-remote-button auth-remote-restart",
|
|
2609
2662
|
type: "button",
|
|
2610
2663
|
onClick: () => setBinding(null),
|
|
2611
2664
|
children: t("settingsRestartBinding")
|
|
@@ -2619,7 +2672,7 @@ function SecuritySection({
|
|
|
2619
2672
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2620
2673
|
"button",
|
|
2621
2674
|
{
|
|
2622
|
-
|
|
2675
|
+
className: "auth-remote-button",
|
|
2623
2676
|
disabled: busy,
|
|
2624
2677
|
onClick: () => void submit(
|
|
2625
2678
|
() => authRequest("/auth-remote/logout", {}),
|
|
@@ -2661,12 +2714,20 @@ function SecuritySection({
|
|
|
2661
2714
|
autoComplete: "one-time-code"
|
|
2662
2715
|
}
|
|
2663
2716
|
),
|
|
2664
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2718
|
+
"button",
|
|
2719
|
+
{
|
|
2720
|
+
className: "auth-remote-button auth-remote-primary",
|
|
2721
|
+
disabled: busy,
|
|
2722
|
+
type: "submit",
|
|
2723
|
+
children: t("settingsSignOutAll")
|
|
2724
|
+
}
|
|
2725
|
+
)
|
|
2665
2726
|
]
|
|
2666
2727
|
}
|
|
2667
2728
|
)
|
|
2668
2729
|
] }),
|
|
2669
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", "aria-live": "assertive", children: message && t(message.key, message.params) })
|
|
2730
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "auth-remote-error", role: "alert", "aria-live": "assertive", children: message && t(message.key, message.params) })
|
|
2670
2731
|
]
|
|
2671
2732
|
}
|
|
2672
2733
|
);
|
|
@@ -3049,11 +3110,21 @@ var zh = {
|
|
|
3049
3110
|
cliErrorUnknown: "\u64CD\u4F5C\u5931\u8D25\uFF1B\u518D\u6B21\u64CD\u4F5C\u524D\u8BF7\u5148\u68C0\u67E5\u72B6\u6001\u3002"
|
|
3050
3111
|
};
|
|
3051
3112
|
|
|
3113
|
+
// src/client/settings/style.css
|
|
3114
|
+
var style_default = "/* Inherit the host's live DSH theme. Scope every rule to this settings section.\n * Radius fallbacks match 0.1.7, before DSH published the shared radius tokens. */\n.auth-remote-security {\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-security h2 {\n margin: 0 0 8px;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.auth-remote-security h3 {\n margin: 0 0 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 22px;\n}\n\n.auth-remote-security p {\n margin: 0 0 16px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 4px 0 20px;\n}\n\n.auth-remote-security form {\n margin: 0;\n padding: 20px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n\n.auth-remote-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-bottom: 16px;\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-field input {\n box-sizing: border-box;\n width: 100%;\n max-width: 420px;\n min-width: 0;\n height: 32px;\n padding: 0 10px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md, 8px);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-field input:focus {\n outline: none;\n border-color: var(--dsw-alias-state-business-primary);\n}\n\n.auth-remote-button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n max-width: 100%;\n padding: 6px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md, 18px);\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n cursor: pointer;\n}\n\n.auth-remote-button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.auth-remote-button[aria-pressed='true'] {\n background: var(--dsw-alias-bg-module-platform);\n border-color: var(--dsw-static-neutral-bluish-400);\n}\n\n.auth-remote-primary {\n border-color: transparent;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.auth-remote-primary:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-hover);\n}\n\n.auth-remote-button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.auth-remote-button:focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 2px;\n}\n\n.auth-remote-restart {\n margin-left: 8px;\n}\n\n.auth-remote-security img {\n display: block;\n max-width: 100%;\n height: auto;\n margin: 16px 0;\n border-radius: var(--dsw-radius-md, 8px);\n}\n\n.auth-remote-security code,\n.auth-remote-backup-codes {\n font-family: var(--ds-font-family-code);\n overflow-wrap: anywhere;\n user-select: all;\n}\n\n.auth-remote-backup-codes {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px 24px;\n margin: 20px 0;\n padding: 16px 16px 16px 40px;\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.auth-remote-security .auth-remote-error {\n margin: 12px 0 0;\n color: var(--dsw-alias-state-error-primary);\n}\n\n.auth-remote-error:empty {\n display: none;\n}\n";
|
|
3115
|
+
|
|
3052
3116
|
// src/client/index.ts
|
|
3053
3117
|
var name = "auth-remote";
|
|
3054
3118
|
var inject = ["connection", "slots", "locale"];
|
|
3055
3119
|
function apply(ctx) {
|
|
3056
3120
|
assertRemoteHostCapability(ctx);
|
|
3121
|
+
ctx.effect(() => {
|
|
3122
|
+
const tag = document.createElement("style");
|
|
3123
|
+
tag.dataset.plugin = "dsh-auth-remote";
|
|
3124
|
+
tag.textContent = style_default;
|
|
3125
|
+
document.head.appendChild(tag);
|
|
3126
|
+
return () => tag.remove();
|
|
3127
|
+
}, "auth-remote: settings styles");
|
|
3057
3128
|
monitorSession(ctx);
|
|
3058
3129
|
ctx.effect(() => ctx.locale.register("auth-remote", { en, zh }), "auth-remote: dictionaries");
|
|
3059
3130
|
const t = ctx.locale.bind("auth-remote");
|