From 633b3e3bd90c4d41ae20a0cc7a1bd15e4793d06b Mon Sep 17 00:00:00 2001 From: moom0o <48740106+moom0o@users.noreply.github.com> Date: Wed, 5 Apr 2023 21:02:56 -0400 Subject: [PATCH] Update index.js --- index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 202ee71..0f58544 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ const port = config.port; const openWebBrowser = config.openWebBrowser; // Set to false if running as a server // Doesn't matter what Google account holds these keys. -const apiKey = config.apiKey; // Webmaster api key, must be gotten from Google photosphere api const clientId = config.clientId // Client ID from Google API page const clientSecret = config.clientSecret // Client Secret from Google API page @@ -49,7 +48,7 @@ app.post('/upload', function (req, res) { // Part 1: Get uploadUrl const options = { 'method': 'POST', - 'url': `https://streetviewpublish.googleapis.com/v1/photo:startUpload?key=${apiKey}`, + 'url': `https://streetviewpublish.googleapis.com/v1/photo:startUpload`, 'headers': { 'Authorization': `Bearer ${key}` } @@ -98,7 +97,7 @@ app.post('/upload', function (req, res) { const options = { 'method': 'POST', - 'url': `https://streetviewpublish.googleapis.com/v1/photo?key=${apiKey}`, + 'url': `https://streetviewpublish.googleapis.com/v1/photo`, 'headers': { 'Authorization': `Bearer ${key}`, 'Content-Type': 'application/json' @@ -110,7 +109,7 @@ app.post('/upload', function (req, res) { console.log(error) && res.status(500).send("Error with setting metadata of file"); } else { if (JSON.parse(response.body)["error"]) { - res.status(JSON.parse(response.body)["error"]["code"]).send(`Status: ${JSON.parse(response.body)["error"]["status"]}
Error message: ${JSON.parse(response.body)["error"]["message"]}
Try adding the latitude and longitude coordinates.
Upload another?`) + res.status(JSON.parse(response.body)["error"]["code"]).send(`Status: ${JSON.parse(response.body)["error"]["status"]}
Error message: ${JSON.parse(response.body)["error"]["message"]}
Upload another?`) } else { res.status(200).send(`Status: ${JSON.parse(response.body)["mapsPublishStatus"]}
Link: ${JSON.parse(response.body)["shareLink"]}
You may have to wait awhile after uploading for Google to process the image.
Upload another?`) }