fix mj submit bug

This commit is contained in:
CaIon
2023-11-28 23:15:17 +08:00
parent 10ca1e6146
commit 7ffc2e34a6
3 changed files with 4 additions and 4 deletions

View File

@@ -86,14 +86,14 @@ func TokenAuth() func(c *gin.Context) {
return func(c *gin.Context) {
key := c.Request.Header.Get("Authorization")
parts := make([]string, 0)
if key == "" {
key = strings.TrimPrefix(key, "Bearer ")
if key == "" || key == "midjourney-proxy" {
key = c.Request.Header.Get("mj-api-secret")
key = strings.TrimPrefix(key, "Bearer ")
key = strings.TrimPrefix(key, "sk-")
parts := strings.Split(key, "-")
key = parts[0]
} else {
key = strings.TrimPrefix(key, "Bearer ")
key = strings.TrimPrefix(key, "sk-")
parts := strings.Split(key, "-")
key = parts[0]