Another
This commit is contained in:
parent
45d7adbd8b
commit
d5d985d682
BIN
cmd/imagini.db
BIN
cmd/imagini.db
Binary file not shown.
@ -192,7 +192,7 @@ func deriveRequestedDevice(r *http.Request) models.Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Derive Value
|
// Derive Value
|
||||||
val := trimQuotes(strings.ToLower(strings.TrimSpace(splitItem[1])))
|
val := trimQuotes(strings.TrimSpace(splitItem[1]))
|
||||||
if key == "deviceuuid" {
|
if key == "deviceuuid" {
|
||||||
parsedDeviceUUID, err := uuid.Parse(val)
|
parsedDeviceUUID, err := uuid.Parse(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -5,5 +5,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (api *API) mediaItemsHandler(w http.ResponseWriter, r *http.Request) {
|
func (api *API) mediaItemsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method == http.MethodPost {
|
||||||
|
// CREATE
|
||||||
|
} else if r.Method == http.MethodPut {
|
||||||
|
// UPDATE / REPLACE
|
||||||
|
} else if r.Method == http.MethodPatch {
|
||||||
|
// UPDATE / MODIFY
|
||||||
|
} else if r.Method == http.MethodDelete {
|
||||||
|
// DELETE
|
||||||
|
} else if r.Method == http.MethodGet {
|
||||||
|
// GET
|
||||||
|
} else {
|
||||||
|
errorJSON(w, "Method is not supported.", http.StatusMethodNotAllowed)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (api *API) createMediaitem() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
|
"net/http"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,9 +30,16 @@ func (api *API) authMiddleware(next http.Handler) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate JWT Tokens
|
// Validate JWT Tokens
|
||||||
|
// accessToken, accessOK := api.Auth.ValidateJWTAccessToken(accessCookie.Value)
|
||||||
_, accessOK := api.Auth.ValidateJWTAccessToken(accessCookie.Value)
|
_, accessOK := api.Auth.ValidateJWTAccessToken(accessCookie.Value)
|
||||||
|
|
||||||
if accessOK {
|
if accessOK {
|
||||||
|
// Acquire UserID and DeviceID
|
||||||
|
// uid, _ := accessToken.Get("sub")
|
||||||
|
// did, _ := accessToken.Get("did")
|
||||||
|
|
||||||
|
// Set context uid & did
|
||||||
|
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
} else {
|
} else {
|
||||||
w.WriteHeader(http.StatusUnauthorized)
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
package db
|
@ -0,0 +1 @@
|
|||||||
|
package db
|
Reference in New Issue
Block a user