pi-web-ui 0.114.3 → 0.116.0
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 +62 -1
- package/bin/pi-web-ui.mjs +90 -8
- package/dist/gh-comment-781.md +5 -0
- package/dist/server/agent-service-daemon.js +522 -32
- package/dist/server/agent-service.js +954 -402
- package/dist/server/canvas/canvas-dispatch.js +13 -1
- package/dist/server/client-state.js +42 -2
- package/dist/server/communicate-tool.js +2 -0
- package/dist/server/conversation-communication.js +14 -0
- package/dist/server/conversation-identity.js +27 -0
- package/dist/server/device-center/approval-summary.js +31 -0
- package/dist/server/device-center/bot-catalog.js +21 -7
- package/dist/server/device-center/bot-execution.js +100 -9
- package/dist/server/device-center/bot-presets.js +46 -0
- package/dist/server/device-center/collab-service.js +362 -13
- package/dist/server/device-center/collab-tool.js +824 -13
- package/dist/server/device-center/connector.js +359 -23
- package/dist/server/device-center/desktop-page.js +22 -16
- package/dist/server/device-center/device-integration.js +595 -0
- package/dist/server/device-center/execution-guides.js +32 -0
- package/dist/server/device-center/execution-instructions.js +20 -0
- package/dist/server/device-center/execution-settings.js +213 -0
- package/dist/server/device-center/execution-system-prompt.js +38 -0
- package/dist/server/device-center/execution-workspace.js +20 -0
- package/dist/server/device-center/executor.js +392 -40
- package/dist/server/device-center/file-sync-paths.js +171 -0
- package/dist/server/device-center/file-sync.js +186 -96
- package/dist/server/device-center/group-context-delta.js +37 -0
- package/dist/server/device-center/group-context-message.js +210 -0
- package/dist/server/device-center/group-context.js +179 -0
- package/dist/server/device-center/group-events.js +136 -0
- package/dist/server/device-center/group-plan-guard.js +138 -0
- package/dist/server/device-center/hub-conversations.js +233 -0
- package/dist/server/device-center/hub-deliveries.js +277 -0
- package/dist/server/device-center/hub-integration.js +451 -0
- package/dist/server/device-center/hub-locks.js +320 -0
- package/dist/server/device-center/hub-page.js +13 -33
- package/dist/server/device-center/hub-webhooks.js +165 -0
- package/dist/server/device-center/hub.js +2379 -107
- package/dist/server/device-center/human-interaction.js +232 -0
- package/dist/server/device-center/integration-errors.js +25 -0
- package/dist/server/device-center/local-hub.js +20 -1
- package/dist/server/device-center/local-page.js +17 -0
- package/dist/server/device-center/local.js +430 -41
- package/dist/server/device-center/main.js +11 -1
- package/dist/server/device-center/partition-log.js +293 -0
- package/dist/server/device-center/path-portal.js +11 -3
- package/dist/server/device-center/relay.js +364 -35
- package/dist/server/device-center/report-metadata.js +66 -0
- package/dist/server/device-center/report-upload.js +63 -0
- package/dist/server/device-center/runtime.js +598 -41
- package/dist/server/device-center/smoke-preview.js +3 -0
- package/dist/server/device-center/store.js +203 -41
- package/dist/server/device-center/task-context-budget.js +161 -0
- package/dist/server/device-center/task-journal.js +385 -0
- package/dist/server/device-center/task-plan.js +33 -0
- package/dist/server/device-center/task-progress.js +141 -0
- package/dist/server/device-center/task-recovery.js +452 -0
- package/dist/server/device-center/task-report-outbox.js +216 -0
- package/dist/server/device-center/task-report.js +384 -0
- package/dist/server/device-center/task-scheduler.js +445 -0
- package/dist/server/device-center/task-state.js +333 -0
- package/dist/server/device-center/transfer-stream.js +1006 -0
- package/dist/server/device-center/transfers.js +841 -8
- package/dist/server/dispatch-domain-handlers.js +35 -6
- package/dist/server/dsh/dsh-agent-service.js +6 -0
- package/dist/server/durable/durable-capabilities.js +11 -0
- package/dist/server/engine-probe.js +112 -1
- package/dist/server/global-loader.js +119 -19
- package/dist/server/goal-service.js +10 -5
- package/dist/server/index.js +222 -29
- package/dist/server/managed.js +2 -0
- package/dist/server/markers/builtins/services.js +123 -0
- package/dist/server/markers/builtins/todo.js +189 -0
- package/dist/server/markers-list-tool.js +34 -0
- package/dist/server/message-deletion.js +40 -0
- package/dist/server/message-window.js +9 -0
- package/dist/server/model-admin.js +48 -6
- package/dist/server/model-enrich.js +10 -1
- package/dist/server/orchestrator.js +109 -0
- package/dist/server/patch-executable-lookup.js +396 -0
- package/dist/server/payload-limits.js +2 -0
- package/dist/server/plugin-llm.js +100 -9
- package/dist/server/plugins.js +65 -7
- package/dist/server/preset-fields.js +24 -0
- package/dist/server/preset-share.js +2 -0
- package/dist/server/prompt-base-store.js +85 -0
- package/dist/server/prompt-composer.js +44 -2
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/protocol.js +2 -2
- package/dist/server/reasoning-registry.js +207 -0
- package/dist/server/remote-ssh-service.js +22 -9
- package/dist/server/resolve-global-sdk.js +2 -0
- package/dist/server/session-search.js +1 -1
- package/dist/server/settings-service.js +90 -39
- package/dist/server/skill-content-filler.js +29 -8
- package/dist/server/skill-tool.js +12 -3
- package/dist/server/startup-banner.js +35 -0
- package/dist/server/subagent-helpers.js +4 -1
- package/dist/server/subagents.js +52 -37
- package/dist/server/system-prompt-soul.js +41 -0
- package/dist/server/tool-host-factories.js +1 -0
- package/dist/server/tool-manager.js +17 -9
- package/dist/server/unauthorized-page.js +319 -0
- package/dist/server/univer-service.js +448 -0
- package/dist/server/universal/drivers/dsh-driver.js +379 -0
- package/dist/server/universal/universal-session.js +5 -0
- package/dist/server/webui-context.js +25 -5
- package/dist/test-artifact.md +9 -0
- package/dist/test-preview-modal.md +11 -0
- package/dist/test-report.html +20 -0
- package/docs/README.md +94 -0
- package/docs/architecture-plugins.md +946 -0
- package/docs/device-center.md +106 -12
- package/docs/dsh-engine.md +10 -10
- package/extensions/webui.ts +43 -1
- package/package.json +2 -1
- package/themes/aetheris.css +5 -0
- package/themes/ayu-light.css +6 -0
- package/themes/bases/flow-base.css +68 -68
- package/themes/catppuccin-latte.css +6 -0
- package/themes/catppuccin.css +6 -0
- package/themes/claude-code-dark.css +5 -0
- package/themes/codex.css +6 -0
- package/themes/cyberpunk.css +6 -0
- package/themes/dark-teal.css +6 -1
- package/themes/dazzle.css +6 -0
- package/themes/everforest-light.css +6 -0
- package/themes/flow-light.css +8 -1
- package/themes/flow.css +6 -1
- package/themes/geist.css +6 -0
- package/themes/gruvbox-light.css +6 -0
- package/themes/kanagawa-lotus.css +6 -0
- package/themes/md-preview.css +6 -0
- package/themes/mist.css +6 -0
- package/themes/nord.css +6 -0
- package/themes/one-dark.css +6 -0
- package/themes/paper.css +6 -0
- package/themes/rose-pine-dawn.css +6 -0
- package/themes/sakura.css +6 -0
- package/themes/solarized-light.css +6 -0
- package/themes/tokyo-night.css +6 -0
- package/themes/translucent.css +6 -0
- package/themes/transparent.css +6 -0
- package/themes/vs-code-dark.css +5 -0
- package/themes/wallpaper-flow.css +5 -1
- package/themes/wallpaper-obsidian.css +6 -0
- package/themes/white.css +6 -0
- package/themes/zhujian-dark.css +6 -1
- package/themes/zhujian.css +6 -1
- package/themes/zhupi-dark.css +6 -1
- package/themes/zhupi.css +6 -1
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BDoOpj-F.js +1 -0
- package/web/dist/assets/BgTasksModal-C0i3O1FT.js +1 -0
- package/web/dist/assets/{CanvasStudio-BSg9ghPV.js → CanvasStudio-B8thymBN.js} +3 -3
- package/web/dist/assets/{CanvasStudio-DxW7C3Sz.js → CanvasStudio-zSxyIx1R.js} +3 -3
- package/web/dist/assets/DeviceCenter-DfAHKcid.js +3 -0
- package/web/dist/assets/DeviceCenter-ydvOTlzE.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-q5Ik8oXg.js +1 -0
- package/web/dist/assets/DeviceGroups-CI14_SRb.js +1 -0
- package/web/dist/assets/DeviceGroups-DvsB5IEU.js +1 -0
- package/web/dist/assets/Dropdown-C4LIhshN.js +1 -0
- package/web/dist/assets/FilePreview-BgGongmv.js +2 -0
- package/web/dist/assets/FilePreview-D4NrhF-U.js +2 -0
- package/web/dist/assets/GlobalSearchModal-BWgU8yPd.js +1 -0
- package/web/dist/assets/GlobalSearchModal-F7fNimKk.js +1 -0
- package/web/dist/assets/GroupConversation-Dh71Pdb-.js +17 -0
- package/web/dist/assets/GroupConversation-ZK3nRmNm.js +17 -0
- package/web/dist/assets/HintTip-c6d0TJoh.js +1 -0
- package/web/dist/assets/ModelConfigModal-YVEgyy34.js +2 -0
- package/web/dist/assets/ModelConfigModal-vWtg3srp.js +2 -0
- package/web/dist/assets/PiSetupModal-BmMrrgB9.js +1 -0
- package/web/dist/assets/ProviderOAuthControls-BGSBIKD7.js +1 -0
- package/web/dist/assets/SCMPanel-B8_EDxNr.js +2 -0
- package/web/dist/assets/SCMPanel-BU58qk3T.js +2 -0
- package/web/dist/assets/SettingsModal-CMUybq3J.js +32 -0
- package/web/dist/assets/SettingsModal-OBmGTh-5.js +32 -0
- package/web/dist/assets/TerminalPanel-0CYvD72B.js +3 -0
- package/web/dist/assets/TerminalPanel-DDavKvFr.js +3 -0
- package/web/dist/assets/TuiOverlayModal-BsA-QTvN.js +1 -0
- package/web/dist/assets/TuiOverlayModal-DzoVQBuG.js +1 -0
- package/web/dist/assets/app-globals-CZxzGvIo.js +123 -0
- package/web/dist/assets/canvas-client-CUnXlQYX.js +1 -0
- package/web/dist/assets/{desktop-7EvUHhKQ.js → desktop-aAKpvKJV.js} +1 -1
- package/web/dist/assets/group-view-state-CGCzYF8k.js +1 -0
- package/web/dist/assets/index-C6DwztqE.css +1 -0
- package/web/dist/assets/index-CuN802Sj.js +93 -0
- package/web/dist/assets/index-EH5Fw9fa.js +93 -0
- package/web/dist/assets/plugin-host-BRWib9DF.js +1 -0
- package/web/dist/assets/remote-ssh-client-CfYSMEZg.js +1 -0
- package/web/dist/assets/theme-D2l_mLNo.js +1 -0
- package/web/dist/index.html +10 -9
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/BgTasksModal-BvnUHjFe.js +0 -1
- package/web/dist/assets/BgTasksModal-DSC8ncW3.js +0 -1
- package/web/dist/assets/DeviceCenter-Bmgr-Bwm.js +0 -3
- package/web/dist/assets/DeviceCenter-Cl9MBXaH.js +0 -3
- package/web/dist/assets/DeviceGroups-aeLD2msl.js +0 -1
- package/web/dist/assets/Dropdown-D1Jl35dw.js +0 -1
- package/web/dist/assets/FilePreview-6CqoDF_P.js +0 -2
- package/web/dist/assets/FilePreview-CJa27G_Q.js +0 -2
- package/web/dist/assets/GlobalSearchModal-CJX35rZL.js +0 -1
- package/web/dist/assets/GlobalSearchModal-CMW0xz0P.js +0 -1
- package/web/dist/assets/GroupConversation-Cq4daBFb.js +0 -1
- package/web/dist/assets/GroupConversation-DoELa83U.js +0 -1
- package/web/dist/assets/ModelConfigModal-Bp7tfKYh.js +0 -2
- package/web/dist/assets/PiSetupModal-DD8srwBJ.js +0 -1
- package/web/dist/assets/ProviderOAuthControls-C6tfXb88.js +0 -1
- package/web/dist/assets/SCMPanel-CghgsyBN.js +0 -2
- package/web/dist/assets/SCMPanel-D8-8aqwC.js +0 -2
- package/web/dist/assets/SettingsModal-BbBe2rYo.js +0 -20
- package/web/dist/assets/SettingsModal-qETiVPKj.js +0 -20
- package/web/dist/assets/TerminalPanel-Da-Xs4Wk.js +0 -3
- package/web/dist/assets/TerminalPanel-DnS4tFQO.js +0 -3
- package/web/dist/assets/TuiOverlayModal-CGyGkKYl.js +0 -1
- package/web/dist/assets/TuiOverlayModal-CpBKjG6x.js +0 -1
- package/web/dist/assets/app-globals-DcyO0UPi.js +0 -1
- package/web/dist/assets/fi-NyN-ZrgD.js +0 -325
- package/web/dist/assets/index-DK3F5ZJo.js +0 -85
- package/web/dist/assets/index-DQMii2he.js +0 -85
- package/web/dist/assets/index-vwBnwzkr.css +0 -1
- package/web/dist/assets/plugin-host-BCnX3P8U.js +0 -1
- package/web/dist/assets/theme-D2DMH6tH.js +0 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modern 401 Unauthorized page for browser navigation when PI_WEB_TOKEN is required.
|
|
3
|
+
* Features:
|
|
4
|
+
* - Self-healing: automatically tries cached token from localStorage if available
|
|
5
|
+
* - Clean UI matching the design system of the /setup page
|
|
6
|
+
* - Token input with direct entry
|
|
7
|
+
* - Helpful shortcuts for loopback/localhost visitors (direct link to /setup)
|
|
8
|
+
*/
|
|
9
|
+
export function renderUnauthorizedHtml(options) {
|
|
10
|
+
const { isLoopback, isStaleCookie } = options;
|
|
11
|
+
const title = isStaleCookie ? "访问口令已失效" : "需要访问口令";
|
|
12
|
+
const desc = isStaleCookie
|
|
13
|
+
? "服务端口令已变更,浏览器中保存的旧凭证已失效并已自动清除。请输入当前有效口令以重新进入系统。"
|
|
14
|
+
: "当前 pi-web-ui 实例已配置安全口令鉴权 (PI_WEB_TOKEN)。请输入口令以访问工作区。";
|
|
15
|
+
return `<!doctype html>
|
|
16
|
+
<html lang="zh-CN">
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="utf-8">
|
|
19
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
20
|
+
<title>${title} — pi-web-ui</title>
|
|
21
|
+
<style>
|
|
22
|
+
:root {
|
|
23
|
+
--bg: #090a0f;
|
|
24
|
+
--card-bg: rgba(22, 24, 33, 0.85);
|
|
25
|
+
--card-border: rgba(255, 255, 255, 0.1);
|
|
26
|
+
--input-bg: rgba(13, 14, 20, 0.9);
|
|
27
|
+
--input-border: rgba(255, 255, 255, 0.15);
|
|
28
|
+
--input-focus: #3b82f6;
|
|
29
|
+
--primary: #3b82f6;
|
|
30
|
+
--primary-hover: #2563eb;
|
|
31
|
+
--text: #f3f4f6;
|
|
32
|
+
--text-muted: #9ca3af;
|
|
33
|
+
--text-dim: #6b7280;
|
|
34
|
+
--warning-bg: rgba(245, 158, 11, 0.12);
|
|
35
|
+
--warning-border: rgba(245, 158, 11, 0.3);
|
|
36
|
+
--radius: 10px;
|
|
37
|
+
--radius-lg: 14px;
|
|
38
|
+
}
|
|
39
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
40
|
+
body {
|
|
41
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
42
|
+
background-color: var(--bg);
|
|
43
|
+
background-image:
|
|
44
|
+
radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
|
|
45
|
+
radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
|
|
46
|
+
background-attachment: fixed;
|
|
47
|
+
color: var(--text);
|
|
48
|
+
min-height: 100vh;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
padding: 24px 16px;
|
|
53
|
+
line-height: 1.5;
|
|
54
|
+
-webkit-font-smoothing: antialiased;
|
|
55
|
+
}
|
|
56
|
+
.card {
|
|
57
|
+
width: 100%;
|
|
58
|
+
max-width: 480px;
|
|
59
|
+
background: var(--card-bg);
|
|
60
|
+
border: 1px solid var(--card-border);
|
|
61
|
+
border-radius: var(--radius-lg);
|
|
62
|
+
padding: 32px 28px;
|
|
63
|
+
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
|
|
64
|
+
backdrop-filter: blur(16px);
|
|
65
|
+
}
|
|
66
|
+
.header {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 12px;
|
|
70
|
+
margin-bottom: 20px;
|
|
71
|
+
}
|
|
72
|
+
.icon-box {
|
|
73
|
+
width: 42px;
|
|
74
|
+
height: 42px;
|
|
75
|
+
border-radius: 10px;
|
|
76
|
+
background: rgba(59, 130, 246, 0.15);
|
|
77
|
+
border: 1px solid rgba(59, 130, 246, 0.3);
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
color: #60a5fa;
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
}
|
|
84
|
+
.title-group h1 {
|
|
85
|
+
font-size: 18px;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
color: var(--text);
|
|
88
|
+
}
|
|
89
|
+
.title-group .sub {
|
|
90
|
+
font-size: 13px;
|
|
91
|
+
color: var(--text-dim);
|
|
92
|
+
}
|
|
93
|
+
.desc {
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
color: var(--text-muted);
|
|
96
|
+
margin-bottom: 24px;
|
|
97
|
+
line-height: 1.6;
|
|
98
|
+
}
|
|
99
|
+
.stale-notice {
|
|
100
|
+
background: var(--warning-bg);
|
|
101
|
+
border: 1px solid var(--warning-border);
|
|
102
|
+
border-radius: var(--radius);
|
|
103
|
+
padding: 12px 14px;
|
|
104
|
+
margin-bottom: 20px;
|
|
105
|
+
font-size: 13px;
|
|
106
|
+
color: #fde68a;
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: 10px;
|
|
109
|
+
align-items: flex-start;
|
|
110
|
+
}
|
|
111
|
+
.stale-notice svg {
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
margin-top: 2px;
|
|
114
|
+
}
|
|
115
|
+
.input-row {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: 8px;
|
|
119
|
+
margin-bottom: 20px;
|
|
120
|
+
}
|
|
121
|
+
.input-row label {
|
|
122
|
+
font-size: 13px;
|
|
123
|
+
font-weight: 500;
|
|
124
|
+
color: var(--text-muted);
|
|
125
|
+
}
|
|
126
|
+
.input-wrapper {
|
|
127
|
+
position: relative;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
}
|
|
131
|
+
.input-wrapper input {
|
|
132
|
+
width: 100%;
|
|
133
|
+
background: var(--input-bg);
|
|
134
|
+
border: 1px solid var(--input-border);
|
|
135
|
+
color: var(--text);
|
|
136
|
+
border-radius: var(--radius);
|
|
137
|
+
padding: 10px 42px 10px 14px;
|
|
138
|
+
font-size: 14px;
|
|
139
|
+
outline: none;
|
|
140
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
141
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
142
|
+
}
|
|
143
|
+
.input-wrapper input:focus {
|
|
144
|
+
border-color: var(--input-focus);
|
|
145
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
|
|
146
|
+
}
|
|
147
|
+
.btn-toggle {
|
|
148
|
+
position: absolute;
|
|
149
|
+
right: 10px;
|
|
150
|
+
background: none;
|
|
151
|
+
border: none;
|
|
152
|
+
color: var(--text-dim);
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
padding: 4px;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
}
|
|
158
|
+
.btn-toggle:hover { color: var(--text); }
|
|
159
|
+
.btn-submit {
|
|
160
|
+
width: 100%;
|
|
161
|
+
background: var(--primary);
|
|
162
|
+
color: #fff;
|
|
163
|
+
border: none;
|
|
164
|
+
border-radius: var(--radius);
|
|
165
|
+
padding: 11px 16px;
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
transition: background-color 0.15s;
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
gap: 8px;
|
|
174
|
+
}
|
|
175
|
+
.btn-submit:hover { background: var(--primary-hover); }
|
|
176
|
+
.divider {
|
|
177
|
+
height: 1px;
|
|
178
|
+
background: var(--card-border);
|
|
179
|
+
margin: 24px 0;
|
|
180
|
+
}
|
|
181
|
+
.loopback-box {
|
|
182
|
+
background: rgba(255, 255, 255, 0.03);
|
|
183
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
184
|
+
border-radius: var(--radius);
|
|
185
|
+
padding: 14px;
|
|
186
|
+
font-size: 13px;
|
|
187
|
+
color: var(--text-muted);
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-direction: column;
|
|
190
|
+
gap: 10px;
|
|
191
|
+
}
|
|
192
|
+
.loopback-box p { line-height: 1.5; }
|
|
193
|
+
.btn-setup {
|
|
194
|
+
display: inline-flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: center;
|
|
197
|
+
gap: 6px;
|
|
198
|
+
background: rgba(255, 255, 255, 0.08);
|
|
199
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
200
|
+
color: var(--text);
|
|
201
|
+
text-decoration: none;
|
|
202
|
+
padding: 8px 14px;
|
|
203
|
+
border-radius: var(--radius);
|
|
204
|
+
font-size: 13px;
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
transition: background 0.15s;
|
|
207
|
+
}
|
|
208
|
+
.btn-setup:hover { background: rgba(255, 255, 255, 0.14); }
|
|
209
|
+
</style>
|
|
210
|
+
<script>
|
|
211
|
+
(function() {
|
|
212
|
+
try {
|
|
213
|
+
var saved = localStorage.getItem("pi-web-ui:token");
|
|
214
|
+
var u = new URL(window.location.href);
|
|
215
|
+
if (saved && !u.searchParams.has("__tried_cached_token")) {
|
|
216
|
+
u.searchParams.set("token", saved);
|
|
217
|
+
u.searchParams.set("__tried_cached_token", "1");
|
|
218
|
+
window.location.replace(u.toString());
|
|
219
|
+
}
|
|
220
|
+
} catch(e) {}
|
|
221
|
+
})();
|
|
222
|
+
</script>
|
|
223
|
+
</head>
|
|
224
|
+
<body>
|
|
225
|
+
<div class="card">
|
|
226
|
+
<div class="header">
|
|
227
|
+
<div class="icon-box">
|
|
228
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
229
|
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
230
|
+
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
|
|
231
|
+
</svg>
|
|
232
|
+
</div>
|
|
233
|
+
<div class="title-group">
|
|
234
|
+
<h1>${title}</h1>
|
|
235
|
+
<div class="sub">pi-web-ui 安全访问控制</div>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
${isStaleCookie
|
|
240
|
+
? `<div class="stale-notice">
|
|
241
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
242
|
+
<circle cx="12" cy="12" r="10"/>
|
|
243
|
+
<line x1="12" y1="8" x2="12" y2="12"/>
|
|
244
|
+
<line x1="12" y1="16" x2="12.01" y2="16"/>
|
|
245
|
+
</svg>
|
|
246
|
+
<div><strong>服务端口令已变更</strong>:原登录凭据已失效,请输入当前生效的访问口令。</div>
|
|
247
|
+
</div>`
|
|
248
|
+
: ""}
|
|
249
|
+
|
|
250
|
+
<p class="desc">${desc}</p>
|
|
251
|
+
|
|
252
|
+
<form id="auth-form">
|
|
253
|
+
<div class="input-row">
|
|
254
|
+
<label for="token-input">访问口令 (Token)</label>
|
|
255
|
+
<div class="input-wrapper">
|
|
256
|
+
<input id="token-input" type="password" autofocus autocomplete="off" placeholder="请输入口令或从终端复制">
|
|
257
|
+
<button type="button" id="btn-toggle-eye" class="btn-toggle" title="显示/隐藏口令">
|
|
258
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
259
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
|
|
260
|
+
<circle cx="12" cy="12" r="3"/>
|
|
261
|
+
</svg>
|
|
262
|
+
</button>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
<button type="submit" class="btn-submit">
|
|
266
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
267
|
+
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>
|
|
268
|
+
<polyline points="10 17 15 12 10 7"/>
|
|
269
|
+
<line x1="15" y1="12" x2="3" y2="12"/>
|
|
270
|
+
</svg>
|
|
271
|
+
进入工作区
|
|
272
|
+
</button>
|
|
273
|
+
</form>
|
|
274
|
+
|
|
275
|
+
${isLoopback
|
|
276
|
+
? `<div class="divider"></div>
|
|
277
|
+
<div class="loopback-box">
|
|
278
|
+
<p>💡 <strong>本机访问特权</strong>:服务运行在您的本机,您可在启动终端中直接点击带 Token 的链接,或进入配置中心管理口令:</p>
|
|
279
|
+
<a href="/setup" class="btn-setup">
|
|
280
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
281
|
+
<circle cx="12" cy="12" r="3"/>
|
|
282
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
|
|
283
|
+
</svg>
|
|
284
|
+
打开本机配置中心 (/setup)
|
|
285
|
+
</a>
|
|
286
|
+
</div>`
|
|
287
|
+
: ""}
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<script>
|
|
291
|
+
var input = document.getElementById("token-input");
|
|
292
|
+
var eyeBtn = document.getElementById("btn-toggle-eye");
|
|
293
|
+
var isPwd = true;
|
|
294
|
+
if (eyeBtn && input) {
|
|
295
|
+
eyeBtn.onclick = function() {
|
|
296
|
+
isPwd = !isPwd;
|
|
297
|
+
input.type = isPwd ? "password" : "text";
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
var form = document.getElementById("auth-form");
|
|
302
|
+
if (form && input) {
|
|
303
|
+
form.onsubmit = function(e) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
var val = input.value.trim();
|
|
306
|
+
if (!val) {
|
|
307
|
+
input.focus();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
var u = new URL(window.location.href);
|
|
311
|
+
u.searchParams.set("token", val);
|
|
312
|
+
u.searchParams.delete("__tried_cached_token");
|
|
313
|
+
window.location.href = u.toString();
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
</script>
|
|
317
|
+
</body>
|
|
318
|
+
</html>`;
|
|
319
|
+
}
|