From cbb3c1f9545bd022a6cd0cdef2ad37951830cedc Mon Sep 17 00:00:00 2001 From: Naida Vatric Date: Fri, 14 Feb 2020 22:27:41 +0100 Subject: [PATCH] Signed URL change. --- app/views/publishPhotos.ejs | 12 ++++++++++-- index.js | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/views/publishPhotos.ejs b/app/views/publishPhotos.ejs index 5acef77..39d956c 100644 --- a/app/views/publishPhotos.ejs +++ b/app/views/publishPhotos.ejs @@ -61,12 +61,20 @@ var c = ""; console.log("RADIL" + file); fetch(url, { method: 'PUT', + headers: { + "content-type": "image/png" + }, + mode: 'cors', body: file }) .then(response => response.text()) - .then (console.log()) + .then (response => { + console.log(response); + return response; + } + ) .catch(error => $("#status").html(error) ) - .then(response => $("#status").html('File uploaded successfully: ' + filename)); + .then(response => $("#status").html('File uploaded successfully: ' + filename + response.text())); } \ No newline at end of file diff --git a/index.js b/index.js index 7742726..f83e728 100644 --- a/index.js +++ b/index.js @@ -79,7 +79,10 @@ app.get("/generateSignedURL", (req, res) => { console.log("Started server function!"); const options = { - version: "v2", + GoogleAccessID: + " kivi-original-photos-id@marketalarm.iam.gserviceaccount.com", + PrivateKey: "dd909e0aeef15920e7fc18229ce421246c143f90", + version: "v4", action: "write", expires: Date.now() + 86400000 };