From 3205250f31d5b0a2eadc1a3a6aa7e1c6c30910bf Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 11:00:35 -0200 Subject: [PATCH 1/8] Fix download on electron --- .../client/messageAttachment.coffee | 2 ++ .../flex-tab/tabs/uploadedFilesList.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.coffee b/packages/rocketchat-message-attachments/client/messageAttachment.coffee index 195fb7cfb1f..a03b2b66f35 100644 --- a/packages/rocketchat-message-attachments/client/messageAttachment.coffee +++ b/packages/rocketchat-message-attachments/client/messageAttachment.coffee @@ -12,6 +12,8 @@ Template.messageAttachment.helpers if Meteor.settings.public.sandstorm or url.match /^(https?:)?\/\//i return url + else if navigator.userAgent.indexOf('Electron') > -1 + return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + url else return Meteor.absoluteUrl().replace(/\/$/, '') + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + url diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.coffee b/packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.coffee index d470222c5a3..7bc48eb25b7 100644 --- a/packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.coffee +++ b/packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.coffee @@ -40,6 +40,8 @@ Template.uploadedFilesList.helpers if Meteor.settings.public.sandstorm or url.match /^(https?:)?\/\//i return url + else if navigator.userAgent.indexOf('Electron') > -1 + return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + url else return Meteor.absoluteUrl().replace(/\/$/, '') + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + url From 4afb003cacfc9d3eefa613c0390b2512e116a503 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 17:56:23 -0200 Subject: [PATCH 2/8] Add missing migration Closes #5197 --- server/startup/migrations/v071.1.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 server/startup/migrations/v071.1.js diff --git a/server/startup/migrations/v071.1.js b/server/startup/migrations/v071.1.js new file mode 100644 index 00000000000..e915c13cac6 --- /dev/null +++ b/server/startup/migrations/v071.1.js @@ -0,0 +1,6 @@ +RocketChat.Migrations.add({ + version: 71.1, + up: function() { + ServiceConfiguration.configurations.remove({}); + } +}); From e7663cc9f66369e009edff2306312b338613e74c Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 16:29:47 -0200 Subject: [PATCH 3/8] Fix OAuth global variable Closes #5214 --- packages/rocketchat-custom-oauth/custom_oauth_client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/rocketchat-custom-oauth/custom_oauth_client.js b/packages/rocketchat-custom-oauth/custom_oauth_client.js index 418bfff473f..b3c88e9955d 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_client.js +++ b/packages/rocketchat-custom-oauth/custom_oauth_client.js @@ -46,7 +46,6 @@ export class CustomOAuth { } configureLogin() { - self = this; const loginWithService = 'loginWith' + s.capitalize(this.name); Meteor[loginWithService] = (options, callback) => { @@ -57,7 +56,7 @@ export class CustomOAuth { } const credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback); - self.requestCredential(options, credentialRequestCompleteCallback); + this.requestCredential(options, credentialRequestCompleteCallback); }; } From bd32c3039ac9d986ec5dde1894d7b387d94a985a Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 17:00:23 -0200 Subject: [PATCH 4/8] Add button to refresh aouth services Closes #5197 --- packages/rocketchat-i18n/i18n/en.i18n.json | 1 + packages/rocketchat-lib/package.js | 1 + .../server/methods/refreshOAuthService.js | 15 +++++++++++++++ packages/rocketchat-ui-admin/admin/admin.coffee | 8 ++++++++ packages/rocketchat-ui-admin/admin/admin.html | 1 + 5 files changed, 26 insertions(+) create mode 100644 packages/rocketchat-lib/server/methods/refreshOAuthService.js diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index a826ca4ac39..b80daa50d9f 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -1058,6 +1058,7 @@ "Read_only_group": "Read Only Group", "Record": "Record", "Redirect_URI": "Redirect URI", + "Refresh_oauth_services": "Refresh OAuth Services", "Refresh_keys": "Refresh keys", "Refresh_your_page_after_install_to_enable_screen_sharing": "Refresh your page after install to enable screen sharing", "Register": "Register a new account", diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js index 66064b3ecd5..2d7f45101b5 100644 --- a/packages/rocketchat-lib/package.js +++ b/packages/rocketchat-lib/package.js @@ -110,6 +110,7 @@ Package.onUse(function(api) { // SERVER METHODS api.addFiles('server/methods/addOAuthService.coffee', 'server'); + api.addFiles('server/methods/refreshOAuthService.js', 'server'); api.addFiles('server/methods/addUserToRoom.coffee', 'server'); api.addFiles('server/methods/archiveRoom.coffee', 'server'); api.addFiles('server/methods/checkRegistrationSecretURL.coffee', 'server'); diff --git a/packages/rocketchat-lib/server/methods/refreshOAuthService.js b/packages/rocketchat-lib/server/methods/refreshOAuthService.js new file mode 100644 index 00000000000..513090b6ecd --- /dev/null +++ b/packages/rocketchat-lib/server/methods/refreshOAuthService.js @@ -0,0 +1,15 @@ +Meteor.methods({ + refreshOAuthService() { + if (!Meteor.userId()) { + throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'refreshOAuthService' }); + } + + if (RocketChat.authz.hasPermission(Meteor.userId(), 'add-oauth-service') !== true) { + throw new Meteor.Error('error-action-not-allowed', 'Refresh OAuth Services is not allowed', { method: 'refreshOAuthService', action: 'Refreshing_OAuth_Services' }); + } + + ServiceConfiguration.configurations.remove({}); + + RocketChat.models.Settings.update({_id: /^Accounts_OAuth_.+/}, {$set: {_updatedAt: new Date}}, {multi: true}); + } +}); diff --git a/packages/rocketchat-ui-admin/admin/admin.coffee b/packages/rocketchat-ui-admin/admin/admin.coffee index 08aba89d9ad..e529d885a58 100644 --- a/packages/rocketchat-ui-admin/admin/admin.coffee +++ b/packages/rocketchat-ui-admin/admin/admin.coffee @@ -321,6 +321,14 @@ Template.admin.events if err handleError(err) + "click .submit .refresh-oauth": (e, t) -> + toastr.info TAPi18n.__ 'Refreshing' + Meteor.call 'refreshOAuthService', (err) -> + if err + handleError(err) + else + toastr.success TAPi18n.__ 'Done' + "click .submit .remove-custom-oauth": (e, t) -> name = this.section.replace('Custom OAuth: ', '') config = diff --git a/packages/rocketchat-ui-admin/admin/admin.html b/packages/rocketchat-ui-admin/admin/admin.html index 205d4dffc6b..e24eb9f0b5f 100644 --- a/packages/rocketchat-ui-admin/admin/admin.html +++ b/packages/rocketchat-ui-admin/admin/admin.html @@ -208,6 +208,7 @@
{{#if $eq group._id 'OAuth'}} + {{/if}} {{#if $eq group._id 'Assets'}} From d402a411646fd1437b1da1bd00ffccc8a75128b8 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 17:42:01 -0200 Subject: [PATCH 5/8] Fix issue creating users with username from OAuth Closes #5222 --- packages/rocketchat-custom-oauth/custom_oauth_server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.js b/packages/rocketchat-custom-oauth/custom_oauth_server.js index b71c672909c..1e6d37bfc1a 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_server.js +++ b/packages/rocketchat-custom-oauth/custom_oauth_server.js @@ -252,6 +252,11 @@ export class CustomOAuth { return; } + // User already created or merged + if (user.services && user.services[serviceName] && user.services[serviceName].id === serviceData.id) { + return; + } + if (this.mergeUsers !== true) { throw new Meteor.Error('CustomOAuth', `User with username ${user.username} already exists`); } From b41dda0439dc72b238df69af9a7ef74ffdb58b57 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 20 Dec 2016 17:48:35 -0200 Subject: [PATCH 6/8] Fix message when username field not exists in OAuth data Closes #5221 --- packages/rocketchat-custom-oauth/custom_oauth_server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.js b/packages/rocketchat-custom-oauth/custom_oauth_server.js index 1e6d37bfc1a..84abcb7df8b 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_server.js +++ b/packages/rocketchat-custom-oauth/custom_oauth_server.js @@ -224,14 +224,14 @@ export class CustomOAuth { if (this.usernameField.indexOf('#{') > -1) { username = this.usernameField.replace(/#{(.+?)}/g, function(match, field) { if (!data[field]) { - throw new Meteor.Error(`Username template item "${field}" not found in data`, data); + throw new Meteor.Error('field_not_found', `Username template item "${field}" not found in data`, data); } return data[field]; }); } else { username = data[this.usernameField]; if (!username) { - throw new Meteor.Error(`Username field "${this.usernameField}" not found in data`, data); + throw new Meteor.Error('field_not_found', `Username field "${this.usernameField}" not found in data`, data); } } From 8db2875f52373008f868d00f3ef1e933954b0260 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Tue, 20 Dec 2016 18:22:44 -0200 Subject: [PATCH 7/8] update meteor-buildpack-horse repo --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 2b703091f2a..e4d3a3c577c 100644 --- a/app.json +++ b/app.json @@ -6,7 +6,7 @@ "keywords": ["meteor", "social", "community", "chat"], "website": "https://rocket.chat", "env": { - "BUILDPACK_URL": "https://github.com/RocketChat/heroku-buildpack-meteor.git", + "BUILDPACK_URL": "https://github.com/RocketChat/meteor-buildpack-horse.git", "HEROKU_APP_NAME": { "description": "Please re-enter your App Name from the top.", "required": true From 23bb7ee311e9b0a3ed68c3bdc6118cf860e95187 Mon Sep 17 00:00:00 2001 From: Gabriel Engel Date: Tue, 20 Dec 2016 18:48:56 -0200 Subject: [PATCH 8/8] bump to version 0.48.2 --- .sandstorm/sandstorm-pkgdef.capnp | 2 +- .snapcraft/edge/snapcraft.yaml | 2 +- .snapcraft/stable/snapcraft.yaml | 2 +- HISTORY.md | 8 ++++++++ package.json | 2 +- packages/rocketchat-lib/rocketchat.info | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index 9c82a4f8bca..eb8defc730e 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -21,7 +21,7 @@ const pkgdef :Spk.PackageDefinition = ( appVersion = 48, # Increment this for every release. - appMarketingVersion = (defaultText = "0.48.1"), + appMarketingVersion = (defaultText = "0.48.2"), # Human-readable representation of appVersion. Should match the way you # identify versions of your app in documentation and marketing. diff --git a/.snapcraft/edge/snapcraft.yaml b/.snapcraft/edge/snapcraft.yaml index a9e117d010b..89e0aee06aa 100644 --- a/.snapcraft/edge/snapcraft.yaml +++ b/.snapcraft/edge/snapcraft.yaml @@ -7,7 +7,7 @@ # 5. `snapcraft snap` name: rocketchat-server -version: 0.48.1 +version: 0.48.2 summary: Rocket.Chat server description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/ confinement: strict diff --git a/.snapcraft/stable/snapcraft.yaml b/.snapcraft/stable/snapcraft.yaml index 1faf49b04f7..27e226af5ee 100644 --- a/.snapcraft/stable/snapcraft.yaml +++ b/.snapcraft/stable/snapcraft.yaml @@ -7,7 +7,7 @@ # 5. `snapcraft snap` name: rocketchat-server -version: 0.48.1 +version: 0.48.2 summary: Rocket.Chat server description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/ confinement: strict diff --git a/HISTORY.md b/HISTORY.md index 2701ec90da8..409b0b84ec5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,13 @@ # History +## 0.48.2, 2016-Dec-20 + +- Add button to refresh aouth services +- Fix download on electron +- Fix issue creating users with username from OAuth +- Fix message when username field not exists in OAuth data +- Fix OAuth global variable + ## 0.48.1, 2016-Dec-13 - Now uses NodeJS 4.7.0 - Fix integration payload JSON.parse diff --git a/package.json b/package.json index be34fdc63d3..c33e38fa42e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Rocket.Chat", "description": "The Ultimate Open Source WebChat Platform", - "version": "0.48.1", + "version": "0.48.2", "author": { "name": "Rocket.Chat", "url": "https://rocket.chat/" diff --git a/packages/rocketchat-lib/rocketchat.info b/packages/rocketchat-lib/rocketchat.info index d9b984ed722..8810ad03e1f 100644 --- a/packages/rocketchat-lib/rocketchat.info +++ b/packages/rocketchat-lib/rocketchat.info @@ -1,3 +1,3 @@ { - "version": "0.48.1" + "version": "0.48.2" }