diff --git a/config.json b/config.json index b937afc..fcccb61 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "name" : "Growers Journal", - "exportId" : "Q-lhGNVPQtm9tII_-P6TGQ", + "exportId" : "meSL7qkeTAC8BvAVMtSL0g", "icon" : "🗒", "requiredAWSConfigs" : [ ], "requiredOAuthApiConfigs" : [ ], diff --git a/lib/google-client.js b/lib/google-client.js index 1ac543e..0f24884 100644 --- a/lib/google-client.js +++ b/lib/google-client.js @@ -2,8 +2,25 @@ @exportId F27x9o81SQKunXWbmDUWNw */ module.exports = (function() { +const url = require('url'); // legacy Node6 url +const semver = require('semver'); +class Node6CompatibilityURL { + constructor(str) { + this.url = url.parse(str); + this.origin = this.url.protocol + '//'; + this.pathname = this.url.pathname ? this.url.pathname : ''; + this.search = this.url.search ? this.url.search : ''; + this.href = this.url.href ? this.url.href : ''; + } +} + +if (semver.lt(process.version, '6.13.0')) { + window = {}; + window.URL = Node6CompatibilityURL; // no warranty 😱 +} + return function(ellipsis) { - const { JWT } = ellipsis.require('google-auth-library@2.0.2'); + const { JWT } = ellipsis.require('google-auth-library@3.1.0'); return new JWT({ email: ellipsis.env.GOOGLE_SERVICE_ACCOUNT_EMAIL, key: ellipsis.env.GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY,