fixed viewing invisible releases with admin session

This commit is contained in:
ari melody 2025-01-27 00:27:03 +00:00
parent 1efe52a8cb
commit 70825ae875
Signed by: ari
GPG key ID: CF99829C92678188
5 changed files with 46 additions and 36 deletions

View file

@ -2,7 +2,6 @@ package controller
import (
"arimelody-web/model"
"net/http"
"strings"
"github.com/jmoiron/sqlx"
@ -77,19 +76,6 @@ func GetAccountBySession(db *sqlx.DB, sessionToken string) (*model.Account, erro
return &account, nil
}
func GetSessionFromRequest(db *sqlx.DB, r *http.Request) string {
tokenStr := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ")
if len(tokenStr) > 0 {
return tokenStr
}
cookie, err := r.Cookie(model.COOKIE_TOKEN)
if err != nil {
return ""
}
return cookie.Value
}
func CreateAccount(db *sqlx.DB, account *model.Account) error {
err := db.Get(
&account.ID,