Security: dual token + customer guide page

- Split auth into agent-token (public) and controller-token (secret)
- Agent token in scripts can't be used to control devices
- Add agent.html: step-by-step guide for customers (Win/Mac/Linux)
- Update agent binaries with new token defaults
This commit is contained in:
dongsheng123132
2026-03-22 21:23:28 +08:00
parent a7db8e55f2
commit 934cecaf74
6 changed files with 203 additions and 2 deletions

201
website/agent.html Normal file
View File

@@ -0,0 +1,201 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>U-Claw 远程协助 - Agent 模式</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Microsoft YaHei', sans-serif; max-width: 640px; margin: 40px auto; padding: 0 20px; background: #1a1a2e; color: #eee; line-height: 1.6; }
h1 { text-align: center; font-size: 28px; margin-bottom: 8px; }
.subtitle { text-align: center; color: #aaa; margin-bottom: 30px; }
.step { background: #16213e; border-radius: 12px; padding: 20px; margin: 20px 0; }
.step h2 { color: #e94560; margin-bottom: 12px; font-size: 18px; }
.step p { color: #ccc; margin-bottom: 10px; }
.cmd { background: #0f3460; padding: 15px; border-radius: 8px; font-family: 'Consolas', 'Courier New', monospace; font-size: 15px; position: relative; word-break: break-all; cursor: pointer; transition: background 0.2s; }
.cmd:hover { background: #1a5276; }
.cmd:active { background: #1e6091; }
.copy-btn { position: absolute; right: 8px; top: 8px; background: #e94560; color: white; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.copy-btn:hover { background: #d63851; }
.note { color: #888; font-size: 13px; margin-top: 8px; }
.warn { color: #f0ad4e; font-size: 13px; margin-top: 8px; }
.tab-group { display: flex; gap: 0; margin-bottom: 0; }
.tab { padding: 8px 20px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 14px; background: #0d1b30; color: #888; border: 1px solid #1a3a5c; border-bottom: none; }
.tab.active { background: #16213e; color: #e94560; font-weight: bold; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.screenshot { background: #0a0a1a; border-radius: 8px; padding: 15px; margin: 10px 0; border: 1px solid #333; }
.screenshot pre { color: #4ec9b0; font-family: 'Consolas', monospace; font-size: 13px; white-space: pre-wrap; }
.safe-badge { display: inline-block; background: #1b5e20; color: #a5d6a7; padding: 4px 12px; border-radius: 20px; font-size: 12px; margin-top: 10px; }
.faq { background: #16213e; border-radius: 12px; padding: 20px; margin: 20px 0; }
.faq h3 { color: #e94560; margin-bottom: 8px; font-size: 15px; }
.faq p { color: #aaa; font-size: 14px; margin-bottom: 15px; }
img.guide-img { width: 100%; border-radius: 8px; margin: 10px 0; }
</style>
</head>
<body>
<h1>U-Claw 远程协助</h1>
<p class="subtitle">Agent 模式 - 轻量快速,一行命令上线</p>
<!-- Step 1 -->
<div class="step">
<h2>第 1 步:打开终端</h2>
<div class="tab-group">
<div class="tab active" onclick="switchTab('os', 'win')">Windows</div>
<div class="tab" onclick="switchTab('os', 'mac')">macOS</div>
<div class="tab" onclick="switchTab('os', 'linux')">Linux</div>
</div>
<div id="os-win" class="tab-content active">
<div style="background:#16213e; padding: 15px; border-radius: 0 8px 8px 8px; border: 1px solid #1a3a5c; border-top: none;">
<p><strong>方法 1推荐</strong></p>
<p>按键盘 <code style="background:#0f3460; padding:2px 8px; border-radius:4px;">Win + X</code>,选择 <strong>"终端(管理员)"</strong><strong>"PowerShell(管理员)"</strong></p>
<p style="margin-top:10px;"><strong>方法 2</strong></p>
<p><code style="background:#0f3460; padding:2px 8px; border-radius:4px;">Win</code> 键,搜索 <strong>"PowerShell"</strong>,右键选 <strong>"以管理员身份运行"</strong></p>
<div class="screenshot">
<pre>PS C:\Users\YourName&gt; _</pre>
</div>
<p class="note">看到这样的界面就对了 ↑</p>
</div>
</div>
<div id="os-mac" class="tab-content">
<div style="background:#16213e; padding: 15px; border-radius: 0 8px 8px 8px; border: 1px solid #1a3a5c; border-top: none;">
<p><code style="background:#0f3460; padding:2px 8px; border-radius:4px;">Command + 空格</code>,搜索 <strong>"终端"</strong><strong>"Terminal"</strong>,回车打开</p>
<div class="screenshot">
<pre>yourname@MacBook ~ % _</pre>
</div>
</div>
</div>
<div id="os-linux" class="tab-content">
<div style="background:#16213e; padding: 15px; border-radius: 0 8px 8px 8px; border: 1px solid #1a3a5c; border-top: none;">
<p><code style="background:#0f3460; padding:2px 8px; border-radius:4px;">Ctrl + Alt + T</code> 打开终端</p>
<div class="screenshot">
<pre>user@hostname:~$ _</pre>
</div>
</div>
</div>
</div>
<!-- Step 2 -->
<div class="step">
<h2>第 2 步:粘贴运行</h2>
<p>复制下面的命令,粘贴到终端里,按回车:</p>
<div id="cmd-win-wrap" class="tab-content active">
<div class="cmd" id="cmd-win" onclick="copyCmd('cmd-win')">
irm https://u-claw.org/agent.ps1 | iex
<button class="copy-btn" onclick="event.stopPropagation(); copyCmd('cmd-win')">复制</button>
</div>
<p class="note">提示:在 PowerShell 里右键即可粘贴</p>
</div>
<div id="cmd-mac-wrap" class="tab-content">
<div class="cmd" id="cmd-mac" onclick="copyCmd('cmd-mac')">
curl -fsSL https://u-claw.org/agent.sh | bash
<button class="copy-btn" onclick="event.stopPropagation(); copyCmd('cmd-mac')">复制</button>
</div>
<p class="note">提示Command+V 粘贴,然后回车</p>
</div>
<div id="cmd-linux-wrap" class="tab-content">
<div class="cmd" id="cmd-linux" onclick="copyCmd('cmd-linux')">
curl -fsSL https://u-claw.org/agent.sh | bash
<button class="copy-btn" onclick="event.stopPropagation(); copyCmd('cmd-linux')">复制</button>
</div>
<p class="note">提示Ctrl+Shift+V 粘贴,然后回车</p>
</div>
</div>
<!-- Step 3 -->
<div class="step">
<h2>第 3 步:发送设备 ID</h2>
<p>运行成功后会看到:</p>
<div class="screenshot">
<pre>
==========================================
Connected! Send this ID to support:
==========================================
+------------------------------------------+
| Device ID: desktop-a3f2 |
| Hostname: DESKTOP-ZHANGSAN |
+------------------------------------------+
* Close this window to disconnect
* Auto-disconnect after 2 hours</pre>
</div>
<p style="margin-top: 12px;"><strong>Device ID</strong>(如 <code style="background:#0f3460; padding:2px 8px; border-radius:4px;">desktop-a3f2</code>)发给技术支持即可。</p>
</div>
<!-- Safety -->
<div class="step" style="border: 1px solid #1b5e20;">
<h2 style="color: #4caf50;">安全说明</h2>
<p>
<span class="safe-badge">单向连接</span>
Agent 只接收并执行技术支持发送的诊断命令
</p>
<p>
<span class="safe-badge">随时断开</span>
关闭终端窗口即可立即断开连接
</p>
<p>
<span class="safe-badge">自动过期</span>
连接 2 小时后自动断开,不会常驻
</p>
<p>
<span class="safe-badge">无残留</span>
断开后自动清理下载的文件
</p>
</div>
<!-- FAQ -->
<div class="faq">
<h3>Q: 运行报错"无法加载文件"怎么办?</h3>
<p>在 PowerShell 里先运行:<code style="background:#0f3460; padding:2px 6px; border-radius:4px;">Set-ExecutionPolicy Bypass -Scope Process</code>,然后再粘贴命令。</p>
<h3>Q: 下载失败?</h3>
<p>检查网络连接,或者联系技术支持获取离线安装包。</p>
<h3>Q: 连不上服务器?</h3>
<p>可能是公司防火墙限制,请联系技术支持。</p>
</div>
<p style="text-align:center; color:#555; margin: 30px 0; font-size: 13px;">
U-Claw Remote Support &copy; 2026
</p>
<script>
function switchTab(group, name) {
// Update tab buttons
document.querySelectorAll('.tab-group .tab').forEach(t => t.classList.remove('active'));
event.target.classList.add('active');
// Update step 1 content
document.querySelectorAll('[id^="os-"]').forEach(c => c.classList.remove('active'));
document.getElementById('os-' + name).classList.add('active');
// Update step 2 commands
document.querySelectorAll('[id^="cmd-"][id$="-wrap"]').forEach(c => c.classList.remove('active'));
const cmdName = name === 'win' ? 'win' : name === 'mac' ? 'mac' : 'linux';
document.getElementById('cmd-' + cmdName + '-wrap').classList.add('active');
}
function copyCmd(id) {
const el = document.getElementById(id);
const text = el.childNodes[0].textContent.trim();
navigator.clipboard.writeText(text).then(() => {
const btn = el.querySelector('.copy-btn');
btn.textContent = '已复制 ✓';
btn.style.background = '#27ae60';
setTimeout(() => {
btn.textContent = '复制';
btn.style.background = '#e94560';
}, 1500);
});
}
</script>
</body>
</html>