初始化项目:基础设施 + 用户认证 + 后台管理系统 + AGPL 3.0 许可

This commit is contained in:
2026-05-26 13:46:33 +08:00
parent 1315df6501
commit 483fdd919f
56 changed files with 5804 additions and 40 deletions

View File

@ -0,0 +1,48 @@
{{template "layout/header.html" .}}
<body>
{{template "layout/nav.html" .}}
<main class="auth-page">
<div class="auth-card">
<h2>登录 MetaLab</h2>
<p class="auth-subtitle">回到开发者社区</p>
<form id="loginForm" novalidate>
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<div class="form-group">
<label for="email">邮箱地址</label>
<input type="email" id="email" placeholder="your@email.com" required>
<span class="form-error" id="emailError">请输入有效的邮箱地址</span>
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" id="password" placeholder="输入密码" required>
<span class="form-error" id="passwordError">请输入密码</span>
</div>
<div class="form-group remember-group">
<label class="remember-label">
<input type="checkbox" id="rememberMe">
保持登录 30 天
</label>
<span class="remember-hint">非共享设备推荐</span>
</div>
<button type="submit" class="submit-btn" id="submitBtn">登 录</button>
</form>
<div class="auth-footer">
还没有账号?<a href="/auth/register">立即注册</a>
</div>
</div>
</main>
<div class="toast" id="toast"></div>
{{template "layout/footer.html" .}}
<button class="scroll-top-btn" id="scrollTopBtn">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="5 12 12 5 19 12"/></svg>
</button>
<script src="/static/js/common.js"></script>
<script src="/static/js/login.js"></script>
</body>
</html>

View File

@ -0,0 +1,80 @@
{{template "layout/header.html" .}}
<body>
{{template "layout/nav.html" .}}
<main class="auth-page">
<div class="auth-card">
<h2>创建账号</h2>
<p class="auth-subtitle">加入 MetaLab 开发者社区</p>
<form id="registerForm" novalidate>
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<div class="form-group">
<label for="email">邮箱地址</label>
<input type="email" id="email" placeholder="your@email.com" required>
<span class="form-error" id="emailError">请输入有效的邮箱地址</span>
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" id="password" placeholder="至少 8 位,包含字母与数字" required minlength="8">
<span class="form-error" id="passwordError">密码至少 8 位,需包含字母与数字</span>
</div>
<div class="form-group">
<label for="confirmPassword">确认密码</label>
<input type="password" id="confirmPassword" placeholder="请再次输入密码" required>
<span class="form-error" id="confirmPasswordError">两次输入的密码不一致</span>
</div>
<div class="form-group remember-group">
<label class="remember-label">
<input type="checkbox" id="rememberMe">
保持登录 30 天
</label>
<span class="remember-hint">非共享设备推荐</span>
</div>
<p class="guidelines-link">点击注册即表示同意 <a href="javascript:void(0)" id="openGuidelines">《MetaLab 社区用户准则》</a></p>
<button type="submit" class="submit-btn" id="submitBtn">注 册</button>
</form>
<div class="auth-footer">
已有账号?<a href="/auth/login">立即登录</a>
</div>
</div>
</main>
<!-- 社区准则模态框 -->
<div class="modal-overlay" id="modalOverlay">
<div class="modal">
<div class="modal-header">
<h3>MetaLab 社区用户准则</h3>
<button class="modal-close" id="modalClose">&times;</button>
</div>
<div class="modal-body" id="modalBody">
{{.Guidelines}}
</div>
<div class="modal-footer">
<div id="modalEnforce">
<div class="timer" id="timer">
<span id="timerLabel">剩余阅读时间</span>
<span class="count" id="timerCount">60</span>
<span id="timerUnit"></span>
<span id="timerDone" style="display:none">✓ 阅读时间已满足</span>
</div>
<span class="scroll-hint" id="scrollHint">▼ 请滚动至底部完成阅读</span>
</div>
<button class="confirm-btn" id="confirmBtn" disabled>我已完整阅读并同意</button>
<button class="confirm-btn" id="previewCloseBtn" style="display:none">关 闭</button>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
{{template "layout/footer.html" .}}
<button class="scroll-top-btn" id="scrollTopBtn">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="5 12 12 5 19 12"/></svg>
</button>
<script src="/static/js/common.js"></script>
<script src="/static/js/register.js"></script>
</body>
</html>

View File

@ -0,0 +1,22 @@
{{template "layout/header.html" .}}
<body>
{{template "layout/nav.html" .}}
<main class="hero">
<div class="container">
<h1>Meta<span>Lab</span></h1>
<p class="hero-tagline">下一代开发者社区</p>
{{if .IsLoggedIn}}
<p class="hero-desc">欢迎回来,{{.Username}}</p>
{{else}}
<p class="hero-desc">一个为构建者准备的纯粹空间</p>
{{end}}
</div>
</main>
{{template "layout/footer.html" .}}
<script src="/static/js/common.js"></script>
</body>
</html>

View File

@ -0,0 +1,5 @@
<footer>
<div class="container footer-content">
<p class="copyright">&copy; 2024-2026 MetaLab | Framework: MetaZone</p>
</div>
</footer>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{if .CSRFToken}}<meta name="csrf-token" content="{{.CSRFToken}}">{{end}}
<title>{{.Title}} - MetaLab</title>
<link rel="stylesheet" href="/static/css/common.css">
{{if .ExtraCSS}}
<link rel="stylesheet" href="{{.ExtraCSS}}">
{{end}}
</head>

View File

@ -0,0 +1,17 @@
<header>
<div class="container nav-container">
<a href="/" class="logo">Meta<span>Lab</span></a>
<button class="mobile-menu-btn" id="mobileMenuBtn">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<ul class="nav-links" id="navLinks">
<li><a href="/">首页</a></li>
{{if .IsLoggedIn}}
<li><a href="/settings" class="nav-user">{{.Username}}</a></li>
<li><a href="javascript:void(0)" class="nav-logout" id="logoutBtn">退出</a></li>
{{else}}
<li><a href="/auth/login" class="nav-login">登录</a></li>
{{end}}
</ul>
</div>
</header>