905086
2026-11-08 6cc9b12b81d184bb2df9dc68f93ca45c3d47d229
server/main.go
@@ -1,6 +1,7 @@
package main
import (
   "net/http"
   "os"
   "path/filepath"
@@ -39,8 +40,9 @@
      api.GET("/games", handlers.GetGames)
      api.GET("/banners", handlers.GetBanners)
      api.GET("/tools", handlers.GetTools)
      api.GET("/tools/:id/download", handlers.ToolDownloadInfo)
      api.GET("/announcements", handlers.GetAnnouncements)
      api.GET("/games/:id", handlers.GetGameDetail) // 支持可选登录
      api.GET("/games/:id", middleware.OptionalUserAuth(), handlers.GetGameDetail) // 支持可选登录:登录后返回收藏/资源库状态
      auth := api.Group("", middleware.UserAuth())
      {
@@ -55,6 +57,14 @@
      }
   }
   // ---------- 游戏目录展示页(公开,仅浏览不可下载) ----------
   r.GET("/showcase", func(c *gin.Context) {
      c.File("./showcase/index.html")
   })
   r.GET("/", func(c *gin.Context) {
      c.Redirect(http.StatusFound, "/showcase")
   })
   // ---------- 管理后台 ----------
   r.GET("/admin", func(c *gin.Context) {
      c.File("./admin/index.html")
@@ -88,6 +98,11 @@
         a.POST("/announcement", handlers.AdminSaveAnnouncement)
         a.POST("/upload", handlers.UploadFile)
         // 密码重置申请管理
         a.GET("/reset_requests", handlers.ListResetRequests)
         a.POST("/reset_requests/:id/approve", handlers.ApproveResetRequest)
         a.DELETE("/reset_requests/:id", handlers.DeleteResetRequest)
      }
   }