feat: initial blog engine with multi-language, profile, and role system

- Gin + GORM + Tailwind CSS blog engine
- OS-aware config (Linux /etc/blog_go/, Windows ./win/etc/blog_go/)
- SQLite by default, MySQL support via config
- Auto-migrate database + seed admin user on first run
- Session-based auth (login/logout)
- i18n: Chinese/English with auto-detect + manual switch
- Avatar dropdown nav with click-to-toggle menu
- Profile page: avatar upload, edit info, change password
- Role system: admin (full access) and author (profile only)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-21 01:49:04 +08:00
co-authored by Claude Opus 4.8
commit c82d4482d4
20 changed files with 1592 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
)
// AdminDashboard renders the protected admin dashboard.
func AdminDashboard() gin.HandlerFunc {
return func(c *gin.Context) {
tr := getTr(c)
username, _ := c.Get("username")
data := DefaultData(c)
data["Title"] = tr["dash_page_title"]
data["Username"] = username
c.HTML(http.StatusOK, "dashboard", data)
}
}