@dsh-plus/access-gate 0.3.15 → 0.3.17

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/lib/index.js CHANGED
@@ -462,7 +462,13 @@ function registerGateRoutes(ctx, deps) {
462
462
  * 本页纯客户端跳转,无服务器端点,令牌校验完全由官方 authorizeIndex 完成。
463
463
  * @module access-gate/token-page
464
464
  */
465
- function renderTokenPage() {
465
+ /** 获取令牌的日志提示(平台相关:Windows/macOS 无 systemd journalctl)。 */
466
+ function tokenLogHint(platform) {
467
+ if (platform === "win32") return "服务器上执行 <code>dshctl url</code>,或在启动 dsh web 的终端窗口里查找 <code>dsh web:</code> 开头的行(链接中 token= 后的部分)";
468
+ if (platform === "darwin") return "服务器上执行 <code>dshctl url</code>,或查看启动 dsh web 终端里的 <code>dsh web:</code> 行(链接中 token= 后的部分)";
469
+ return "服务器上执行 <code>dshctl url</code>,或查看启动日志 <code>journalctl -u dsh-web | grep \"dsh web:\"</code>(链接中 token= 后的部分)";
470
+ }
471
+ function renderTokenPage(platform = process.platform) {
466
472
  return `<!DOCTYPE html>
467
473
  <html lang="zh-CN">
468
474
  <head>
@@ -508,7 +514,7 @@ function renderTokenPage() {
508
514
  <form class="card" id="form">
509
515
  <h1>需要登录</h1>
510
516
  <p>粘贴当前<strong>启动令牌</strong>完成登录。登录后此设备免令牌 30 天(按域名:端口分别持有)。</p>
511
- <p class="tip">令牌随每次 dsh web 重启更新,获取方式:服务器上执行 <code>dshctl url</code>,或查看启动日志 <code>journalctl -u dsh-web | grep "dsh web:"</code>(链接中 token= 后的部分)。PWA 内打开本页粘贴一次即可恢复。</p>
517
+ <p class="tip">令牌随每次 dsh web 重启更新,获取方式:${tokenLogHint(platform)}。PWA 内打开本页粘贴一次即可恢复。</p>
512
518
  <input id="token" type="password" placeholder="启动令牌" autocomplete="off" autofocus>
513
519
  <button id="btn" type="submit">登录</button>
514
520
  <div class="msg" id="msg"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/access-gate",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "dsh-plus service+ui plugin: dsh web 全量访问围栏——与官方 browser-auth 合并:官方 cookie 为唯一凭据,可选 IP 附加围栏,未认证导航渲染 token 输入页(PWA 可恢复),loopback 管理通道",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -31,20 +31,20 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@dsh-plus/shared": "0.1.24"
34
+ "@dsh-plus/shared": "0.1.27"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.4",
38
- "@deepseek-ai/dsh-home-paths": "^0.1.7-rc.1",
39
- "@deepseek-ai/dsh-settings": "^0.1.7-rc.1",
38
+ "@deepseek-ai/dsh-home-paths": "^0.2.0-rc.1",
39
+ "@deepseek-ai/dsh-settings": "^0.2.0-rc.1",
40
40
  "@deepseek-ai/schemastery": "^3.18.4"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@deepseek-ai/cordis": "4.0.4",
44
- "@deepseek-ai/dsh-client-connection": "0.1.7-rc.1",
45
- "@deepseek-ai/dsh-home-paths": "0.1.7-rc.1",
46
- "@deepseek-ai/dsh-host-webserver": "0.1.7-rc.1",
47
- "@deepseek-ai/dsh-settings": "0.1.7-rc.1",
44
+ "@deepseek-ai/dsh-client-connection": "0.2.0-rc.1",
45
+ "@deepseek-ai/dsh-home-paths": "0.2.0-rc.1",
46
+ "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.1",
47
+ "@deepseek-ai/dsh-settings": "0.2.0-rc.1",
48
48
  "@deepseek-ai/schemastery": "3.18.4",
49
49
  "@types/react": "~18.3.31",
50
50
  "react": "^18.2.0"
package/src/token-page.ts CHANGED
@@ -11,7 +11,19 @@
11
11
  * @module access-gate/token-page
12
12
  */
13
13
 
14
- export function renderTokenPage(): string {
14
+ /** 获取令牌的日志提示(平台相关:Windows/macOS 无 systemd journalctl)。 */
15
+ function tokenLogHint(platform: NodeJS.Platform): string {
16
+ if (platform === 'win32') {
17
+ return '服务器上执行 <code>dshctl url</code>,或在启动 dsh web 的终端窗口里查找 <code>dsh web:</code> 开头的行(链接中 token= 后的部分)'
18
+ }
19
+ if (platform === 'darwin') {
20
+ return '服务器上执行 <code>dshctl url</code>,或查看启动 dsh web 终端里的 <code>dsh web:</code> 行(链接中 token= 后的部分)'
21
+ }
22
+ return '服务器上执行 <code>dshctl url</code>,或查看启动日志 <code>journalctl -u dsh-web | grep "dsh web:"</code>(链接中 token= 后的部分)'
23
+ }
24
+
25
+ export function renderTokenPage(platform: NodeJS.Platform = process.platform): string {
26
+ const logHint = tokenLogHint(platform)
15
27
  return `<!DOCTYPE html>
16
28
  <html lang="zh-CN">
17
29
  <head>
@@ -57,7 +69,7 @@ export function renderTokenPage(): string {
57
69
  <form class="card" id="form">
58
70
  <h1>需要登录</h1>
59
71
  <p>粘贴当前<strong>启动令牌</strong>完成登录。登录后此设备免令牌 30 天(按域名:端口分别持有)。</p>
60
- <p class="tip">令牌随每次 dsh web 重启更新,获取方式:服务器上执行 <code>dshctl url</code>,或查看启动日志 <code>journalctl -u dsh-web | grep "dsh web:"</code>(链接中 token= 后的部分)。PWA 内打开本页粘贴一次即可恢复。</p>
72
+ <p class="tip">令牌随每次 dsh web 重启更新,获取方式:${logHint}。PWA 内打开本页粘贴一次即可恢复。</p>
61
73
  <input id="token" type="password" placeholder="启动令牌" autocomplete="off" autofocus>
62
74
  <button id="btn" type="submit">登录</button>
63
75
  <div class="msg" id="msg"></div>