feat: add Docker deployment and Microsoft OAuth support

This commit is contained in:
2026-04-18 14:02:24 +08:00
parent 6704cfb418
commit e69c0dd226
53 changed files with 5139 additions and 4029 deletions

View File

@@ -1,27 +1,27 @@
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
"mengpost-backend/config"
)
// VerifyToken 供前端 token 弹窗使用: 仅返回 token 是否正确.
func VerifyToken(cfg *config.Config) gin.HandlerFunc {
return func(c *gin.Context) {
var body struct {
Token string `json:"token"`
}
if err := c.ShouldBindJSON(&body); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body"})
return
}
if body.Token != cfg.Token {
c.JSON(http.StatusUnauthorized, gin.H{"ok": false})
return
}
c.JSON(http.StatusOK, gin.H{"ok": true})
}
}
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
"mengpost-backend/config"
)
// VerifyToken 供前端 token 弹窗使用: 仅返回 token 是否正确.
func VerifyToken(cfg *config.Config) gin.HandlerFunc {
return func(c *gin.Context) {
var body struct {
Token string `json:"token"`
}
if err := c.ShouldBindJSON(&body); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body"})
return
}
if body.Token != cfg.Token {
c.JSON(http.StatusUnauthorized, gin.H{"ok": false})
return
}
c.JSON(http.StatusOK, gin.H{"ok": true})
}
}