diff --git a/cmd/imagini.db b/cmd/imagini.db deleted file mode 100644 index 9320e9a..0000000 Binary files a/cmd/imagini.db and /dev/null differ diff --git a/cmd/main b/cmd/main new file mode 100755 index 0000000..52b922c Binary files /dev/null and b/cmd/main differ diff --git a/internal/api/auth.go b/internal/api/auth.go index dcde5b7..a4e4972 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -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 { diff --git a/internal/api/media_items.go b/internal/api/media_items.go index 09858f5..bbbc8a2 100644 --- a/internal/api/media_items.go +++ b/internal/api/media_items.go @@ -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() { } diff --git a/internal/api/middlewares.go b/internal/api/middlewares.go index 41f3847..143adc4 100644 --- a/internal/api/middlewares.go +++ b/internal/api/middlewares.go @@ -1,9 +1,8 @@ package api import ( - "net/http" "os" - + "net/http" log "github.com/sirupsen/logrus" ) @@ -31,14 +30,21 @@ 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) } - }) + }) } func (api *API) logMiddleware(h http.Handler) http.Handler { diff --git a/internal/db/albums.go b/internal/db/albums.go index e69de29..3a49c63 100644 --- a/internal/db/albums.go +++ b/internal/db/albums.go @@ -0,0 +1 @@ +package db diff --git a/internal/db/tags.go b/internal/db/tags.go index e69de29..3a49c63 100644 --- a/internal/db/tags.go +++ b/internal/db/tags.go @@ -0,0 +1 @@ +package db