三条线合并入库 —— 均已完成并上线(源码与生产一致,此前只部署未入仓)。 ⚠️ 其中域名迁移线为**另一会话**产出,本会话只做入库、**未复验其正确性**(它自报零回归)。 【档案 134 · 注册页人机验证 + 邮箱验证码】 - DB 迁移 v10:users.email(唯一索引 LOWER(email))+ email_codes 事件表(2 索引) - 新增模块 src/web/{register-guard,mail,turnstile,email-code}.ts - routes/auth.ts:新增 GET /api/auth/register/config、POST /api/auth/register/email-code; 注册接口加人机验证与验证码校验;config.ts 新增 12 项配置(默认空 ⇒ 不配 = 老行为) - 邮件走**可插拔驱动**(brevo/http/log),发件人 [email protected](Brevo 域名已认证 + DKIM + SPF) - 防爆破:三层配额(邮箱 6/h、8/天;IP 20/h;全局 200/h)+ 递增冷却阶梯 (60→60→180→300→900→1800s)+ 试错 5 次作废 + 码只存哈希 + 单次使用 + 与用户名绑定 - Turnstile 服务端校 **success + action + hostname 三项**:sitekey 是公开的, 只校 success 时"拿我们的 sitekey 在自己站点替真人取合法 token 再打我们接口"这条路是通的 - 新增 test/register-guard.test.mjs(19 用例) 【档案 137 · 品牌标识改造 — 去 DeepSeek 图形】 - login/register/admin 页头:删 DeepSeek 鲸鱼图标 + 「DeepSeek」文字图形 → 平台标识(中文「能力枢纽」/英语及其他语言「CapabilityNet」,走 i18n 词条 brand.name) - portal 顶栏换图标(页面名「管理门户」保留) - 新建 web/favicon.svg(平台自有 hub 图标,避开 DeepSeek 蓝)+ 四页 favicon 指向它 - 新增 test/i18n-brand.test.mjs(node:vm 跑真实 i18n.js,六条语言路径断言渲染结果) - scripts/verify-static.mjs 新增 SVG 段:XML 注释不得含 ASCII 双连字符(否则整份 SVG 解析失败、图标静默不显示 —— 实际踩到过) - 🔴 会话页面(实例内官方 dsh 界面)的标识**按用户要求未动**(也受 R2 约束) 【档案 135/136 · 域名迁移线(另一会话产出)】 - 域名收敛为 ai1net.com;旧域 alotbuy.com 降级为 301 过渡装置 - src/net/relay/{addr-override,directory,rendezvous,switcher}.ts 种子与候选链更新; src/web/server.ts、src/worker/relay-tunnel.ts、scripts/verify-cluster-domain.mjs - 档案 136 = 控制面按两台中继取并集(**已立项、未落地**) 验证(本会话两条线):新增单测 21 条全通过|全量 221 pass / 0 fail / 1 skipped| verify-static 全合格|其余 10 个 verify 脚本全 OK|线上实测:Turnstile 假 token 403、 发码 delivered、四页 deepseek 命中 0、favicon 200。
162 lines
7.6 KiB
HTML
162 lines
7.6 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title data-i18n="wake.title">Starting your workspace</title>
|
|
<link rel="stylesheet" href="/design.css" />
|
|
<!-- 档案 81 · R5:平台多语言运行时(默认英语) -->
|
|
<script src="/i18n.js"></script>
|
|
<style>
|
|
/* 档案 77「AI 核心」加载体 —— 与实例页恢复浮层**同一套视觉语言**(配色跟随平台主题) */
|
|
.wk-orb{position:relative;width:86px;height:86px;margin:2px auto 16px}
|
|
.wk-halo{position:absolute;inset:-18px;border-radius:50%;
|
|
background:radial-gradient(circle, rgba(83,74,183,.20), rgba(139,124,246,.12) 46%, transparent 70%);
|
|
animation:wk-halo 2.6s ease-in-out infinite}
|
|
.wk-arc{position:absolute;inset:0;border-radius:50%;
|
|
background:conic-gradient(from 0deg, rgba(83,74,183,0) 0deg, rgba(83,74,183,.05) 110deg, #534AB7 296deg, #8B7CF6 342deg, rgba(139,124,246,0) 360deg);
|
|
-webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
|
|
mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
|
|
animation:wk-spin 1.5s linear infinite}
|
|
.wk-arc2{position:absolute;inset:13px;border-radius:50%;border:1px dashed rgba(139,124,246,.42);
|
|
animation:wk-spin-rev 7s linear infinite}
|
|
.wk-ring{position:absolute;inset:24px;border-radius:50%;border:1px solid rgba(83,74,183,.18)}
|
|
.wk-core{position:absolute;left:50%;top:50%;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;
|
|
background:radial-gradient(circle, #ffffff 0%, #6B5FD6 46%, rgba(83,74,183,0) 74%);
|
|
box-shadow:0 0 12px rgba(83,74,183,.55), 0 0 30px rgba(139,124,246,.35);
|
|
animation:wk-core 1.6s ease-in-out infinite}
|
|
.wk-dots{position:absolute;inset:0;animation:wk-spin 3.4s linear infinite}
|
|
.wk-dots i{position:absolute;left:50%;top:-2px;width:5px;height:5px;margin-left:-2.5px;border-radius:50%;
|
|
background:#8B7CF6;box-shadow:0 0 8px #8B7CF6;animation:wk-dot 1.4s ease-in-out infinite}
|
|
.wk-dots i:nth-child(2){top:auto;bottom:-2px;animation-delay:.35s;background:#534AB7;box-shadow:0 0 8px #534AB7}
|
|
.wk-dots i:nth-child(3){left:-2px;top:50%;margin:-2.5px 0 0 0;animation-delay:.7s;background:#4FBFA8;box-shadow:0 0 8px #4FBFA8}
|
|
@keyframes wk-spin{to{transform:rotate(360deg)}}
|
|
@keyframes wk-spin-rev{to{transform:rotate(-360deg)}}
|
|
@keyframes wk-core{0%,100%{transform:scale(.82);opacity:.6}50%{transform:scale(1.12);opacity:1}}
|
|
@keyframes wk-halo{0%,100%{opacity:.45;transform:scale(.96)}50%{opacity:.9;transform:scale(1.04)}}
|
|
@keyframes wk-dot{0%,100%{opacity:.25}50%{opacity:1}}
|
|
@keyframes wkb{0%{margin-left:-40%}100%{margin-left:100%}}
|
|
.wk-bar{height:4px;border-radius:999px;background:rgba(127,127,127,.18);overflow:hidden;margin:16px 0 8px}
|
|
.wk-bar > i{display:block;height:100%;width:40%;border-radius:999px;
|
|
background:linear-gradient(90deg, rgba(83,74,183,0), #534AB7 45%, #8B7CF6 70%, rgba(83,74,183,0));
|
|
animation:wkb 1.6s ease-in-out infinite}
|
|
.wk-label{font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.16em;
|
|
color:#8a8f98;text-transform:uppercase;margin-bottom:10px}
|
|
.wk-step{font-size:13px;color:#8a8f98;min-height:20px;text-align:center}
|
|
.wk-acts{margin-top:16px;text-align:center}
|
|
.wk-note{margin-top:14px;font-size:12px;line-height:1.7;color:#8a8f98;text-align:center}
|
|
@media (prefers-reduced-motion: reduce){
|
|
.wk-arc,.wk-arc2,.wk-dots,.wk-dots i,.wk-core,.wk-halo,.wk-bar > i{animation:none!important}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div style="min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px">
|
|
<div class="card" style="max-width:420px;width:100%;text-align:center">
|
|
<div class="wk-orb" id="spin">
|
|
<div class="wk-halo"></div><div class="wk-arc"></div><div class="wk-arc2"></div>
|
|
<div class="wk-ring"></div><div class="wk-core"></div>
|
|
<div class="wk-dots"><i></i><i></i><i></i></div>
|
|
</div>
|
|
<h1 class="page-title" style="margin-bottom:6px" data-i18n="wake.h1">Starting your workspace…</h1>
|
|
<p class="page-sub" style="margin-bottom:0" data-i18n="wake.sub">Idle instances get reclaimed; the first visit takes a few seconds to spin it back up.</p>
|
|
<div class="wk-bar"><i></i></div>
|
|
<div class="wk-step" id="step" data-i18n="wake.connecting">Connecting…</div>
|
|
<div class="wk-label">dsh · auto recovery</div>
|
|
<div class="wk-acts" id="acts" style="display:none">
|
|
<button class="btn primary" id="retry" data-i18n="common.retry">Retry</button>
|
|
</div>
|
|
<p class="wk-note" id="note" data-i18n="wake.note">
|
|
If nothing happens for a while, click “Retry”. This page redirects automatically — no manual refresh needed.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
var NEXT = new URLSearchParams(location.search).get('next') || ''
|
|
var step = document.getElementById('step')
|
|
var acts = document.getElementById('acts')
|
|
var note = document.getElementById('note')
|
|
var tried = 0
|
|
var MAX = 3
|
|
|
|
function show(text) { step.textContent = text }
|
|
|
|
function fail(msg) {
|
|
document.getElementById('spin').style.display = 'none'
|
|
acts.style.display = 'block'
|
|
note.textContent = msg
|
|
show(I18N.t('wake.failed'))
|
|
}
|
|
|
|
// 只允许跳回 *.ai1net.com,避免被 next 参数带偏
|
|
function safeNext(u) {
|
|
try { var x = new URL(u, location.href); return /(^|\.)ai1net\.com$/.test(x.hostname) ? x.href : '' } catch (e) { return '' }
|
|
}
|
|
|
|
async function wake() {
|
|
tried += 1
|
|
show(tried === 1 ? I18N.t('wake.launching') : I18N.t('wake.retrying', { n: tried }))
|
|
try {
|
|
// 复用平台已有的登录直达接口:它内部会 launch(实例不在则拉起)并返回带 token 的直达 URL
|
|
var res = await fetch('/api/dsh/enter', {
|
|
method: 'POST',
|
|
headers: { 'content-type': 'application/json' },
|
|
body: JSON.stringify({}),
|
|
})
|
|
if (res.status === 401) { location.replace('/login.html'); return }
|
|
var j = await res.json().catch(function () { return {} })
|
|
var url = j.url || j.redirect || ''
|
|
if (res.ok && url) {
|
|
show(I18N.t('wake.ready'))
|
|
location.replace(url)
|
|
return
|
|
}
|
|
if (res.ok && !url) { // 已登录但需要重走门户
|
|
location.replace('/portal.html')
|
|
return
|
|
}
|
|
if (j.error === 'instance_circuit_open') { // 档案 78:被熔断冷却,重试没有意义
|
|
var waitMin = Math.max(1, Math.ceil((j.retryAfterMs || 0) / 60000))
|
|
fail(I18N.t('wake.circuit', { min: waitMin }))
|
|
return
|
|
}
|
|
throw new Error(j.error || ('HTTP ' + res.status))
|
|
} catch (err) {
|
|
if (tried < MAX) {
|
|
show(I18N.t('wake.notReady'))
|
|
setTimeout(wake, 2000)
|
|
} else {
|
|
fail(I18N.t('wake.giveUp', { msg: (err && err.message ? err.message : I18N.t('wake.unknownErr')) }))
|
|
}
|
|
}
|
|
}
|
|
|
|
document.getElementById('retry').addEventListener('click', function () {
|
|
tried = 0
|
|
document.getElementById('spin').style.display = ''
|
|
acts.style.display = 'none'
|
|
note.textContent = I18N.t('wake.noteShort')
|
|
wake()
|
|
})
|
|
|
|
// 若 nginx 带了 next(原始目标地址),唤醒后优先回那里
|
|
var saved = safeNext(NEXT)
|
|
if (saved) { sessionStorage.setItem('dsh.wake.next', saved) }
|
|
|
|
var t = setInterval(function () {
|
|
var n = sessionStorage.getItem('dsh.wake.next')
|
|
if (n && n !== NEXT) {
|
|
clearInterval(t)
|
|
// 直接以原始目标为跳转终点(进入后再由实例侧校验 token)
|
|
NEXT = n
|
|
}
|
|
}, 1000)
|
|
setTimeout(function () { clearInterval(t) }, 30000)
|
|
|
|
wake()
|
|
})()
|
|
</script>
|
|
</body>
|
|
</html>
|