diff --git a/deploy.sh b/deploy.sh index de39cba..a4575ae 100644 --- a/deploy.sh +++ b/deploy.sh @@ -3,8 +3,10 @@ function main() { cd "$(dirname "$BASH_SOURCE")" set -e + go test ./... GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo scp ./dndex zach@192.168.1.123:./dndex/dndex.new + ssh zach@192.168.1.123 bash -c 'true; while [ -e ./dndex/dndex.new ]; do printf "."; sleep 3; done; echo' } if [ "$0" == "$BASH_SOURCE" ]; then diff --git a/view/json.go b/view/json.go index cc562cf..3e533c5 100644 --- a/view/json.go +++ b/view/json.go @@ -49,7 +49,13 @@ func jsonHandler(g storage.Graph) http.Handler { } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Access-Control-Allow-Origin", "*") + /* + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Content-Type", "application/json") + w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, OPTIONS, TRACE") + w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization") + */ + if gziphttp.Can(r) { gz := gziphttp.New(w) defer gz.Close() diff --git a/view/who.go b/view/who.go index f45b1e2..53b58bc 100644 --- a/view/who.go +++ b/view/who.go @@ -94,8 +94,8 @@ func whoPut(namespace string, g storage.Graph, w http.ResponseWriter, r *http.Re if err := json.Unmarshal(body, &operation); err != nil { return err } - if operation.Name != "" { - http.Error(w, `{"error":"cannot specify name in request body"}`, http.StatusBadRequest) + if operation.Name != "" && operation.Name != id { + http.Error(w, `{"error":"names differ between URL and request body"}`, http.StatusBadRequest) return nil } if operation.Modified != 0 {