fix: unable to load pic in chunk result (#16485)

### Summary

As title:
This commit is contained in:
Haruko386
2026-07-02 16:05:49 +08:00
committed by GitHub
parent 3a5bc1371a
commit 9c8d8c7b83
5 changed files with 47 additions and 12 deletions

View File

@@ -98,6 +98,7 @@ func (h *UserHandler) Register(c *gin.Context) {
}
c.Header("Authorization", authToken)
setOAuthAuthCookie(c, authToken)
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "*")
c.Header("Access-Control-Allow-Headers", "*")
@@ -163,6 +164,7 @@ func (h *UserHandler) Login(c *gin.Context) {
// Set Authorization header with signed token
c.Header("Authorization", authToken)
setOAuthAuthCookie(c, authToken)
// Set CORS headers
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "*")
@@ -235,7 +237,7 @@ func (h *UserHandler) LoginByEmail(c *gin.Context) {
})
return
}
setOAuthAuthCookie(c, authToken)
c.Header("Authorization", authToken)
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "*")
@@ -341,6 +343,16 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
// @Success 200 {object} map[string]interface{}
// @Router /v1/user/logout [post]
func (h *UserHandler) Logout(c *gin.Context) {
http.SetCookie(c.Writer, &http.Cookie{
Name: oauthAuthCookie,
Value: "",
Path: "/",
MaxAge: -1,
HttpOnly: false,
SameSite: http.SameSiteLaxMode,
Secure: c.Request.TLS != nil,
})
// Same as AuthMiddleware@auth.go
token := c.GetHeader("Authorization")
if token == "" {