- 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>
20 lines
394 B
Go
20 lines
394 B
Go
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)
|
|
}
|
|
}
|