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:
2026-05-28 13:54:07 +08:00
commit c16a8dfbc4
42 changed files with 5295 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
sequenceDiagram
participant U as 用户浏览器
participant G as Gin Router
participant H as HomeHandler
participant CM as CardModel
participant SM as SettingModel
participant T as html/template
U->>G: GET /
G->>H: HomeHandler(c)
H->>CM: GetEnabledCards()
CM->>CM: SELECT * FROM cards WHERE enabled=1 ORDER BY sort
CM-->>H: []Card
H->>SM: GetSetting("search_engine")
SM->>SM: SELECT value FROM settings WHERE key='search_engine'
SM-->>H: search URL template
H->>T: ExecuteTemplate("home.html", data)
T-->>U: HTML (搜索框 + 卡片网格)