feat: 门户网站初始提交
- Go + Gin + html/template 服务端渲染 - 主页:Google 风格搜索框 + 导航卡片 - 后台:卡片 CRUD、搜索引擎配置、主页背景/标题配置 - 图片上传:支持 jpg/jpeg/png/gif,自动压缩,缩略图参数 ?thumb=1 - 安全:登录日志、修改密码、IP 自动封禁、IP 白名单 - 访问统计:主页访问/卡片点击/搜索追踪、实时流量、IP 统计 - SQLite 存储(modernc.org/sqlite,纯 Go) - 内存 Session + bcrypt 密码哈希
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{{define "home.html"}}
|
||||
{{template "header" .}}
|
||||
<div class="home-container{{if .BackgroundImage}} has-background{{end}}"{{if .BackgroundImage}} style="background-image: url('{{.BackgroundImage}}?thumb=1'); background-size: cover; background-position: center; background-attachment: fixed;"{{end}}>
|
||||
<header class="home-header">
|
||||
<h1 class="home-title">{{.SiteTitle}}</h1>
|
||||
{{if .SiteSubtitle}}<p class="site-subtitle">{{.SiteSubtitle}}</p>{{else}}<p class="home-subtitle">快速导航,一键直达</p>{{end}}
|
||||
</header>
|
||||
|
||||
<div class="search-box">
|
||||
<form id="search-form" action="/search" method="GET">
|
||||
<input type="text" id="search-input" name="q" class="search-input" placeholder="搜索..." autofocus>
|
||||
<button type="submit" class="search-btn">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card-grid">
|
||||
{{range .Cards}}
|
||||
<a href="/click/{{.ID}}" class="card-item" target="_blank" rel="noopener noreferrer">
|
||||
<div class="card-icon">{{if .Icon}}{{if hasPrefix .Icon "/uploads/"}}<img src="{{.Icon}}?thumb=1" alt="{{.Title}}" class="card-icon-img">{{else}}<span class="card-emoji">{{.Icon}}</span>{{end}}{{else}}<span class="card-emoji">🔗</span>{{end}}</div>
|
||||
<div class="card-content">
|
||||
<div class="card-title">{{.Title}}</div>
|
||||
{{if .Subtitle}}<div class="card-subtitle">{{.Subtitle}}</div>{{end}}
|
||||
</div>
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<footer class="home-footer">
|
||||
<a href="/admin/login">管理后台</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('search-input').focus();
|
||||
});
|
||||
</script>
|
||||
{{template "footer" .}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user