This commit is contained in:
Evan Reichard 2021-01-19 16:26:10 -05:00
parent 45d7adbd8b
commit d5d985d682
7 changed files with 29 additions and 4 deletions

Binary file not shown.

BIN
cmd/main Executable file

Binary file not shown.

View File

@ -192,7 +192,7 @@ func deriveRequestedDevice(r *http.Request) models.Device {
}
// Derive Value
val := trimQuotes(strings.ToLower(strings.TrimSpace(splitItem[1])))
val := trimQuotes(strings.TrimSpace(splitItem[1]))
if key == "deviceuuid" {
parsedDeviceUUID, err := uuid.Parse(val)
if err != nil {

View File

@ -5,5 +5,22 @@ import (
)
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() {
}

View File

@ -1,9 +1,8 @@
package api
import (
"net/http"
"os"
"net/http"
log "github.com/sirupsen/logrus"
)
@ -31,9 +30,16 @@ func (api *API) authMiddleware(next http.Handler) http.HandlerFunc {
}
// Validate JWT Tokens
// accessToken, accessOK := api.Auth.ValidateJWTAccessToken(accessCookie.Value)
_, accessOK := api.Auth.ValidateJWTAccessToken(accessCookie.Value)
if accessOK {
// Acquire UserID and DeviceID
// uid, _ := accessToken.Get("sub")
// did, _ := accessToken.Get("did")
// Set context uid & did
next.ServeHTTP(w, r)
} else {
w.WriteHeader(http.StatusUnauthorized)

View File

@ -0,0 +1 @@
package db

View File

@ -0,0 +1 @@
package db