Deploy blocks until old dies, fix cors via rproxy3, and who accepts acceptable name

master
Bel LaPointe 2020-07-23 23:04:50 -06:00
parent 599d52cf8d
commit 461592ec40
3 changed files with 11 additions and 3 deletions

View File

@ -3,8 +3,10 @@
function main() { function main() {
cd "$(dirname "$BASH_SOURCE")" cd "$(dirname "$BASH_SOURCE")"
set -e set -e
go test ./...
GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo 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 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 if [ "$0" == "$BASH_SOURCE" ]; then

View File

@ -49,7 +49,13 @@ func jsonHandler(g storage.Graph) http.Handler {
} }
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 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) { if gziphttp.Can(r) {
gz := gziphttp.New(w) gz := gziphttp.New(w)
defer gz.Close() defer gz.Close()

View File

@ -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 { if err := json.Unmarshal(body, &operation); err != nil {
return err return err
} }
if operation.Name != "" { if operation.Name != "" && operation.Name != id {
http.Error(w, `{"error":"cannot specify name in request body"}`, http.StatusBadRequest) http.Error(w, `{"error":"names differ between URL and request body"}`, http.StatusBadRequest)
return nil return nil
} }
if operation.Modified != 0 { if operation.Modified != 0 {