feat(api): require bearer authentication and unify response contracts
This commit is contained in:
1 parent
30e361cd10
commit
1b2b2b12ff
19 files changed
+1799
-314
No files matched your search
@@ -2,7 +2,6 @@ package api
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -33,9 +32,7 @@ type maintenanceUpload struct {
|
||||
}
|
||||
|
||||
func uploadOwner(r *http.Request) string {
|
||||
cookie, _ := r.Cookie(cookieName)
|
||||
sum := sha256.Sum256([]byte(cookie.Value))
|
||||
return hex.EncodeToString(sum[:])
|
||||
return identity(r).SessionHash
|
||||
}
|
||||
func (s *Server) readUpload(r *http.Request, id string) (maintenanceUpload, string, error) {
|
||||
var meta maintenanceUpload
|
||||
|
||||
Reference in new issue
Block a user