diff --git a/lerna.json b/lerna.json index 0a011bc6c8..0ee92c01b0 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 5349f7be64..6898b2ab8c 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/auth/src/middleware/passport/third-party-common.js b/packages/auth/src/middleware/passport/third-party-common.js index 2ab2816391..54252b329d 100644 --- a/packages/auth/src/middleware/passport/third-party-common.js +++ b/packages/auth/src/middleware/passport/third-party-common.js @@ -6,6 +6,7 @@ const { authError } = require("./utils") const { newid } = require("../../hashing") const { createASession } = require("../../security/sessions") const { getGlobalUserByEmail } = require("../../utils") +const fetch = require("node-fetch") /** * Common authentication logic for third parties. e.g. OAuth, OIDC. @@ -65,7 +66,7 @@ exports.authenticateThirdParty = async function ( } } - dbUser = syncUser(dbUser, thirdPartyUser) + dbUser = await syncUser(dbUser, thirdPartyUser) // create or sync the user const response = await db.post(dbUser) @@ -86,10 +87,26 @@ exports.authenticateThirdParty = async function ( return done(null, dbUser) } +async function syncProfilePicture(user, thirdPartyUser) { + const pictureUrl = thirdPartyUser.profile._json.picture + if (pictureUrl) { + const response = await fetch(pictureUrl) + + if (response.status === 200) { + const type = response.headers.get("content-type") + if (type.startsWith("image/")) { + user.pictureUrl = pictureUrl + } + } + } + + return user +} + /** * @returns a user that has been sync'd with third party information */ -function syncUser(user, thirdPartyUser) { +async function syncUser(user, thirdPartyUser) { // provider user.provider = thirdPartyUser.provider user.providerType = thirdPartyUser.providerType @@ -112,6 +129,8 @@ function syncUser(user, thirdPartyUser) { } } + user = await syncProfilePicture(user, thirdPartyUser) + // profile user.thirdPartyProfile = { ...profile._json, diff --git a/packages/bbui/package.json b/packages/bbui/package.json index ebe069d389..6b8bc2e96d 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 16c8b668c1..19a0d1e0fd 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.87-alpha.1", - "@budibase/client": "^0.9.87-alpha.1", + "@budibase/bbui": "^0.9.87-alpha.3", + "@budibase/client": "^0.9.87-alpha.3", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.87-alpha.1", + "@budibase/string-templates": "^0.9.87-alpha.3", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index 69b6e770f6..c1bdc31cd4 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -54,7 +54,11 @@
- +
userInfoModal.show()}> diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 4bc0b46167..20bdc9cb54 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -100,7 +100,11 @@
- +
userInfoModal.show()}> diff --git a/packages/cli/package.json b/packages/cli/package.json index 05599cf4e5..64b5541666 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index b8c9738b8c..148e48ec5b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.87-alpha.1", - "@budibase/standard-components": "^0.9.87-alpha.1", - "@budibase/string-templates": "^0.9.87-alpha.1", + "@budibase/bbui": "^0.9.87-alpha.3", + "@budibase/standard-components": "^0.9.87-alpha.3", + "@budibase/string-templates": "^0.9.87-alpha.3", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/.gitignore b/packages/server/.gitignore index e8589f631d..48207e3dd4 100644 --- a/packages/server/.gitignore +++ b/packages/server/.gitignore @@ -7,3 +7,4 @@ public/ db/dev.db/ dist coverage/ +watchtower-hook.json \ No newline at end of file diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index 253bcb339d..b2e4efadb9 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,5 +1,10 @@ FROM node:12-alpine +LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh" + WORKDIR /app ENV PORT=4001 diff --git a/packages/server/package.json b/packages/server/package.json index be80d07f8b..83fb3177a1 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.87-alpha.1", - "@budibase/client": "^0.9.87-alpha.1", - "@budibase/string-templates": "^0.9.87-alpha.1", + "@budibase/auth": "^0.9.87-alpha.3", + "@budibase/client": "^0.9.87-alpha.3", + "@budibase/string-templates": "^0.9.87-alpha.3", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.87-alpha.1", + "@budibase/standard-components": "^0.9.87-alpha.3", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/server/scripts/watchtower-hooks/post-check.sh b/packages/server/scripts/watchtower-hooks/post-check.sh new file mode 100755 index 0000000000..df95917d98 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/post-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/post-update.sh b/packages/server/scripts/watchtower-hooks/post-update.sh new file mode 100755 index 0000000000..fe57719781 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/post-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/pre-check.sh b/packages/server/scripts/watchtower-hooks/pre-check.sh new file mode 100755 index 0000000000..ffaa41ad5f --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/pre-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/pre-update.sh b/packages/server/scripts/watchtower-hooks/pre-update.sh new file mode 100755 index 0000000000..4584d96fc9 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/pre-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 002d5490cd..c6a5c3c9fb 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.87-alpha.1", + "@budibase/bbui": "^0.9.87-alpha.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 2e2fb3829e..c6f6c9c061 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/.gitignore b/packages/worker/.gitignore index 713d5006da..0467f6a505 100644 --- a/packages/worker/.gitignore +++ b/packages/worker/.gitignore @@ -1,2 +1,3 @@ node_modules/ .env +watchtower-hook.json \ No newline at end of file diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 76b35dfdd0..517e24678f 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -1,5 +1,10 @@ FROM node:12-alpine +LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh" + WORKDIR /app # copy files and install dependencies diff --git a/packages/worker/package.json b/packages/worker/package.json index abb20a784b..e42eae0480 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.87-alpha.1", + "version": "0.9.87-alpha.3", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.87-alpha.1", - "@budibase/string-templates": "^0.9.87-alpha.1", + "@budibase/auth": "^0.9.87-alpha.3", + "@budibase/string-templates": "^0.9.87-alpha.3", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", diff --git a/packages/worker/scripts/watchtower-hooks/post-check.sh b/packages/worker/scripts/watchtower-hooks/post-check.sh new file mode 100755 index 0000000000..df95917d98 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/post-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/post-update.sh b/packages/worker/scripts/watchtower-hooks/post-update.sh new file mode 100755 index 0000000000..fe57719781 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/post-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/pre-check.sh b/packages/worker/scripts/watchtower-hooks/pre-check.sh new file mode 100755 index 0000000000..ffaa41ad5f --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/pre-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/pre-update.sh b/packages/worker/scripts/watchtower-hooks/pre-update.sh new file mode 100755 index 0000000000..4584d96fc9 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/pre-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-update" }' > 'watchtower-hook.json' \ No newline at end of file