use themes

This commit is contained in:
张超
2025-04-01 17:59:10 +08:00
parent 5934ffd460
commit 577cd10161
13 changed files with 152 additions and 3 deletions

23
routers/router.go Normal file
View File

@@ -0,0 +1,23 @@
package routers // Add the package declaration at the top
import (
"net/http"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(r *gin.Engine) {
// Frontend routes (dynamic themes)
r.GET("/", handlers.Home)
r.GET("/post/:id", handlers.ShowPost)
// Admin panel
admin := r.Group("/admin", middleware.AuthRequired())
{
admin.GET("/themes", handlers.ListThemes)
admin.POST("/themes/switch", handlers.SwitchTheme)
}
// Static files for themes
r.StaticFS("/themes", http.Dir("web/themes"))
}