From e2e411d40c736c4e56ac4bd195f6bc4faebd19d8 Mon Sep 17 00:00:00 2001 From: frikky Date: Mon, 23 Nov 2020 13:36:26 +0100 Subject: [PATCH] #141: Basic file options added --- .env | 2 ++ backend/Dockerfile | 1 + backend/app_sdk/app_base.py | 1 - backend/app_sdk/build.sh | 2 +- backend/go-app/main.go | 24 +----------------------- backend/go-app/walkoff.go | 2 +- docker-compose.yml | 8 +++++--- 7 files changed, 11 insertions(+), 29 deletions(-) diff --git a/.env b/.env index 93b05920..a43c6669 100644 --- a/.env +++ b/.env @@ -19,7 +19,9 @@ SHUFFLE_DEFAULT_PASSWORD= SHUFFLE_DEFAULT_APIKEY= # Local location of your app directory. Can't use ~/ +# Files will get better at some point. Right now: local saving. SHUFFLE_APP_HOTLOAD_LOCATION=./shuffle-apps +SHUFFLE_FILE_LOCATION=./shuffle-files # Other configs BACKEND_HOSTNAME=shuffle-backend diff --git a/backend/Dockerfile b/backend/Dockerfile index 21422785..1856d84f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -8,6 +8,7 @@ ADD ./go-app/main.go /app ADD ./go-app/walkoff.go /app ADD ./go-app/docker.go /app ADD ./go-app/codegen.go /app +ADD ./go-app/files.go /app ADD ./go-app/go.mod /app diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 4d9579b1..ca5039cb 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -894,7 +894,6 @@ class AppBase: continue new_headers = { - "Content-Type": "multipart/form-data; charset=utf-8; boundary=\"test boundary Shuffle\"", "Authorization": "Bearer %s" % self.authorization, } diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index 6c28cc03..4dbf2574 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -1,6 +1,6 @@ #!/bin/bash NAME=shuffle-app_sdk -VERSION=0.8.0 +VERSION=0.8.1 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION diff --git a/backend/go-app/main.go b/backend/go-app/main.go index f93ef351..796e9ea7 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -2577,28 +2577,6 @@ func getSession(ctx context.Context, thissession string) (*session, error) { return curUser, nil } -// ListBooks returns a list of books, ordered by title. -func getFile(ctx context.Context, id string) (*File, error) { - key := datastore.NameKey("Files", id, nil) - curFile := &File{} - if err := dbclient.Get(ctx, key, curFile); err != nil { - return &File{}, err - } - - return curFile, nil -} - -func setFile(ctx context.Context, file File) error { - // clear session_token and API_token for user - k := datastore.NameKey("Files", file.Id, nil) - if _, err := dbclient.Put(ctx, k, &file); err != nil { - log.Println(err) - return err - } - - return nil -} - // ListBooks returns a list of books, ordered by title. func getOrg(ctx context.Context, id string) (*Org, error) { key := datastore.NameKey("Organizations", id, nil) @@ -8067,10 +8045,10 @@ func initHandlers() { // https://developer.box.com/reference/get-files-id-content/ // 1. Creating the "get file" option. Make it possible to run this in the frontend. r.HandleFunc("/api/v1/files/{fileId}/content", handleGetFileContent).Methods("GET", "OPTIONS") + r.HandleFunc("/api/v1/files/{fileId}", handleDeleteFile).Methods("DELETE", "OPTIONS") r.HandleFunc("/api/v1/files/create", handleCreateFile).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/files/{fileId}/upload", handleUploadFile).Methods("POST", "OPTIONS") //r.HandleFunc("/api/v1/files/{fileId}", handleGetFile).Methods("GET", "OPTIONS") - //r.HandleFunc("/api/v1/files/{fileId}", handleGetFile).Methods("DELETE", "OPTIONS") http.Handle("/", r) } diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 262981fd..011db663 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -1830,7 +1830,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { for _, action := range workflow.Actions { allNodes = append(allNodes, action.ID) - if len(action.Errors) > 0 { + if len(action.Errors) > 0 || !action.IsValid { action.IsValid = true action.Errors = []string{} } diff --git a/docker-compose.yml b/docker-compose.yml index 05d3e546..855a06b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: '3' services: frontend: - #build: ./frontend - image: ghcr.io/frikky/shuffle-frontend:0.8.0 + build: ./frontend + image: ghcr.io/frikky/shuffle-frontend:0.8.1 container_name: shuffle-frontend hostname: shuffle-frontend ports: @@ -17,7 +17,7 @@ services: - backend backend: #build: ./backend - image: ghcr.io/frikky/shuffle-backend:0.8.0 + image: ghcr.io/frikky/shuffle-backend:0.8.1 container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} # Here for debugging: @@ -28,9 +28,11 @@ services: volumes: - /var/run/docker.sock:/var/run/docker.sock - ${SHUFFLE_APP_HOTLOAD_LOCATION}:/shuffle-apps + - ${SHUFFLE_FILE_LOCATION}:/shuffle-files environment: - DATASTORE_EMULATOR_HOST=shuffle-database:8000 - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps + - SHUFFLE_FILE_LOCATION=/shuffle-files - ORG_ID=${ORG_ID} - SHUFFLE_APP_DOWNLOAD_LOCATION=${SHUFFLE_APP_DOWNLOAD_LOCATION} - SHUFFLE_DEFAULT_USERNAME=${SHUFFLE_DEFAULT_USERNAME}