Files
HomeDash/portal/500.html
HomeDash Bot 994d93cc98 feat(gateway): 一体化统一入口——路由与 Dashy 导航同一份数据、内置登录、原自定义错误页
目标:一个 HomeDash 容器取代 navi + portal-nginx + portal-auth。

- Route 扩展为"反代 + 导航"一条记录:kind(proxy/portal/auth)、streaming、
  insecureTls、bypassPaths、injectBeian,以及 navEnabled/navSection/navName/
  navDescription/navUrl/navIcon/navAutoIcon
- 保存路由时**同时**写 gateway.yml 与 conf.yml 的导航项(gateway_nav.go):
  同 host 接管而不是重复、未勾选导航的会被清理、无关手工项与系统「历史访问」分组
  一律不动;两步任一步失败都回滚(避免后台显示与导航页各说各话)
- 未知域名与上游故障改用**内置自定义 404/500 页面**(portal/ 目录),
  不再是一行纯文本;HTTP→HTTPS 跳转段用 RedirectPort 复刻原 3081 设计
- 内置统一登录(auth.go):HMAC 签名 cookie、恒定时间比较、登录跳转白名单校验,
  portal-auth 容器可以退场
- 自动抓图标对托管导航项同样生效(history-server 识别 naviGatewayAutoIcon)
- 后台卡片补齐"加入导航/分组/名称/描述/图标/自动抓图标/服务类型"字段
- 内部入口端口 8080 → 18080:为一体化 host 模式让开宿主机 blog(:8080)
- 修掉上一轮编辑写坏的 deploy/zd.sh 一行(会让脚本直接失败)

测试:新增自定义错误页、portal 类型、导航字段校验、导航同步(接管/清理/保留)、
分组不存在必须报错等用例;admin-server 与 history-server 全绿。
2026-09-11 21:27:40 +08:00

62 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>500 - JianF Git</title>
<link rel="stylesheet" href="/css/portal.css">
<script src="https://code.iconify.design/3/3.1.0/iconify.min.js"></script>
<script>(function(){var s=localStorage.getItem('theme');var p=window.matchMedia('(prefers-color-scheme:dark)').matches;var t=s||(p?'dark':'light');document.documentElement.setAttribute('data-theme',t);})();function toggleTheme(){var n=document.documentElement.getAttribute('data-theme')==='dark'?'light':'dark';document.documentElement.setAttribute('data-theme',n);localStorage.setItem('theme',n)}</script>
<style>
.error-page {
display:flex;
align-items:center;
justify-content:center;
min-height:100vh;
text-align:center;
padding:20px;
}
.error-page .card {
padding:48px 40px;
max-width:420px;
width:100%;
}
.error-icon {
width:64px;
height:64px;
border-radius:16px;
background:var(--danger-bg);
color:var(--danger);
display:flex;
align-items:center;
justify-content:center;
margin:0 auto 20px;
}
.error-icon svg { width:32px; height:32px }
.error-page h1 { font-size:3rem; font-weight:800; margin-bottom:4px; color:var(--text-primary) }
.error-page p { color:var(--text-secondary); margin-bottom:28px; font-size:14px }
</style>
</head>
<body>
<div class="error-page">
<div class="card">
<div class="error-icon"><span class="iconify" data-icon="mdi:alert-circle-outline"></span></div>
<h1>500</h1>
<p>服务器内部错误,请稍后重试或联系管理员</p>
<a href="/" class="btn btn-primary">
<span class="iconify" data-icon="mdi:home"></span>
返回首页
</a>
<a href="https://dashy.example.com" class="btn btn-ghost">
<span class="iconify" data-icon="mdi:view-dashboard"></span>
门户导航
</a>
<button class="btn btn-ghost" onclick="toggleTheme()" style="margin-top:12px">
<span class="iconify" data-icon="mdi:theme-light-dark"></span>
切换主题
</button>
</div>
</div>
</body>
</html>