fix: complete audit security and frontend gaps

This commit is contained in:
2026-07-18 18:02:29 +08:00
parent 79feb20688
commit b7a84d31ea
28 changed files with 576 additions and 88 deletions

View File

@@ -26,3 +26,12 @@ func RequireUser(tokenVerifier func(string) (uint, error)) gin.HandlerFunc {
c.Next()
}
}
func CurrentUserID(c *gin.Context) (uint, bool) {
value, ok := c.Get(CurrentUserIDKey)
if !ok {
return 0, false
}
userID, ok := value.(uint)
return userID, ok && userID > 0
}