From 550683c0022a4053d14838002e85886c42f44b00 Mon Sep 17 00:00:00 2001 From: Chris Nash Date: Fri, 3 Feb 2017 10:18:15 -0500 Subject: [PATCH 001/349] Fixes #46 - Adds a Keyboard Shortcut option to the flextab --- packages/rocketchat-i18n/i18n/en.i18n.json | 12 ++++++++++++ packages/rocketchat-lib/client/defaultTabBars.js | 9 +++++++++ .../rocketchat-theme/client/imports/base.less | 8 ++++++++ .../flex-tab/tabs/keyboardShortcuts.coffee | 16 ++++++++++++++++ .../flex-tab/tabs/keyboardShortcuts.html | 14 ++++++++++++++ packages/rocketchat-ui-flextab/package.js | 2 ++ 6 files changed, 61 insertions(+) create mode 100644 packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee create mode 100644 packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 2ed3515c671..928e36ca744 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -688,6 +688,18 @@ "Katex_Enabled_Description": "Allow using katex for math typesetting in messages", "Katex_Parenthesis_Syntax": "Allow Parenthesis Syntax", "Katex_Parenthesis_Syntax_Description": "Allow using \\[katex block\\] and \\(inline katex\\) syntaxes", + "Keyboard_Shortcuts": { + "Title":"Keyboard Shortcuts", + "Items": [ + { "Description": "Open Channel / User search", "Keys": "Ctrl + p"}, + { "Description": "Edit previous message", "Keys": "Up Arrow"}, + { "Description": "Move to the beginning of the message", "Keys": "Command (or Alt) + Left Arrow"}, + { "Description": "Move to the beginning of the message", "Keys": "Command (or Alt) + Up Arrow"}, + { "Description": "Move to the end of the message", "Keys": "Command (or Alt) + Right Arrow"}, + { "Description": "Move to the end of the message", "Keys": "Command (or Alt) + Down Arrow"}, + { "Description": "New line in message compose input", "Keys": "Shift + Enter"} + ] + }, "Knowledge_Base": "Knowledge Base", "Label": "Label", "Language": "Language", diff --git a/packages/rocketchat-lib/client/defaultTabBars.js b/packages/rocketchat-lib/client/defaultTabBars.js index 0b58f317468..73f78fdaa69 100644 --- a/packages/rocketchat-lib/client/defaultTabBars.js +++ b/packages/rocketchat-lib/client/defaultTabBars.js @@ -33,3 +33,12 @@ RocketChat.TabBar.addButton({ template: 'uploadedFilesList', order: 3 }); + +RocketChat.TabBar.addButton({ + groups: ['channel', 'privategroup', 'directmessage'], + id: 'keyboard-shortcut-list', + i18nTitle: 'Keyboard_Shortcuts.Title', + icon: 'icon-keyboard', + template: 'keyboardShortcuts', + order: 4 +}); \ No newline at end of file diff --git a/packages/rocketchat-theme/client/imports/base.less b/packages/rocketchat-theme/client/imports/base.less index ef27d8c1237..3ad5f50ac5a 100644 --- a/packages/rocketchat-theme/client/imports/base.less +++ b/packages/rocketchat-theme/client/imports/base.less @@ -3246,6 +3246,14 @@ body:not(.is-cordova) { opacity: 0; } + .section { + border: 1px solid #dddddd; + border-radius: 4px; + background-color: #ffffff; + padding: 20px; + margin: 20px; + } + > .animated { position: absolute; top: 0; diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee new file mode 100644 index 00000000000..7b16f53ae85 --- /dev/null +++ b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee @@ -0,0 +1,16 @@ +Template.keyboardShortcuts.helpers +#Get all of the "Items" in the "Keyboard_Shortcuts" object in the translation file. +#This allows us to add more keyboard shortcuts in the future without modifying the template. + + shortcuts: -> + idx = 0 + data = [] + loop + shortcut = + "Description": TAPi18n.__("Keyboard_Shortcuts.Items." + idx + ".Description"), + "Keys": TAPi18n.__("Keyboard_Shortcuts.Items." + idx + ".Keys") + if shortcut.Keys is "Keyboard_Shortcuts.Items." + idx + ".Keys" + break # Tapi18n did not find this value, so there are no more shortcuts defined. + data.push(shortcut) + idx++ + return data \ No newline at end of file diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html new file mode 100644 index 00000000000..21d4ceed0f7 --- /dev/null +++ b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/packages/rocketchat-ui-flextab/package.js b/packages/rocketchat-ui-flextab/package.js index 2b783476ff4..a4dd3a94d67 100644 --- a/packages/rocketchat-ui-flextab/package.js +++ b/packages/rocketchat-ui-flextab/package.js @@ -23,6 +23,7 @@ Package.onUse(function(api) { api.use('rocketchat:ui'); api.addFiles('flex-tab/flexTabBar.html', 'client'); + api.addFiles('flex-tab/tabs/keyboardShortcuts.html', 'client'); api.addFiles('flex-tab/tabs/membersList.html', 'client'); api.addFiles('flex-tab/tabs/messageSearch.html', 'client'); api.addFiles('flex-tab/tabs/uploadedFilesList.html', 'client'); @@ -30,6 +31,7 @@ Package.onUse(function(api) { api.addFiles('flex-tab/tabs/userInfo.html', 'client'); api.addFiles('flex-tab/flexTabBar.coffee', 'client'); + api.addFiles('flex-tab/tabs/keyboardShortcuts.coffee', 'client'); api.addFiles('flex-tab/tabs/membersList.coffee', 'client'); api.addFiles('flex-tab/tabs/messageSearch.coffee', 'client'); api.addFiles('flex-tab/tabs/uploadedFilesList.coffee', 'client'); From b404de218b561117af77cd95a9794c5128c47752 Mon Sep 17 00:00:00 2001 From: Chris Nash Date: Fri, 3 Feb 2017 11:13:06 -0500 Subject: [PATCH 002/349] Spaces to tabs per 'codacy-bot' linting feedback --- packages/rocketchat-lib/client/defaultTabBars.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/rocketchat-lib/client/defaultTabBars.js b/packages/rocketchat-lib/client/defaultTabBars.js index 73f78fdaa69..62613965efb 100644 --- a/packages/rocketchat-lib/client/defaultTabBars.js +++ b/packages/rocketchat-lib/client/defaultTabBars.js @@ -35,10 +35,10 @@ RocketChat.TabBar.addButton({ }); RocketChat.TabBar.addButton({ - groups: ['channel', 'privategroup', 'directmessage'], - id: 'keyboard-shortcut-list', - i18nTitle: 'Keyboard_Shortcuts.Title', - icon: 'icon-keyboard', - template: 'keyboardShortcuts', - order: 4 + groups: ['channel', 'privategroup', 'directmessage'], + id: 'keyboard-shortcut-list', + i18nTitle: 'Keyboard_Shortcuts.Title', + icon: 'icon-keyboard', + template: 'keyboardShortcuts', + order: 4 }); \ No newline at end of file From 1c8dd6f79df0d2084c9b6d863c628bdbeda6ad78 Mon Sep 17 00:00:00 2001 From: Chris Nash Date: Fri, 3 Feb 2017 11:25:24 -0500 Subject: [PATCH 003/349] Cleaning up formatting of base.less due to linting failure. --- .../rocketchat-theme/client/imports/base.less | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/rocketchat-theme/client/imports/base.less b/packages/rocketchat-theme/client/imports/base.less index fdf412451db..ec163638469 100644 --- a/packages/rocketchat-theme/client/imports/base.less +++ b/packages/rocketchat-theme/client/imports/base.less @@ -3195,16 +3195,16 @@ body:not(.is-cordova) { > .animated-hidden { .transform(translateX(100%)); opacity: 0; - } - - .section { - border: 1px solid #dddddd; - border-radius: 4px; - background-color: #ffffff; - padding: 20px; - margin: 20px; - } - + } + + .section { + border: 1px solid #dddddd; + border-radius: 4px; + background-color: #ffffff; + padding: 20px; + margin: 20px; + } + > .animated { position: absolute; top: 0; From da8a9ba4ca99f5e7018c86f25eeb0d4b0e03f256 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Wed, 8 Mar 2017 19:51:08 -0300 Subject: [PATCH 004/349] Adds google vision settings and callback --- .meteor/packages | 1 + .meteor/versions | 1 + .../.npm/package/.gitignore | 1 + .../.npm/package/README | 7 + .../.npm/package/npm-shrinkwrap.json | 1869 +++++++++++++++++ packages/rocketchat-google-vision/README.md | 7 + packages/rocketchat-google-vision/package.js | 21 + .../server/googlevision.js | 38 + .../server/settings.js | 5 + packages/rocketchat-i18n/i18n/en.i18n.json | 3 + 10 files changed, 1953 insertions(+) create mode 100644 packages/rocketchat-google-vision/.npm/package/.gitignore create mode 100644 packages/rocketchat-google-vision/.npm/package/README create mode 100644 packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json create mode 100644 packages/rocketchat-google-vision/README.md create mode 100644 packages/rocketchat-google-vision/package.js create mode 100644 packages/rocketchat-google-vision/server/googlevision.js create mode 100644 packages/rocketchat-google-vision/server/settings.js diff --git a/.meteor/packages b/.meteor/packages index 4863b12e029..719ce2714df 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -63,6 +63,7 @@ rocketchat:file rocketchat:file-upload rocketchat:github-enterprise rocketchat:gitlab +rocketchat:google-vision rocketchat:highlight-words rocketchat:iframe-login rocketchat:importer diff --git a/.meteor/versions b/.meteor/versions index cadf5a17438..d61716cbf7a 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -145,6 +145,7 @@ rocketchat:file@0.0.1 rocketchat:file-upload@0.0.1 rocketchat:github-enterprise@0.0.1 rocketchat:gitlab@0.0.1 +rocketchat:google-vision@0.0.1 rocketchat:highlight-words@0.0.1 rocketchat:i18n@0.0.1 rocketchat:iframe-login@1.0.0 diff --git a/packages/rocketchat-google-vision/.npm/package/.gitignore b/packages/rocketchat-google-vision/.npm/package/.gitignore new file mode 100644 index 00000000000..3c3629e647f --- /dev/null +++ b/packages/rocketchat-google-vision/.npm/package/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/packages/rocketchat-google-vision/.npm/package/README b/packages/rocketchat-google-vision/.npm/package/README new file mode 100644 index 00000000000..3d492553a43 --- /dev/null +++ b/packages/rocketchat-google-vision/.npm/package/README @@ -0,0 +1,7 @@ +This directory and the files immediately inside it are automatically generated +when you change this package's NPM dependencies. Commit the files in this +directory (npm-shrinkwrap.json, .gitignore, and this README) to source control +so that others run the same versions of sub-dependencies. + +You should NOT check in the node_modules directory that Meteor automatically +creates; if you are using git, the .gitignore file tells git to ignore it. diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json new file mode 100644 index 00000000000..c431dfc4596 --- /dev/null +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -0,0 +1,1869 @@ +{ + "dependencies": { + "ajv": { + "version": "4.11.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.4.tgz", + "from": "ajv@>=4.9.1 <5.0.0" + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "from": "ansi-regex@>=2.0.0 <3.0.0" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "from": "ansi-styles@>=2.2.1 <3.0.0" + }, + "arguejs": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/arguejs/-/arguejs-0.2.3.tgz", + "from": "arguejs@>=0.2.3 <0.3.0" + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "from": "array-uniq@>=1.0.3 <2.0.0" + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "from": "arrify@>=1.0.0 <2.0.0" + }, + "ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "from": "ascli@>=1.0.0 <2.0.0" + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "from": "asn1@>=0.2.3 <0.3.0" + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "from": "assert-plus@>=0.2.0 <0.3.0" + }, + "async": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/async/-/async-2.1.5.tgz", + "from": "async@>=2.0.1 <3.0.0" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "from": "asynckit@>=0.4.0 <0.5.0" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "from": "aws-sign2@>=0.6.0 <0.7.0" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "from": "aws4@>=1.2.1 <2.0.0" + }, + "balanced-match": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "from": "balanced-match@>=0.4.1 <0.5.0" + }, + "base64url": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-1.0.6.tgz", + "from": "base64url@>=1.0.4 <1.1.0", + "dependencies": { + "concat-stream": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.10.tgz", + "from": "concat-stream@>=1.4.7 <1.5.0" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "from": "isarray@0.0.1" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "from": "readable-stream@>=1.1.9 <1.2.0" + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "from": "bcrypt-pbkdf@>=1.0.0 <2.0.0" + }, + "bl": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz", + "from": "bl@>=1.1.2 <1.2.0", + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "from": "readable-stream@>=2.0.5 <2.1.0" + } + } + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "from": "boom@>=2.0.0 <3.0.0" + }, + "brace-expansion": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", + "from": "brace-expansion@>=1.0.0 <2.0.0" + }, + "buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "from": "buffer-equal@0.0.1" + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "from": "buffer-equal-constant-time@>=1.0.1 <2.0.0" + }, + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "from": "buffer-shims@>=1.0.0 <2.0.0" + }, + "bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "from": "bytebuffer@>=5.0.0 <6.0.0" + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "from": "camelcase@>=1.0.1 <2.0.0" + }, + "camelcase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz", + "from": "camelcase-keys@>=1.0.0 <2.0.0" + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "from": "capture-stack-trace@>=1.0.0 <2.0.0" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "from": "caseless@>=0.12.0 <0.13.0" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "from": "chalk@>=1.1.1 <2.0.0" + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "from": "cliui@>=3.0.3 <4.0.0" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "from": "co@>=4.6.0 <5.0.0" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "from": "code-point-at@>=1.0.0 <2.0.0" + }, + "colour": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", + "from": "colour@>=0.7.1 <0.8.0" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "from": "combined-stream@>=1.0.5 <1.1.0" + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "from": "commander@>=2.9.0 <3.0.0" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "from": "concat-map@0.0.1" + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "from": "concat-stream@>=1.5.0 <2.0.0" + }, + "configstore": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-1.4.0.tgz", + "from": "configstore@>=1.2.1 <2.0.0", + "dependencies": { + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "from": "object-assign@>=4.0.1 <5.0.0" + }, + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "from": "uuid@>=2.0.1 <3.0.0" + } + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "from": "core-util-is@>=1.0.0 <1.1.0" + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "from": "create-error-class@>=3.0.2 <4.0.0" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "from": "cryptiles@>=2.0.0 <3.0.0" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "from": "dashdash@>=1.12.0 <2.0.0", + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@>=1.0.0 <2.0.0" + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "from": "decamelize@>=1.1.1 <2.0.0" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "from": "delayed-stream@>=1.0.0 <1.1.0" + }, + "dot-prop": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-2.4.0.tgz", + "from": "dot-prop@>=2.4.0 <3.0.0" + }, + "duplexify": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.0.tgz", + "from": "duplexify@>=3.2.0 <4.0.0" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "from": "ecc-jsbn@>=0.1.1 <0.2.0" + }, + "ecdsa-sig-formatter": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", + "from": "ecdsa-sig-formatter@>=1.0.0 <2.0.0", + "dependencies": { + "base64url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", + "from": "base64url@>=2.0.0 <3.0.0" + } + } + }, + "end-of-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.0.0.tgz", + "from": "end-of-stream@1.0.0", + "dependencies": { + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "from": "once@>=1.3.0 <1.4.0" + } + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "from": "ent@>=2.2.0 <3.0.0" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "from": "escape-string-regexp@>=1.0.2 <2.0.0" + }, + "extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", + "from": "extend@>=3.0.0 <4.0.0" + }, + "extsprintf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", + "from": "extsprintf@1.0.2" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "from": "forever-agent@>=0.6.1 <0.7.0" + }, + "form-data": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.2.tgz", + "from": "form-data@>=2.1.1 <2.2.0" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "from": "fs.realpath@>=1.0.0 <2.0.0" + }, + "gcs-resumable-upload": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-0.7.4.tgz", + "from": "gcs-resumable-upload@>=0.7.1 <0.8.0", + "dependencies": { + "google-auto-auth": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.2.4.tgz", + "from": "google-auto-auth@>=0.2.1 <0.3.0" + } + } + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "from": "generate-function@>=2.0.0 <3.0.0" + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "from": "generate-object-property@>=1.1.0 <2.0.0" + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "from": "get-stdin@>=4.0.1 <5.0.0" + }, + "getpass": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", + "from": "getpass@>=0.1.1 <0.2.0", + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@>=1.0.0 <2.0.0" + } + } + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "from": "glob@>=7.0.5 <8.0.0" + }, + "google-auth-library": { + "version": "0.9.10", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.9.10.tgz", + "from": "google-auth-library@>=0.9.10 <0.10.0", + "dependencies": { + "async": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.4.2.tgz", + "from": "async@>=1.4.2 <1.5.0" + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "from": "caseless@>=0.11.0 <0.12.0" + }, + "form-data": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", + "from": "form-data@>=1.0.0-rc4 <1.1.0", + "dependencies": { + "async": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/async/-/async-2.1.5.tgz", + "from": "async@^2.0.1" + } + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "from": "har-validator@>=2.0.6 <2.1.0" + }, + "node-uuid": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", + "from": "node-uuid@>=1.4.7 <1.5.0" + }, + "qs": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", + "from": "qs@>=6.2.0 <6.3.0" + }, + "request": { + "version": "2.74.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", + "from": "request@>=2.74.0 <2.75.0" + } + } + }, + "google-auto-auth": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.5.2.tgz", + "from": "google-auto-auth@>=0.5.2 <0.6.0" + }, + "google-gax": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-0.12.3.tgz", + "from": "google-gax@>=0.12.1 <0.13.0", + "dependencies": { + "google-proto-files": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/google-proto-files/-/google-proto-files-0.9.1.tgz", + "from": "google-proto-files@>=0.9.1 <0.10.0" + } + } + }, + "google-p12-pem": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.1.tgz", + "from": "google-p12-pem@>=0.1.0 <0.2.0" + }, + "google-proto-files": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/google-proto-files/-/google-proto-files-0.10.0.tgz", + "from": "google-proto-files@>=0.10.0 <0.11.0" + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "from": "graceful-fs@>=4.1.2 <5.0.0" + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "from": "graceful-readlink@>=1.0.0" + }, + "grpc": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.1.2.tgz", + "from": "grpc@>=1.1.1 <2.0.0", + "dependencies": { + "node-pre-gyp": { + "version": "0.6.33", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.33.tgz", + "from": "node-pre-gyp@0.6.33", + "dependencies": { + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "from": "mkdirp@>=0.5.1 <0.6.0", + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "from": "minimist@0.0.8" + } + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "from": "nopt@>=3.0.6 <3.1.0", + "dependencies": { + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "from": "abbrev@>=1.0.0 <2.0.0" + } + } + }, + "npmlog": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.0.2.tgz", + "from": "npmlog@>=4.0.1 <5.0.0", + "dependencies": { + "are-we-there-yet": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz", + "from": "are-we-there-yet@>=1.1.2 <1.2.0", + "dependencies": { + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "from": "delegates@>=1.0.0 <2.0.0" + }, + "readable-stream": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.2.tgz", + "from": "readable-stream@>=2.0.0 <3.0.0||>=1.1.13 <2.0.0", + "dependencies": { + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "from": "buffer-shims@>=1.0.0 <2.0.0" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "from": "core-util-is@>=1.0.0 <1.1.0" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.1 <2.1.0" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "from": "isarray@>=1.0.0 <1.1.0" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "from": "process-nextick-args@>=1.0.6 <1.1.0" + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "from": "string_decoder@>=0.10.0 <0.11.0" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "from": "util-deprecate@>=1.0.1 <1.1.0" + } + } + } + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "from": "console-control-strings@>=1.1.0 <1.2.0" + }, + "gauge": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.3.tgz", + "from": "gauge@>=2.7.1 <2.8.0", + "dependencies": { + "aproba": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.0.tgz", + "from": "aproba@>=1.0.3 <2.0.0" + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "from": "has-unicode@>=2.0.0 <3.0.0" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "from": "object-assign@>=4.1.0 <5.0.0" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "from": "signal-exit@>=3.0.0 <4.0.0" + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "from": "string-width@>=1.0.1 <2.0.0", + "dependencies": { + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "from": "code-point-at@>=1.0.0 <2.0.0" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "from": "is-fullwidth-code-point@>=1.0.0 <2.0.0", + "dependencies": { + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "from": "number-is-nan@>=1.0.0 <2.0.0" + } + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "from": "strip-ansi@>=3.0.1 <4.0.0", + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "from": "ansi-regex@>=2.0.0 <3.0.0" + } + } + }, + "wide-align": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.0.tgz", + "from": "wide-align@>=1.1.0 <2.0.0" + } + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "from": "set-blocking@>=2.0.0 <2.1.0" + } + } + }, + "rc": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.1.6.tgz", + "from": "rc@>=1.1.6 <1.2.0", + "dependencies": { + "deep-extend": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.1.tgz", + "from": "deep-extend@>=0.4.0 <0.5.0" + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "from": "ini@>=1.3.0 <1.4.0" + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "from": "minimist@>=1.2.0 <2.0.0" + }, + "strip-json-comments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", + "from": "strip-json-comments@>=1.0.4 <1.1.0" + } + } + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "from": "request@>=2.79.0 <3.0.0", + "dependencies": { + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "from": "aws-sign2@>=0.6.0 <0.7.0" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "from": "aws4@>=1.2.1 <2.0.0" + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "from": "caseless@>=0.11.0 <0.12.0" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "from": "combined-stream@>=1.0.5 <1.1.0", + "dependencies": { + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "from": "delayed-stream@>=1.0.0 <1.1.0" + } + } + }, + "extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", + "from": "extend@>=3.0.0 <3.1.0" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "from": "forever-agent@>=0.6.1 <0.7.0" + }, + "form-data": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.2.tgz", + "from": "form-data@>=2.1.1 <2.2.0", + "dependencies": { + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "from": "asynckit@>=0.4.0 <0.5.0" + } + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "from": "har-validator@>=2.0.6 <2.1.0", + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "from": "chalk@>=1.1.1 <2.0.0", + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "from": "ansi-styles@>=2.2.1 <3.0.0" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "from": "escape-string-regexp@>=1.0.2 <2.0.0" + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "from": "has-ansi@>=2.0.0 <3.0.0", + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "from": "ansi-regex@>=2.0.0 <3.0.0" + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "from": "strip-ansi@>=3.0.0 <4.0.0", + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "from": "ansi-regex@>=2.0.0 <3.0.0" + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "from": "supports-color@>=2.0.0 <3.0.0" + } + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "from": "commander@>=2.9.0 <3.0.0", + "dependencies": { + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "from": "graceful-readlink@>=1.0.0" + } + } + }, + "is-my-json-valid": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz", + "from": "is-my-json-valid@>=2.12.4 <3.0.0", + "dependencies": { + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "from": "generate-function@>=2.0.0 <3.0.0" + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "from": "generate-object-property@>=1.1.0 <2.0.0", + "dependencies": { + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "from": "is-property@>=1.0.0 <2.0.0" + } + } + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "from": "jsonpointer@>=4.0.0 <5.0.0" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "from": "xtend@>=4.0.0 <5.0.0" + } + } + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "from": "pinkie-promise@>=2.0.0 <3.0.0", + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "from": "pinkie@>=2.0.0 <3.0.0" + } + } + } + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "from": "hawk@>=3.1.3 <3.2.0", + "dependencies": { + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "from": "boom@>=2.0.0 <3.0.0" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "from": "cryptiles@>=2.0.0 <3.0.0" + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "from": "hoek@>=2.0.0 <3.0.0" + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "from": "sntp@>=1.0.0 <2.0.0" + } + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "from": "http-signature@>=1.1.0 <1.2.0", + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "from": "assert-plus@>=0.2.0 <0.3.0" + }, + "jsprim": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz", + "from": "jsprim@>=1.2.2 <2.0.0", + "dependencies": { + "extsprintf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", + "from": "extsprintf@1.0.2" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "from": "json-schema@0.2.3" + }, + "verror": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", + "from": "verror@1.3.6" + } + } + }, + "sshpk": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.2.tgz", + "from": "sshpk@>=1.7.0 <2.0.0", + "dependencies": { + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "from": "asn1@>=0.2.3 <0.3.0" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@>=1.0.0 <2.0.0" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "from": "bcrypt-pbkdf@>=1.0.0 <2.0.0" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "from": "dashdash@>=1.12.0 <2.0.0" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "from": "ecc-jsbn@>=0.1.1 <0.2.0" + }, + "getpass": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", + "from": "getpass@>=0.1.1 <0.2.0" + }, + "jodid25519": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", + "from": "jodid25519@>=1.0.0 <2.0.0" + }, + "jsbn": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz", + "from": "jsbn@>=0.1.0 <0.2.0" + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "from": "tweetnacl@>=0.14.0 <0.15.0" + } + } + } + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "from": "is-typedarray@>=1.0.0 <1.1.0" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "from": "isstream@>=0.1.2 <0.2.0" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "from": "json-stringify-safe@>=5.0.1 <5.1.0" + }, + "mime-types": { + "version": "2.1.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.14.tgz", + "from": "mime-types@>=2.1.7 <2.2.0", + "dependencies": { + "mime-db": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.26.0.tgz", + "from": "mime-db@>=1.26.0 <1.27.0" + } + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "from": "oauth-sign@>=0.8.1 <0.9.0" + }, + "qs": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.0.tgz", + "from": "qs@>=6.3.0 <6.4.0" + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "from": "stringstream@>=0.0.4 <0.1.0" + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "from": "tough-cookie@>=2.3.0 <2.4.0", + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "from": "punycode@>=1.4.1 <2.0.0" + } + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "from": "tunnel-agent@>=0.4.1 <0.5.0" + }, + "uuid": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", + "from": "uuid@>=3.0.0 <4.0.0" + } + } + }, + "rimraf": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.4.tgz", + "from": "rimraf@>=2.5.4 <2.6.0", + "dependencies": { + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "from": "glob@>=7.0.5 <8.0.0", + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "from": "fs.realpath@>=1.0.0 <2.0.0" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "from": "inflight@>=1.0.4 <2.0.0", + "dependencies": { + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "from": "wrappy@>=1.0.0 <2.0.0" + } + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.0 <3.0.0" + }, + "minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", + "from": "minimatch@>=3.0.0 <4.0.0", + "dependencies": { + "brace-expansion": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", + "from": "brace-expansion@>=1.0.0 <2.0.0", + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "from": "balanced-match@>=0.4.1 <0.5.0" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "from": "concat-map@0.0.1" + } + } + } + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "from": "once@>=1.3.0 <2.0.0", + "dependencies": { + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "from": "wrappy@>=1.0.0 <2.0.0" + } + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "from": "path-is-absolute@>=1.0.0 <2.0.0" + } + } + } + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "from": "semver@>=5.3.0 <5.4.0" + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "from": "tar@>=2.2.1 <2.3.0", + "dependencies": { + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "from": "block-stream@*" + }, + "fstream": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.10.tgz", + "from": "fstream@>=1.0.2 <2.0.0", + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "from": "graceful-fs@>=4.1.2 <5.0.0" + } + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.0 <3.0.0" + } + } + }, + "tar-pack": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.3.0.tgz", + "from": "tar-pack@>=3.3.0 <3.4.0", + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "from": "debug@>=2.2.0 <2.3.0", + "dependencies": { + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "from": "ms@0.7.1" + } + } + }, + "fstream": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.10.tgz", + "from": "fstream@>=1.0.10 <1.1.0", + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "from": "graceful-fs@>=4.1.2 <5.0.0" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.0 <2.1.0" + } + } + }, + "fstream-ignore": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "from": "fstream-ignore@>=1.0.5 <1.1.0", + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.0 <3.0.0" + }, + "minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", + "from": "minimatch@>=3.0.0 <4.0.0", + "dependencies": { + "brace-expansion": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", + "from": "brace-expansion@>=1.0.0 <2.0.0", + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "from": "balanced-match@>=0.4.1 <0.5.0" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "from": "concat-map@0.0.1" + } + } + } + } + } + } + }, + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "from": "once@>=1.3.3 <1.4.0", + "dependencies": { + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "from": "wrappy@>=1.0.0 <2.0.0" + } + } + }, + "readable-stream": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz", + "from": "readable-stream@>=2.1.4 <2.2.0", + "dependencies": { + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "from": "buffer-shims@>=1.0.0 <2.0.0" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "from": "core-util-is@>=1.0.0 <1.1.0" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.0 <3.0.0" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "from": "isarray@>=1.0.0 <1.1.0" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "from": "process-nextick-args@>=1.0.6 <1.1.0" + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "from": "string_decoder@>=0.10.0 <0.11.0" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "from": "util-deprecate@>=1.0.1 <1.1.0" + } + } + }, + "uid-number": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", + "from": "uid-number@>=0.0.6 <0.1.0" + } + } + } + } + } + } + }, + "gtoken": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.1.tgz", + "from": "gtoken@>=1.1.0 <2.0.0" + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "from": "har-schema@>=1.0.5 <2.0.0" + }, + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "from": "har-validator@>=4.2.0 <4.3.0" + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "from": "has-ansi@>=2.0.0 <3.0.0" + }, + "hash-stream-validation": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.1.tgz", + "from": "hash-stream-validation@>=0.2.1 <0.3.0" + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "from": "hawk@>=3.1.3 <3.2.0" + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "from": "hoek@>=2.0.0 <3.0.0" + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "from": "http-signature@>=1.1.0 <1.2.0" + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "from": "imurmurhash@>=0.1.4 <0.2.0" + }, + "indent-string": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-1.2.2.tgz", + "from": "indent-string@>=1.1.0 <2.0.0" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "from": "inflight@>=1.0.4 <2.0.0" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "from": "inherits@>=2.0.3 <3.0.0" + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "from": "invert-kv@>=1.0.0 <2.0.0" + }, + "is": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", + "from": "is@>=3.0.1 <4.0.0" + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "from": "is-finite@>=1.0.0 <2.0.0" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "from": "is-fullwidth-code-point@>=1.0.0 <2.0.0" + }, + "is-my-json-valid": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", + "from": "is-my-json-valid@>=2.12.4 <3.0.0" + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "from": "is-obj@>=1.0.0 <2.0.0" + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "from": "is-property@>=1.0.0 <2.0.0" + }, + "is-stream-ended": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-stream-ended/-/is-stream-ended-0.1.0.tgz", + "from": "is-stream-ended@>=0.1.0 <0.2.0" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "from": "is-typedarray@>=1.0.0 <1.1.0" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "from": "isarray@>=1.0.0 <1.1.0" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "from": "isstream@>=0.1.2 <0.2.0" + }, + "jodid25519": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", + "from": "jodid25519@>=1.0.0 <2.0.0" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "from": "jsbn@>=0.1.0 <0.2.0" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "from": "json-schema@0.2.3" + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "from": "json-stable-stringify@>=1.0.1 <2.0.0" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "from": "json-stringify-safe@>=5.0.1 <5.1.0" + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "from": "jsonify@>=0.0.0 <0.1.0" + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "from": "jsonpointer@>=4.0.0 <5.0.0" + }, + "jsprim": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz", + "from": "jsprim@>=1.2.2 <2.0.0" + }, + "jwa": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.0.2.tgz", + "from": "jwa@>=1.0.0 <1.1.0", + "dependencies": { + "base64url": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-0.0.6.tgz", + "from": "base64url@>=0.0.4 <0.1.0" + } + } + }, + "jws": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.0.0.tgz", + "from": "jws@>=3.0.0 <3.1.0" + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "from": "lcid@>=1.0.0 <2.0.0" + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "from": "lodash@>=4.14.0 <5.0.0" + }, + "lodash.noop": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash.noop/-/lodash.noop-3.0.1.tgz", + "from": "lodash.noop@>=3.0.0 <3.1.0" + }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "from": "log-driver@>=1.2.5 <2.0.0" + }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "from": "long@>=3.0.0 <4.0.0" + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "from": "map-obj@>=1.0.0 <2.0.0" + }, + "meow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-2.0.0.tgz", + "from": "meow@>=2.0.0 <2.1.0", + "dependencies": { + "object-assign": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-1.0.0.tgz", + "from": "object-assign@>=1.0.0 <2.0.0" + } + } + }, + "methmeth": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/methmeth/-/methmeth-1.1.0.tgz", + "from": "methmeth@>=1.1.0 <2.0.0" + }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "from": "mime@>=1.2.11 <2.0.0" + }, + "mime-db": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.26.0.tgz", + "from": "mime-db@>=1.26.0 <1.27.0" + }, + "mime-types": { + "version": "2.1.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.14.tgz", + "from": "mime-types@>=2.0.8 <3.0.0" + }, + "minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", + "from": "minimatch@>=3.0.2 <4.0.0" + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "from": "minimist@>=1.1.0 <2.0.0" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "from": "mkdirp@>=0.5.0 <0.6.0", + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "from": "minimist@0.0.8" + } + } + }, + "modelo": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/modelo/-/modelo-4.2.0.tgz", + "from": "modelo@>=4.2.0 <5.0.0" + }, + "nan": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.5.1.tgz", + "from": "nan@>=2.0.0 <3.0.0" + }, + "node-forge": { + "version": "0.6.49", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.6.49.tgz", + "from": "node-forge@>=0.6.46 <0.7.0" + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "from": "number-is-nan@>=1.0.0 <2.0.0" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "from": "oauth-sign@>=0.8.1 <0.9.0" + }, + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "from": "object-assign@>=3.0.0 <4.0.0" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "from": "once@>=1.3.1 <2.0.0" + }, + "optjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", + "from": "optjs@>=3.2.2 <3.3.0" + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "from": "os-homedir@>=1.0.0 <2.0.0" + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "from": "os-locale@>=1.4.0 <2.0.0" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "from": "os-tmpdir@>=1.0.0 <2.0.0" + }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "from": "osenv@>=0.1.0 <0.2.0" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "from": "path-is-absolute@>=1.0.0 <2.0.0" + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "from": "performance-now@>=0.2.0 <0.3.0" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "from": "pinkie@>=2.0.0 <3.0.0" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "from": "pinkie-promise@>=2.0.0 <3.0.0" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "from": "process-nextick-args@>=1.0.6 <1.1.0" + }, + "prop-assign": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prop-assign/-/prop-assign-1.0.0.tgz", + "from": "prop-assign@>=1.0.0 <2.0.0" + }, + "propprop": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/propprop/-/propprop-0.3.1.tgz", + "from": "propprop@>=0.3.0 <0.4.0" + }, + "protobufjs": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.2.tgz", + "from": "protobufjs@>=5.0.0 <6.0.0" + }, + "pump": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.2.tgz", + "from": "pump@>=1.0.0 <2.0.0", + "dependencies": { + "end-of-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.1.0.tgz", + "from": "end-of-stream@>=1.1.0 <2.0.0", + "dependencies": { + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "from": "once@>=1.3.0 <1.4.0" + } + } + } + } + }, + "pumpify": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.3.5.tgz", + "from": "pumpify@>=1.3.3 <2.0.0" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "from": "punycode@>=1.4.1 <2.0.0" + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "from": "qs@>=6.3.0 <6.4.0" + }, + "readable-stream": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.3.tgz", + "from": "readable-stream@>=2.2.2 <3.0.0" + }, + "repeating": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", + "from": "repeating@>=1.1.0 <2.0.0" + }, + "request": { + "version": "2.80.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.80.0.tgz", + "from": "request@>=2.79.0 <3.0.0" + }, + "retry-request": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-1.3.2.tgz", + "from": "retry-request@>=1.3.2 <2.0.0", + "dependencies": { + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "from": "caseless@>=0.11.0 <0.12.0" + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "from": "har-validator@>=2.0.6 <2.1.0" + }, + "node-uuid": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", + "from": "node-uuid@~1.4.7" + }, + "request": { + "version": "2.76.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.76.0.tgz", + "from": "request@2.76.0" + } + } + }, + "rgb-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rgb-hex/-/rgb-hex-1.0.0.tgz", + "from": "rgb-hex@>=1.0.0 <2.0.0" + }, + "safe-buffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", + "from": "safe-buffer@>=5.0.1 <6.0.0" + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "from": "slide@>=1.1.5 <2.0.0" + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "from": "sntp@>=1.0.0 <2.0.0" + }, + "split-array-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.0.tgz", + "from": "split-array-stream@>=1.0.0 <2.0.0", + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "from": "async@>=1.4.0 <2.0.0" + } + } + }, + "sshpk": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.11.0.tgz", + "from": "sshpk@>=1.7.0 <2.0.0", + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@>=1.0.0 <2.0.0" + } + } + }, + "stream-events": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.1.tgz", + "from": "stream-events@>=1.0.1 <2.0.0" + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "from": "stream-shift@>=1.0.0 <2.0.0" + }, + "string-format-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/string-format-obj/-/string-format-obj-1.1.0.tgz", + "from": "string-format-obj@>=1.0.0 <2.0.0" + }, + "string-template": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz", + "from": "string-template@>=0.2.0 <0.3.0" + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "from": "string-width@>=1.0.1 <2.0.0" + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "from": "string_decoder@>=0.10.0 <0.11.0" + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "from": "stringstream@>=0.0.4 <0.1.0" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "from": "strip-ansi@>=3.0.0 <4.0.0" + }, + "stubs": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-1.1.2.tgz", + "from": "stubs@>=1.1.0 <2.0.0" + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "from": "supports-color@>=2.0.0 <3.0.0" + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "from": "through2@>=2.0.0 <3.0.0" + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "from": "tough-cookie@>=2.3.0 <2.4.0" + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "from": "tunnel-agent@>=0.4.1 <0.5.0" + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "from": "tweetnacl@>=0.14.0 <0.15.0" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "from": "typedarray@>=0.0.6 <0.0.7" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "from": "util-deprecate@>=1.0.1 <1.1.0" + }, + "uuid": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", + "from": "uuid@>=3.0.0 <4.0.0" + }, + "verror": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", + "from": "verror@1.3.6" + }, + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "from": "window-size@>=0.1.4 <0.2.0" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "from": "wrap-ansi@>=2.0.0 <3.0.0" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "from": "wrappy@>=1.0.0 <2.0.0" + }, + "write-file-atomic": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.1.tgz", + "from": "write-file-atomic@>=1.1.2 <2.0.0" + }, + "xdg-basedir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-2.0.0.tgz", + "from": "xdg-basedir@>=2.0.0 <3.0.0" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "from": "xtend@>=4.0.0 <5.0.0" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "from": "y18n@>=3.2.0 <4.0.0" + }, + "yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "from": "yargs@>=3.10.0 <4.0.0", + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "from": "camelcase@>=2.0.1 <3.0.0" + } + } + } + } +} diff --git a/packages/rocketchat-google-vision/README.md b/packages/rocketchat-google-vision/README.md new file mode 100644 index 00000000000..75ada0a6d01 --- /dev/null +++ b/packages/rocketchat-google-vision/README.md @@ -0,0 +1,7 @@ +For this to properly work, you need to have a Google Service Account; +https://console.cloud.google.com/apis/credentials + +Then you have to authorize that service account access to your buckets; +https://console.cloud.google.com/storage/browser +To do that, click on the ellipsis by your bucket's row and Edit object default permissions +Add user and paste the service account e-mail with owner privileges diff --git a/packages/rocketchat-google-vision/package.js b/packages/rocketchat-google-vision/package.js new file mode 100644 index 00000000000..fcc5fa67427 --- /dev/null +++ b/packages/rocketchat-google-vision/package.js @@ -0,0 +1,21 @@ +Package.describe({ + name: 'rocketchat:google-vision', + version: '0.0.1', + summary: 'Rocket.Chat Google Vision Integration', + git: '' +}); + +Npm.depends({ + '@google-cloud/storage': '0.7.0', + '@google-cloud/vision': '0.9.0' +}); + +Package.onUse(function(api) { + api.use([ + 'ecmascript', + 'less', + 'rocketchat:lib' + ]); + + api.addFiles(['server/settings.js', 'server/googlevision.js'], 'server'); +}); diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js new file mode 100644 index 00000000000..067a1b67fba --- /dev/null +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -0,0 +1,38 @@ +class GoogleVision { + constructor() { + this.enabled = RocketChat.settings.get('GoogleVision_Enable'); + this.serviceAccount = {}; + RocketChat.settings.get('GoogleVision_Enable', (key, value) => { + this.enabled = value; + }); + RocketChat.settings.get('GoogleVision_ServiceAccount', (key, value) => { + try { + this.serviceAccount = JSON.parse(value); + } catch (e) { + this.serviceAccount = {}; + } + }); + RocketChat.callbacks.add('afterFileUpload', this.annotate.bind(this)); + } + + annotate({ message }) { + if (this.enabled && this.serviceAccount && message.file && message.file._id) { + const file = RocketChat.models.Uploads.findOne({ _id: message.file._id }); + if (file && file.store === 'googleCloudStorage' && file.googleCloudStorage) { + const storage = Npm.require('@google-cloud/storage'); + const vision = Npm.require('@google-cloud/vision'); + const storageClient = storage({ credentials: this.serviceAccount }); + const visionClient = vision({ credentials: this.serviceAccount }); + const bucket = storageClient.bucket(file.googleCloudStorage.bucket); + const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); + const results = Meteor.wrapAsync(visionClient.detectLabels, visionClient)(bucketFile); + if (results) { + // use message.file._id and message.file.name to update attachment where elemMatch image_url /file-upload/_id/name + RocketChat.models.Messages.update({ _id: message._id }, { $set: { 'attachments.0.labels': results } }); + } + } + } + } +} + +RocketChat.GoogleVision = new GoogleVision; diff --git a/packages/rocketchat-google-vision/server/settings.js b/packages/rocketchat-google-vision/server/settings.js new file mode 100644 index 00000000000..72ee608ad4d --- /dev/null +++ b/packages/rocketchat-google-vision/server/settings.js @@ -0,0 +1,5 @@ +Meteor.startup(function() { + RocketChat.settings.add('GoogleVision_Enable', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'FileUpload_Storage_Type', value: 'GoogleCloudStorage' } }); + RocketChat.settings.add('GoogleVision_ServiceAccount', '', { type: 'string', group: 'FileUpload', section: 'Google Vision', multiline: true, enableQuery: { _id: 'GoogleVision_Enable', value: true } }); +}); + diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 733b6dfa4ae..f1bc6d9464a 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -611,6 +611,9 @@ "Give_a_unique_name_for_the_custom_oauth": "Give a unique name for the custom oauth", "Give_the_application_a_name_This_will_be_seen_by_your_users": "Give the application a name. This will be seen by your users.", "Global": "Global", + "GoogleVision_Enable": "Enable Google Vision", + "GoogleVision_ServiceAccount": "Google Vision Service Account", + "GoogleVision_ServiceAccount_Description": "Create a server key (JSON format) and paste the JSON content here", "GoogleCloudStorage": "Google Cloud Storage", "GoogleTagManager_id": "Google Tag Manager Id", "Guest_Pool": "Guest Pool", From dd7f82b8fae4b85466b98165ea6983b0afd29b49 Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Wed, 8 Mar 2017 19:52:41 -0300 Subject: [PATCH 005/349] add labels to images --- .../client/messageAttachment.html | 7 +++++++ .../rocketchat-theme/client/imports/base.less | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.html b/packages/rocketchat-message-attachments/client/messageAttachment.html index 5bc82373fe9..1428b500fb6 100644 --- a/packages/rocketchat-message-attachments/client/messageAttachment.html +++ b/packages/rocketchat-message-attachments/client/messageAttachment.html @@ -69,6 +69,13 @@
+ {{#if labels}} +
+ {{#each labels}} + {{.}} + {{/each}} +
+ {{/if}} {{#if description}}
{{description}}
{{/if}} diff --git a/packages/rocketchat-theme/client/imports/base.less b/packages/rocketchat-theme/client/imports/base.less index 43c592daf01..d48867ed40f 100644 --- a/packages/rocketchat-theme/client/imports/base.less +++ b/packages/rocketchat-theme/client/imports/base.less @@ -3019,6 +3019,24 @@ label.required::after { } } +.image-labels { + margin: 5px 0 25px; + display: flex; + flex-wrap: wrap; +} + +.image-label { + padding: 9px 4px; + border-radius: 2px; + font-size: 12px; + margin-right: 5px; + margin-top: 5px; + + &:last-child { + margin-right: 0; + } +} + .attachment-description { margin-top: 10px; line-height: 1; From e0bfc7545745b1702248fca426a12ed23b636d0f Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Thu, 9 Mar 2017 18:24:57 -0300 Subject: [PATCH 006/349] Add detection options and block adult images --- .../.npm/package/npm-shrinkwrap.json | 33 +++++-- .../client/googlevision.js | 92 +++++++++++++++++++ packages/rocketchat-google-vision/package.js | 1 + .../server/googlevision.js | 47 ++++++++-- .../server/settings.js | 11 ++- packages/rocketchat-i18n/i18n/en.i18n.json | 9 ++ .../client/messageAttachment.html | 2 +- 7 files changed, 177 insertions(+), 18 deletions(-) create mode 100644 packages/rocketchat-google-vision/client/googlevision.js diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json index c431dfc4596..5a2eeeae440 100644 --- a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -422,6 +422,11 @@ "version": "2.74.0", "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", "from": "request@>=2.74.0 <2.75.0" + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "from": "tunnel-agent@>=0.4.1 <0.5.0" } } }, @@ -1265,7 +1270,7 @@ "har-validator": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "from": "har-validator@>=4.2.0 <4.3.0" + "from": "har-validator@>=4.2.1 <4.3.0" }, "has-ansi": { "version": "2.0.0", @@ -1638,9 +1643,9 @@ "from": "punycode@>=1.4.1 <2.0.0" }, "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "from": "qs@>=6.3.0 <6.4.0" + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "from": "qs@>=6.4.0 <6.5.0" }, "readable-stream": { "version": "2.2.3", @@ -1653,8 +1658,8 @@ "from": "repeating@>=1.1.0 <2.0.0" }, "request": { - "version": "2.80.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.80.0.tgz", + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", "from": "request@>=2.79.0 <3.0.0" }, "retry-request": { @@ -1677,10 +1682,20 @@ "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", "from": "node-uuid@~1.4.7" }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "from": "qs@>=6.3.0 <6.4.0" + }, "request": { "version": "2.76.0", "resolved": "https://registry.npmjs.org/request/-/request-2.76.0.tgz", "from": "request@2.76.0" + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "from": "tunnel-agent@>=0.4.1 <0.5.0" } } }, @@ -1789,9 +1804,9 @@ "from": "tough-cookie@>=2.3.0 <2.4.0" }, "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "from": "tunnel-agent@>=0.4.1 <0.5.0" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "from": "tunnel-agent@>=0.6.0 <0.7.0" }, "tweetnacl": { "version": "0.14.5", diff --git a/packages/rocketchat-google-vision/client/googlevision.js b/packages/rocketchat-google-vision/client/googlevision.js new file mode 100644 index 00000000000..2440adde772 --- /dev/null +++ b/packages/rocketchat-google-vision/client/googlevision.js @@ -0,0 +1,92 @@ +RocketChat.GoogleVision = { + getVisionAttributes(googleVision) { + const attributes = {}; + const labels = []; + if (googleVision.labels && googleVision.labels.length > 0) { + googleVision.labels.forEach(label => { + labels.push({ label }); + }); + } + if (googleVision.safeSearch && googleVision.safeSearch.adult === true) { + if (RocketChat.settings.get('GoogleVision_Block_Adult_Images')) { + attributes.title_link = attributes.image_url = 'http://farm3.static.flickr.com/2726/4156187118_79cf2afb81_o.jpg'; + } + labels.push({ label: 'NSFW', bgColor: 'red', fontColor: 'white' }); + } + if (googleVision.safeSearch && googleVision.safeSearch.violence === true) { + labels.push({ label: 'Violence', bgColor: 'red', fontColor: 'white' }); + } + if (googleVision.properties && googleVision.properties.colors && googleVision.properties.colors.length > 0) { + attributes.color = '#' + googleVision.properties.colors[0]; + } + if (googleVision.logos && googleVision.logos.length > 0) { + labels.push({ label: `Logo: ${googleVision.logos[0]}` }); + } + if (googleVision.faces && googleVision.faces.length > 0) { + let faceCount = 0; + googleVision.faces.forEach(face => { + const faceAttributes = []; + if (face.joy) { + faceAttributes.push('Joy'); + } + if (face.sorrow) { + faceAttributes.push('Sorrow'); + } + if (face.anger) { + faceAttributes.push('Anger'); + } + if (face.surprise) { + faceAttributes.push('Surprise'); + } + if (faceAttributes.length > 0) { + labels.push({ label: `Face ${++faceCount}: ${faceAttributes.join(', ')}` }); + } + }); + } + if (labels.length > 0) { + attributes.labels = labels; + } + return attributes; + }, + + init() { + Tracker.autorun(() => { + if (RocketChat.settings.get('GoogleVision_Enable')) { + RocketChat.callbacks.add('renderMessage', (message) => { + if (message.attachments && message.attachments.length > 0) { + for (const index in message.attachments) { + if (message.attachments.hasOwnProperty(index)) { + const attachment = message.attachments[index]; + if (attachment.googleVision) { + message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment.googleVision)); + } + } + } + } + return message; + }, RocketChat.callbacks.priority.HIGH - 3, 'googlevision'); + + RocketChat.callbacks.add('streamMessage', (message) => { + if (message.attachments && message.attachments.length > 0) { + for (const index in message.attachments) { + if (message.attachments.hasOwnProperty(index)) { + const attachment = message.attachments[index]; + if (attachment.googleVision) { + message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment.googleVision)); + } + } + } + } + RocketChat.models.Message.update({ _id: message._id }, { $set: { attachments: message.attachments } }); + }, RocketChat.callbacks.priority.HIGH - 3, 'googlevision-stream'); + } else { + RocketChat.callbacks.remove('renderMessage', 'googlevision'); + RocketChat.callbacks.remove('streamMessage', 'googlevision-stream'); + } + }); + } +}; + +Meteor.startup(function() { + RocketChat.GoogleVision.init(); +}); diff --git a/packages/rocketchat-google-vision/package.js b/packages/rocketchat-google-vision/package.js index fcc5fa67427..68752084ce2 100644 --- a/packages/rocketchat-google-vision/package.js +++ b/packages/rocketchat-google-vision/package.js @@ -17,5 +17,6 @@ Package.onUse(function(api) { 'rocketchat:lib' ]); + api.addFiles('client/googlevision.js', 'client'); api.addFiles(['server/settings.js', 'server/googlevision.js'], 'server'); }); diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index 067a1b67fba..1c0de000a15 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -16,20 +16,53 @@ class GoogleVision { } annotate({ message }) { - if (this.enabled && this.serviceAccount && message.file && message.file._id) { + const visionTypes = []; + if (RocketChat.settings.get('GoogleVision_Type_Document')) { + visionTypes.push('document'); + } + if (RocketChat.settings.get('GoogleVision_Type_Faces')) { + visionTypes.push('faces'); + } + if (RocketChat.settings.get('GoogleVision_Type_Landmarks')) { + visionTypes.push('landmarks'); + } + if (RocketChat.settings.get('GoogleVision_Type_Labels')) { + visionTypes.push('labels'); + } + if (RocketChat.settings.get('GoogleVision_Type_Logos')) { + visionTypes.push('logos'); + } + if (RocketChat.settings.get('GoogleVision_Type_Properties')) { + visionTypes.push('properties'); + } + if (RocketChat.settings.get('GoogleVision_Type_SafeSearch')) { + visionTypes.push('safeSearch'); + } + if (RocketChat.settings.get('GoogleVision_Type_Similar')) { + visionTypes.push('similar'); + } + if (this.enabled && this.serviceAccount && visionTypes.length > 0 && message.file && message.file._id) { const file = RocketChat.models.Uploads.findOne({ _id: message.file._id }); - if (file && file.store === 'googleCloudStorage' && file.googleCloudStorage) { + if (file && file.type && file.type.indexOf('image') !== -1 && file.store === 'googleCloudStorage' && file.googleCloudStorage) { const storage = Npm.require('@google-cloud/storage'); const vision = Npm.require('@google-cloud/vision'); const storageClient = storage({ credentials: this.serviceAccount }); const visionClient = vision({ credentials: this.serviceAccount }); const bucket = storageClient.bucket(file.googleCloudStorage.bucket); const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); - const results = Meteor.wrapAsync(visionClient.detectLabels, visionClient)(bucketFile); - if (results) { - // use message.file._id and message.file.name to update attachment where elemMatch image_url /file-upload/_id/name - RocketChat.models.Messages.update({ _id: message._id }, { $set: { 'attachments.0.labels': results } }); - } + + visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { + if (!error) { + // use message.file._id and message.file.name to update attachment where elemMatch image_url /file-upload/_id/name + if (visionTypes.length === 1) { + const update = {}; + update[`attachments.0.googleVision.${visionTypes[0]}`] = results; + RocketChat.models.Messages.update({ _id: message._id }, { $set: update }); + } else { + RocketChat.models.Messages.update({ _id: message._id }, { $set: { 'attachments.0.googleVision': results } }); + } + } + })); } } } diff --git a/packages/rocketchat-google-vision/server/settings.js b/packages/rocketchat-google-vision/server/settings.js index 72ee608ad4d..b618dbf0c6d 100644 --- a/packages/rocketchat-google-vision/server/settings.js +++ b/packages/rocketchat-google-vision/server/settings.js @@ -1,5 +1,14 @@ Meteor.startup(function() { - RocketChat.settings.add('GoogleVision_Enable', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'FileUpload_Storage_Type', value: 'GoogleCloudStorage' } }); + RocketChat.settings.add('GoogleVision_Enable', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', public: true, enableQuery: { _id: 'FileUpload_Storage_Type', value: 'GoogleCloudStorage' } }); RocketChat.settings.add('GoogleVision_ServiceAccount', '', { type: 'string', group: 'FileUpload', section: 'Google Vision', multiline: true, enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Document', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Faces', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Landmarks', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Labels', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Logos', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_Properties', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Type_SafeSearch', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Block_Adult_Images', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', public: true, enableQuery: [ { _id: 'GoogleVision_Enable', value: true }, { _id: 'GoogleVision_Type_SafeSearch', value: true } ] }); + RocketChat.settings.add('GoogleVision_Type_Similar', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); }); diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index f1bc6d9464a..009329c0275 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -612,8 +612,17 @@ "Give_the_application_a_name_This_will_be_seen_by_your_users": "Give the application a name. This will be seen by your users.", "Global": "Global", "GoogleVision_Enable": "Enable Google Vision", + "GoogleVision_Block_Adult_Images": "Block Adult Images", "GoogleVision_ServiceAccount": "Google Vision Service Account", "GoogleVision_ServiceAccount_Description": "Create a server key (JSON format) and paste the JSON content here", + "GoogleVision_Type_Document": "Document Text Detection", + "GoogleVision_Type_Faces": "Face Detection", + "GoogleVision_Type_Landmarks": "Landmarks Detection", + "GoogleVision_Type_Labels": "Labels Detection", + "GoogleVision_Type_Logos": "Logos Detection", + "GoogleVision_Type_Properties": "Properties (color) Detection", + "GoogleVision_Type_SafeSearch": "SafeSearch Detection", + "GoogleVision_Type_Similar": "Search Similar Images", "GoogleCloudStorage": "Google Cloud Storage", "GoogleTagManager_id": "Google Tag Manager Id", "Guest_Pool": "Guest Pool", diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.html b/packages/rocketchat-message-attachments/client/messageAttachment.html index 1428b500fb6..61b75c45a1b 100644 --- a/packages/rocketchat-message-attachments/client/messageAttachment.html +++ b/packages/rocketchat-message-attachments/client/messageAttachment.html @@ -72,7 +72,7 @@ {{#if labels}}
{{#each labels}} - {{.}} + {{label}} {{/each}}
{{/if}} From ec015fd5c4108e0ebbfd1783194edcb7d180ecc3 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Fri, 10 Mar 2017 17:41:14 -0300 Subject: [PATCH 007/349] Add block adult images and monthly usage limit --- .../.npm/package/npm-shrinkwrap.json | 4 +- .../client/googlevision.js | 3 - packages/rocketchat-google-vision/package.js | 2 +- .../server/googlevision.js | 87 ++++++++++++---- .../server/models/Messages.js | 10 ++ .../server/settings.js | 98 ++++++++++++++++--- packages/rocketchat-i18n/i18n/en.i18n.json | 6 ++ packages/rocketchat-lib/lib/callbacks.coffee | 15 ++- .../server/functions/sendMessage.coffee | 47 ++++----- .../server/functions/settings.coffee | 2 +- 10 files changed, 213 insertions(+), 61 deletions(-) create mode 100644 packages/rocketchat-google-vision/server/models/Messages.js diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json index 5a2eeeae440..b7247270c7e 100644 --- a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -1619,8 +1619,8 @@ "from": "pump@>=1.0.0 <2.0.0", "dependencies": { "end-of-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.1.0.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.2.0.tgz", "from": "end-of-stream@>=1.1.0 <2.0.0", "dependencies": { "once": { diff --git a/packages/rocketchat-google-vision/client/googlevision.js b/packages/rocketchat-google-vision/client/googlevision.js index 2440adde772..ead199d9d1a 100644 --- a/packages/rocketchat-google-vision/client/googlevision.js +++ b/packages/rocketchat-google-vision/client/googlevision.js @@ -8,9 +8,6 @@ RocketChat.GoogleVision = { }); } if (googleVision.safeSearch && googleVision.safeSearch.adult === true) { - if (RocketChat.settings.get('GoogleVision_Block_Adult_Images')) { - attributes.title_link = attributes.image_url = 'http://farm3.static.flickr.com/2726/4156187118_79cf2afb81_o.jpg'; - } labels.push({ label: 'NSFW', bgColor: 'red', fontColor: 'white' }); } if (googleVision.safeSearch && googleVision.safeSearch.violence === true) { diff --git a/packages/rocketchat-google-vision/package.js b/packages/rocketchat-google-vision/package.js index 68752084ce2..7426b4d12bb 100644 --- a/packages/rocketchat-google-vision/package.js +++ b/packages/rocketchat-google-vision/package.js @@ -18,5 +18,5 @@ Package.onUse(function(api) { ]); api.addFiles('client/googlevision.js', 'client'); - api.addFiles(['server/settings.js', 'server/googlevision.js'], 'server'); + api.addFiles(['server/settings.js', 'server/googlevision.js', 'server/models/Messages.js'], 'server'); }); diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index 1c0de000a15..6b06dde93ee 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -1,5 +1,9 @@ class GoogleVision { constructor() { + this.storage = Npm.require('@google-cloud/storage'); + this.vision = Npm.require('@google-cloud/vision'); + this.storageClient = {}; + this.visionClient = {}; this.enabled = RocketChat.settings.get('GoogleVision_Enable'); this.serviceAccount = {}; RocketChat.settings.get('GoogleVision_Enable', (key, value) => { @@ -8,13 +12,68 @@ class GoogleVision { RocketChat.settings.get('GoogleVision_ServiceAccount', (key, value) => { try { this.serviceAccount = JSON.parse(value); + this.storageClient = this.storage({ credentials: this.serviceAccount }); + this.visionClient = this.vision({ credentials: this.serviceAccount }); } catch (e) { this.serviceAccount = {}; } }); + RocketChat.settings.get('GoogleVision_Block_Adult_Images', (key, value) => { + if (value) { + RocketChat.callbacks.add('beforeSaveMessage', this.blockUnsafeImages.bind(this), RocketChat.callbacks.priority.MEDIUM, 'googlevision-blockunsafe'); + } else { + RocketChat.callbacks.remove('beforeSaveMessage', 'googlevision-blockunsafe'); + } + }); RocketChat.callbacks.add('afterFileUpload', this.annotate.bind(this)); } + incCallCount(count) { + const currentMonth = new Date().getMonth(); + const maxMonthlyCalls = RocketChat.settings.get('GoogleVision_Max_Monthly_Calls') || 0; + if (maxMonthlyCalls > 0) { + if (RocketChat.settings.get('GoogleVision_Current_Month') !== currentMonth) { + RocketChat.settings.set('GoogleVision_Current_Month', currentMonth); + if (count > maxMonthlyCalls) { + return false; + } + } else if (count + (RocketChat.settings.get('GoogleVision_Current_Month_Calls') || 0) > maxMonthlyCalls) { + return false; + } + } + RocketChat.models.Settings.update({ _id: 'GoogleVision_Current_Month_Calls' }, { $inc: { value: count } }); + return true; + } + + blockUnsafeImages(message) { + if (this.enabled && this.serviceAccount && message && message.file && message.file._id) { + const file = RocketChat.models.Uploads.findOne({ _id: message.file._id }); + if (file && file.type && file.type.indexOf('image') !== -1 && file.store === 'googleCloudStorage' && file.googleCloudStorage) { + if (this.incCallCount(1)) { + const bucket = this.storageClient.bucket(file.googleCloudStorage.bucket); + const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); + const results = Meteor.wrapAsync(this.visionClient.detectSafeSearch, this.visionClient)(bucketFile); + if (results && results.adult === true) { + delete message.attachments[0]; + const user = RocketChat.models.Users.findOneById(message.u && message.u._id); + if (user) { + RocketChat.Notifications.notifyUser(user._id, 'message', { + _id: Random.id(), + rid: message.rid, + ts: new Date, + msg: TAPi18n.__('Adult_images_are_not_allowed', {}, user.language) + }); + } + throw new Error('GoogleVisionError: Image blocked'); + } + } else { + console.log('Google Vision: Usage limit exceeded'); + } + return message; + } + } + } + annotate({ message }) { const visionTypes = []; if (RocketChat.settings.get('GoogleVision_Type_Document')) { @@ -44,25 +103,19 @@ class GoogleVision { if (this.enabled && this.serviceAccount && visionTypes.length > 0 && message.file && message.file._id) { const file = RocketChat.models.Uploads.findOne({ _id: message.file._id }); if (file && file.type && file.type.indexOf('image') !== -1 && file.store === 'googleCloudStorage' && file.googleCloudStorage) { - const storage = Npm.require('@google-cloud/storage'); - const vision = Npm.require('@google-cloud/vision'); - const storageClient = storage({ credentials: this.serviceAccount }); - const visionClient = vision({ credentials: this.serviceAccount }); - const bucket = storageClient.bucket(file.googleCloudStorage.bucket); - const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); - - visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { - if (!error) { - // use message.file._id and message.file.name to update attachment where elemMatch image_url /file-upload/_id/name - if (visionTypes.length === 1) { - const update = {}; - update[`attachments.0.googleVision.${visionTypes[0]}`] = results; - RocketChat.models.Messages.update({ _id: message._id }, { $set: update }); + if (this.incCallCount(visionTypes.length)) { + const bucket = this.storageClient.bucket(file.googleCloudStorage.bucket); + const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); + this.visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { + if (!error) { + console.log(RocketChat.models.Messages.setGoogleVision(message._id, results, visionTypes.length === 1 ? visionTypes[0] : undefined)); } else { - RocketChat.models.Messages.update({ _id: message._id }, { $set: { 'attachments.0.googleVision': results } }); + console.trace('GoogleVision error: ', error.stack); } - } - })); + })); + } else { + console.log('Google Vision: Usage limit exceeded'); + } } } } diff --git a/packages/rocketchat-google-vision/server/models/Messages.js b/packages/rocketchat-google-vision/server/models/Messages.js new file mode 100644 index 00000000000..ab199afa1c7 --- /dev/null +++ b/packages/rocketchat-google-vision/server/models/Messages.js @@ -0,0 +1,10 @@ +RocketChat.models.Messages.setGoogleVision = function(messageId, googleVision, visionType) { + const updateObj = {}; + if (visionType) { + updateObj[`attachments.0.googleVision.${visionType}`] = googleVision; + } else { + updateObj['attachments.0.googleVision'] = googleVision; + } + + return this.update({ _id: messageId }, { $set: updateObj }); +}; diff --git a/packages/rocketchat-google-vision/server/settings.js b/packages/rocketchat-google-vision/server/settings.js index b618dbf0c6d..5fe8b46776f 100644 --- a/packages/rocketchat-google-vision/server/settings.js +++ b/packages/rocketchat-google-vision/server/settings.js @@ -1,14 +1,88 @@ Meteor.startup(function() { - RocketChat.settings.add('GoogleVision_Enable', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', public: true, enableQuery: { _id: 'FileUpload_Storage_Type', value: 'GoogleCloudStorage' } }); - RocketChat.settings.add('GoogleVision_ServiceAccount', '', { type: 'string', group: 'FileUpload', section: 'Google Vision', multiline: true, enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Document', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Faces', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Landmarks', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Labels', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Logos', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_Properties', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Type_SafeSearch', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); - RocketChat.settings.add('GoogleVision_Block_Adult_Images', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', public: true, enableQuery: [ { _id: 'GoogleVision_Enable', value: true }, { _id: 'GoogleVision_Type_SafeSearch', value: true } ] }); - RocketChat.settings.add('GoogleVision_Type_Similar', false, { type: 'boolean', group: 'FileUpload', section: 'Google Vision', enableQuery: { _id: 'GoogleVision_Enable', value: true } }); + RocketChat.settings.add('GoogleVision_Enable', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + public: true, + enableQuery: { _id: 'FileUpload_Storage_Type', value: 'GoogleCloudStorage' } + }); + RocketChat.settings.add('GoogleVision_ServiceAccount', '', { + type: 'string', + group: 'FileUpload', + section: 'Google Vision', + multiline: true, + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Max_Monthly_Calls', 0, { + type: 'int', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Current_Month', 0, { + type: 'int', + group: 'FileUpload', + section: 'Google Vision', + hidden: true + }); + RocketChat.settings.add('GoogleVision_Current_Month_Calls', 0, { + type: 'int', + group: 'FileUpload', + section: 'Google Vision', + blocked: true + }); + RocketChat.settings.add('GoogleVision_Type_Document', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_Faces', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_Landmarks', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_Labels', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_Logos', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_Properties', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Type_SafeSearch', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); + RocketChat.settings.add('GoogleVision_Block_Adult_Images', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: [{ _id: 'GoogleVision_Enable', value: true }, { _id: 'GoogleVision_Type_SafeSearch', value: true }] + }); + RocketChat.settings.add('GoogleVision_Type_Similar', false, { + type: 'boolean', + group: 'FileUpload', + section: 'Google Vision', + enableQuery: { _id: 'GoogleVision_Enable', value: true } + }); }); - diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 009329c0275..762255c912f 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -137,6 +137,7 @@ "Additional_emails": "Additional Emails", "Additional_Feedback": "Additional Feedback", "Administration": "Administration", + "Adult_images_are_not_allowed": "Adult images are not allowed", "After_OAuth2_authentication_users_will_be_redirected_to_this_URL": "After OAuth2 authentication, users will be redirected to this URL", "Agent": "Agent", "Agent_added": "Agent added", @@ -611,8 +612,13 @@ "Give_a_unique_name_for_the_custom_oauth": "Give a unique name for the custom oauth", "Give_the_application_a_name_This_will_be_seen_by_your_users": "Give the application a name. This will be seen by your users.", "Global": "Global", + "Google_Vision_usage_limit_exceeded": "Google Vision usage limit exceeded", "GoogleVision_Enable": "Enable Google Vision", "GoogleVision_Block_Adult_Images": "Block Adult Images", + "GoogleVision_Block_Adult_Images_Description": "Blocking adult images will not work once the monthly limit has been reached", + "GoogleVision_Current_Month_Calls": "Current Month Calls", + "GoogleVision_Max_Monthly_Calls": "Max Monthly Calls", + "GoogleVision_Max_Monthly_Calls_Description": "Use 0 for unlimited", "GoogleVision_ServiceAccount": "Google Vision Service Account", "GoogleVision_ServiceAccount_Description": "Create a server key (JSON format) and paste the JSON content here", "GoogleVision_Type_Document": "Document Text Detection", diff --git a/packages/rocketchat-lib/lib/callbacks.coffee b/packages/rocketchat-lib/lib/callbacks.coffee index d0e3feb8ff3..f71c8972996 100644 --- a/packages/rocketchat-lib/lib/callbacks.coffee +++ b/packages/rocketchat-lib/lib/callbacks.coffee @@ -26,13 +26,14 @@ RocketChat.callbacks.priority = # @param {String} hook - The name of the hook # @param {Function} callback - The callback function ### -RocketChat.callbacks.add = (hook, callback, priority, id) -> +RocketChat.callbacks.add = (hook, callback, priority, id, errorHandler) -> # if callback array doesn't exist yet, initialize it priority ?= RocketChat.callbacks.priority.MEDIUM unless _.isNumber priority priority = RocketChat.callbacks.priority.MEDIUM callback.priority = priority callback.id = id or Random.id() + callback.errorHandler = errorHandler RocketChat.callbacks[hook] ?= [] if RocketChat.callbacks.showTime is true @@ -77,11 +78,21 @@ RocketChat.callbacks.run = (hook, item, constant) -> # if the hook exists, and contains callbacks to run result = _.sortBy(callbacks, (callback) -> return callback.priority or RocketChat.callbacks.priority.MEDIUM).reduce (result, callback) -> + + # if previous callbacks throw an error, skip is set to true + return if skip + # console.log(callback.name); if RocketChat.callbacks.showTime is true or RocketChat.callbacks.showTotalTime is true time = Date.now() - callbackResult = callback result, constant + try + callbackResult = callback result, constant + catch error + if callback.errorHandler + callback.errorHandler(error) + skip = true + return if RocketChat.callbacks.showTime is true or RocketChat.callbacks.showTotalTime is true currentTime = Date.now() - time diff --git a/packages/rocketchat-lib/server/functions/sendMessage.coffee b/packages/rocketchat-lib/server/functions/sendMessage.coffee index bdce87faba4..ecc85753456 100644 --- a/packages/rocketchat-lib/server/functions/sendMessage.coffee +++ b/packages/rocketchat-lib/server/functions/sendMessage.coffee @@ -24,27 +24,28 @@ RocketChat.sendMessage = (user, message, room, upsert = false) -> message.urls = urls.map (url) -> url: url message = RocketChat.callbacks.run 'beforeSaveMessage', message + if message + + # Avoid saving sandstormSessionId to the database + sandstormSessionId = null + if message.sandstormSessionId + sandstormSessionId = message.sandstormSessionId + delete message.sandstormSessionId + + if message._id? and upsert + _id = message._id + delete message._id + RocketChat.models.Messages.upsert {_id: _id, 'u._id': message.u._id}, message + message._id = _id + else + message._id = RocketChat.models.Messages.insert message + + ### + Defer other updates as their return is not interesting to the user + ### + Meteor.defer -> + # Execute all callbacks + message.sandstormSessionId = sandstormSessionId + RocketChat.callbacks.run 'afterSaveMessage', message, room - # Avoid saving sandstormSessionId to the database - sandstormSessionId = null - if message.sandstormSessionId - sandstormSessionId = message.sandstormSessionId - delete message.sandstormSessionId - - if message._id? and upsert - _id = message._id - delete message._id - RocketChat.models.Messages.upsert {_id: _id, 'u._id': message.u._id}, message - message._id = _id - else - message._id = RocketChat.models.Messages.insert message - - ### - Defer other updates as their return is not interesting to the user - ### - Meteor.defer -> - # Execute all callbacks - message.sandstormSessionId = sandstormSessionId - RocketChat.callbacks.run 'afterSaveMessage', message, room - - return message + return message diff --git a/packages/rocketchat-lib/server/functions/settings.coffee b/packages/rocketchat-lib/server/functions/settings.coffee index f8348261c5f..48c912f4ff5 100644 --- a/packages/rocketchat-lib/server/functions/settings.coffee +++ b/packages/rocketchat-lib/server/functions/settings.coffee @@ -24,7 +24,7 @@ RocketChat.settings.add = (_id, value, options = {}) -> options.packageValue = value options.valueSource = 'packageValue' - options.hidden = false + options.hidden = options.hidden || false options.blocked = options.blocked || false options.sorter ?= RocketChat.settings._sorter[options.group]++ From 3c3be3bc1ff7b4d86c7e12e70a14b86e15d60189 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Mon, 20 Mar 2017 15:29:28 -0300 Subject: [PATCH 008/349] Save attributes in attachments --- .../.npm/package/npm-shrinkwrap.json | 268 ++++++++++-------- .../client/googlevision.js | 30 +- .../server/googlevision.js | 28 +- .../server/models/Messages.js | 10 +- server/methods/messageSearch.js | 7 + 5 files changed, 194 insertions(+), 149 deletions(-) diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json index b7247270c7e..b335c8d2cbc 100644 --- a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -1,8 +1,8 @@ { "dependencies": { "ajv": { - "version": "4.11.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.4.tgz", + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.5.tgz", "from": "ajv@>=4.9.1 <5.0.0" }, "ansi-regex": { @@ -71,26 +71,9 @@ "from": "balanced-match@>=0.4.1 <0.5.0" }, "base64url": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-1.0.6.tgz", - "from": "base64url@>=1.0.4 <1.1.0", - "dependencies": { - "concat-stream": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.10.tgz", - "from": "concat-stream@>=1.4.7 <1.5.0" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "from": "isarray@0.0.1" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "from": "readable-stream@>=1.1.9 <1.2.0" - } - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", + "from": "base64url@>=2.0.0 <3.0.0" }, "bcrypt-pbkdf": { "version": "1.0.1", @@ -127,7 +110,7 @@ "buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "from": "buffer-equal-constant-time@>=1.0.1 <2.0.0" + "from": "buffer-equal-constant-time@1.0.1" }, "buffer-shims": { "version": "1.0.0", @@ -276,14 +259,7 @@ "ecdsa-sig-formatter": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", - "from": "ecdsa-sig-formatter@>=1.0.0 <2.0.0", - "dependencies": { - "base64url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", - "from": "base64url@>=2.0.0 <3.0.0" - } - } + "from": "ecdsa-sig-formatter@1.0.9" }, "end-of-stream": { "version": "1.0.0", @@ -336,61 +312,27 @@ "version": "0.7.4", "resolved": "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-0.7.4.tgz", "from": "gcs-resumable-upload@>=0.7.1 <0.8.0", - "dependencies": { - "google-auto-auth": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.2.4.tgz", - "from": "google-auto-auth@>=0.2.1 <0.3.0" - } - } - }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "from": "generate-function@>=2.0.0 <3.0.0" - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "from": "generate-object-property@>=1.1.0 <2.0.0" - }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "from": "get-stdin@>=4.0.1 <5.0.0" - }, - "getpass": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", - "from": "getpass@>=0.1.1 <0.2.0", - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "from": "assert-plus@>=1.0.0 <2.0.0" - } - } - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "from": "glob@>=7.0.5 <8.0.0" - }, - "google-auth-library": { - "version": "0.9.10", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.9.10.tgz", - "from": "google-auth-library@>=0.9.10 <0.10.0", "dependencies": { "async": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/async/-/async-1.4.2.tgz", "from": "async@>=1.4.2 <1.5.0" }, + "base64url": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-1.0.6.tgz", + "from": "base64url@>=1.0.4 <1.1.0" + }, "caseless": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", "from": "caseless@>=0.11.0 <0.12.0" }, + "concat-stream": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.10.tgz", + "from": "concat-stream@>=1.4.7 <1.5.0" + }, "form-data": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", @@ -403,25 +345,64 @@ } } }, + "google-auth-library": { + "version": "0.9.10", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.9.10.tgz", + "from": "google-auth-library@>=0.9.6 <0.10.0", + "dependencies": { + "request": { + "version": "2.74.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", + "from": "request@>=2.74.0 <2.75.0" + } + } + }, + "google-auto-auth": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.2.4.tgz", + "from": "google-auto-auth@>=0.2.1 <0.3.0" + }, "har-validator": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", "from": "har-validator@>=2.0.6 <2.1.0" }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "from": "isarray@0.0.1" + }, + "jwa": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.0.2.tgz", + "from": "jwa@>=1.0.0 <1.1.0", + "dependencies": { + "base64url": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-0.0.6.tgz", + "from": "base64url@>=0.0.4 <0.1.0" + } + } + }, + "jws": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.0.0.tgz", + "from": "jws@>=3.0.0 <3.1.0" + }, "node-uuid": { "version": "1.4.7", "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", - "from": "node-uuid@>=1.4.7 <1.5.0" + "from": "node-uuid@~1.4.7" }, "qs": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", "from": "qs@>=6.2.0 <6.3.0" }, - "request": { - "version": "2.74.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", - "from": "request@>=2.74.0 <2.75.0" + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "from": "readable-stream@>=1.1.9 <1.2.0" }, "tunnel-agent": { "version": "0.4.3", @@ -430,9 +411,46 @@ } } }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "from": "generate-function@>=2.0.0 <3.0.0" + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "from": "generate-object-property@>=1.1.0 <2.0.0" + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "from": "get-stdin@>=4.0.1 <5.0.0" + }, + "getpass": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", + "from": "getpass@>=0.1.1 <0.2.0", + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@>=1.0.0 <2.0.0" + } + } + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "from": "glob@>=7.0.5 <8.0.0" + }, + "google-auth-library": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.10.0.tgz", + "from": "google-auth-library@>=0.10.0 <0.11.0" + }, "google-auto-auth": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.5.2.tgz", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.5.4.tgz", "from": "google-auto-auth@>=0.5.2 <0.6.0" }, "google-gax": { @@ -1258,9 +1276,9 @@ } }, "gtoken": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.1.tgz", - "from": "gtoken@>=1.1.0 <2.0.0" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.2.tgz", + "from": "gtoken@>=1.2.1 <2.0.0" }, "har-schema": { "version": "1.0.5", @@ -1305,7 +1323,14 @@ "indent-string": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-1.2.2.tgz", - "from": "indent-string@>=1.1.0 <2.0.0" + "from": "indent-string@>=1.1.0 <2.0.0", + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "from": "minimist@>=1.1.0 <2.0.0" + } + } }, "inflight": { "version": "1.0.6", @@ -1408,26 +1433,26 @@ "from": "jsonpointer@>=4.0.0 <5.0.0" }, "jsprim": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz", - "from": "jsprim@>=1.2.2 <2.0.0" - }, - "jwa": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.0.2.tgz", - "from": "jwa@>=1.0.0 <1.1.0", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", + "from": "jsprim@>=1.2.2 <2.0.0", "dependencies": { - "base64url": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-0.0.6.tgz", - "from": "base64url@>=0.0.4 <0.1.0" + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@1.0.0" } } }, + "jwa": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz", + "from": "jwa@>=1.1.4 <2.0.0" + }, "jws": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.0.0.tgz", - "from": "jws@>=3.0.0 <3.1.0" + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz", + "from": "jws@>=3.1.4 <4.0.0" }, "lcid": { "version": "1.0.0", @@ -1442,7 +1467,7 @@ "lodash.noop": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash.noop/-/lodash.noop-3.0.1.tgz", - "from": "lodash.noop@>=3.0.0 <3.1.0" + "from": "lodash.noop@>=3.0.1 <4.0.0" }, "log-driver": { "version": "1.2.5", @@ -1464,6 +1489,11 @@ "resolved": "https://registry.npmjs.org/meow/-/meow-2.0.0.tgz", "from": "meow@>=2.0.0 <2.1.0", "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "from": "minimist@>=1.1.0 <2.0.0" + }, "object-assign": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-1.0.0.tgz", @@ -1497,21 +1527,14 @@ "from": "minimatch@>=3.0.2 <4.0.0" }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "from": "minimist@>=1.1.0 <2.0.0" + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "from": "minimist@0.0.8" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "from": "mkdirp@>=0.5.0 <0.6.0", - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "from": "minimist@0.0.8" - } - } + "from": "mkdirp@>=0.5.0 <0.6.0" }, "modelo": { "version": "4.2.0", @@ -1619,16 +1642,9 @@ "from": "pump@>=1.0.0 <2.0.0", "dependencies": { "end-of-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.2.0.tgz", - "from": "end-of-stream@>=1.1.0 <2.0.0", - "dependencies": { - "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "from": "once@>=1.3.0 <1.4.0" - } - } + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "from": "end-of-stream@>=1.1.0 <2.0.0" } } }, @@ -1648,8 +1664,8 @@ "from": "qs@>=6.4.0 <6.5.0" }, "readable-stream": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.3.tgz", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", "from": "readable-stream@>=2.2.2 <3.0.0" }, "repeating": { @@ -1680,7 +1696,7 @@ "node-uuid": { "version": "1.4.7", "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", - "from": "node-uuid@~1.4.7" + "from": "node-uuid@>=1.4.7 <1.5.0" }, "qs": { "version": "6.3.2", diff --git a/packages/rocketchat-google-vision/client/googlevision.js b/packages/rocketchat-google-vision/client/googlevision.js index ead199d9d1a..b61a7dfc9d3 100644 --- a/packages/rocketchat-google-vision/client/googlevision.js +++ b/packages/rocketchat-google-vision/client/googlevision.js @@ -1,27 +1,27 @@ RocketChat.GoogleVision = { - getVisionAttributes(googleVision) { + getVisionAttributes(attachment) { const attributes = {}; const labels = []; - if (googleVision.labels && googleVision.labels.length > 0) { - googleVision.labels.forEach(label => { + if (attachment.labels && attachment.labels.length > 0) { + attachment.labels.forEach(label => { labels.push({ label }); }); } - if (googleVision.safeSearch && googleVision.safeSearch.adult === true) { + if (attachment.safeSearch && attachment.safeSearch[0] && attachment.safeSearch[0].adult === true) { labels.push({ label: 'NSFW', bgColor: 'red', fontColor: 'white' }); } - if (googleVision.safeSearch && googleVision.safeSearch.violence === true) { + if (attachment.safeSearch && attachment.safeSearch.violence === true) { labels.push({ label: 'Violence', bgColor: 'red', fontColor: 'white' }); } - if (googleVision.properties && googleVision.properties.colors && googleVision.properties.colors.length > 0) { - attributes.color = '#' + googleVision.properties.colors[0]; + if (attachment.colors && attachment.colors.length > 0) { + attributes.color = '#' + attachment.colors[0]; } - if (googleVision.logos && googleVision.logos.length > 0) { - labels.push({ label: `Logo: ${googleVision.logos[0]}` }); + if (attachment.logos && attachment.logos.length > 0) { + labels.push({ label: `Logo: ${attachment.logos[0]}` }); } - if (googleVision.faces && googleVision.faces.length > 0) { + if (attachment.faces && attachment.faces.length > 0) { let faceCount = 0; - googleVision.faces.forEach(face => { + attachment.faces.forEach(face => { const faceAttributes = []; if (face.joy) { faceAttributes.push('Joy'); @@ -54,9 +54,7 @@ RocketChat.GoogleVision = { for (const index in message.attachments) { if (message.attachments.hasOwnProperty(index)) { const attachment = message.attachments[index]; - if (attachment.googleVision) { - message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment.googleVision)); - } + message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment)); } } } @@ -68,9 +66,7 @@ RocketChat.GoogleVision = { for (const index in message.attachments) { if (message.attachments.hasOwnProperty(index)) { const attachment = message.attachments[index]; - if (attachment.googleVision) { - message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment.googleVision)); - } + message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment)); } } } diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index 6b06dde93ee..fdd02b05d6c 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -108,7 +108,7 @@ class GoogleVision { const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); this.visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { if (!error) { - console.log(RocketChat.models.Messages.setGoogleVision(message._id, results, visionTypes.length === 1 ? visionTypes[0] : undefined)); + console.log(RocketChat.models.Messages.setGoogleVisionData(message._id, this.getAnnotations(visionTypes, results))); } else { console.trace('GoogleVision error: ', error.stack); } @@ -119,6 +119,32 @@ class GoogleVision { } } } + + getAnnotations(visionTypes, visionData) { + if (visionTypes.length === 1) { + visionData = {}; + visionData[`${visionTypes[0]}`] = visionData; + } + const results = {}; + for (const index in visionData) { + if (visionData.hasOwnProperty(index)) { + switch (index) { + case 'faces': + case 'landmarks': + case 'labels': + case 'safeSearch': + case 'similar': + case 'logos': + results[index] = (results[index] || []).concat(visionData[index] || []); + break; + case 'properties': + results['colors'] = visionData[index]['colors']; + break; + } + } + } + return results; + } } RocketChat.GoogleVision = new GoogleVision; diff --git a/packages/rocketchat-google-vision/server/models/Messages.js b/packages/rocketchat-google-vision/server/models/Messages.js index ab199afa1c7..4dc23094183 100644 --- a/packages/rocketchat-google-vision/server/models/Messages.js +++ b/packages/rocketchat-google-vision/server/models/Messages.js @@ -1,9 +1,9 @@ -RocketChat.models.Messages.setGoogleVision = function(messageId, googleVision, visionType) { +RocketChat.models.Messages.setGoogleVisionData = function(messageId, visionData) { const updateObj = {}; - if (visionType) { - updateObj[`attachments.0.googleVision.${visionType}`] = googleVision; - } else { - updateObj['attachments.0.googleVision'] = googleVision; + for (const index in visionData) { + if (visionData.hasOwnProperty(index)) { + updateObj[`attachments.0.${index}`] = visionData[index]; + } } return this.update({ _id: messageId }, { $set: updateObj }); diff --git a/server/methods/messageSearch.js b/server/methods/messageSearch.js index 4cea4d84126..ee73493b5d7 100644 --- a/server/methods/messageSearch.js +++ b/server/methods/messageSearch.js @@ -80,6 +80,11 @@ Meteor.methods({ return ''; } + function filterLabel(_, tag) { + query['attachments.0.labels'] = new RegExp(s.escapeRegExp(tag), 'i'); + return ''; + } + function sortByTimestamp(_, direction) { if (direction.startsWith('asc')) { options.sort.ts = 1; @@ -140,6 +145,8 @@ Meteor.methods({ text = text.replace(/is:pinned|has:pin/g, filterPinned); // Filter on messages which have a location attached. text = text.replace(/has:location|has:map/g, filterLocation); + // Filter image tags + text = text.replace(/label:(\w+)/g, filterLabel); // Filtering before/after/on a date // matches dd-MM-yyyy, dd/MM/yyyy, dd-MM-yyyy, prefixed by before:, after: and on: respectively. // Example: before:15/09/2016 after: 10-08-2016 From bbf59aed3c9ea6841881e577df62dab8cb024f1b Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Tue, 21 Mar 2017 11:05:33 -0300 Subject: [PATCH 009/349] Fix safesearch and single type requests --- .../.npm/package/npm-shrinkwrap.json | 285 ++++++++---------- .../server/googlevision.js | 10 +- 2 files changed, 127 insertions(+), 168 deletions(-) diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json index b335c8d2cbc..7893432afa3 100644 --- a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -486,14 +486,14 @@ "from": "graceful-readlink@>=1.0.0" }, "grpc": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.1.2.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.2.0.tgz", "from": "grpc@>=1.1.1 <2.0.0", "dependencies": { "node-pre-gyp": { - "version": "0.6.33", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.33.tgz", - "from": "node-pre-gyp@0.6.33", + "version": "0.6.34", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.34.tgz", + "from": "node-pre-gyp@0.6.34", "dependencies": { "mkdirp": { "version": "0.5.1", @@ -508,21 +508,38 @@ } }, "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "from": "nopt@>=3.0.6 <3.1.0", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "from": "nopt@>=4.0.1 <5.0.0", "dependencies": { "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", "from": "abbrev@>=1.0.0 <2.0.0" + }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "from": "osenv@>=0.1.4 <0.2.0", + "dependencies": { + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "from": "os-homedir@>=1.0.0 <2.0.0" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "from": "os-tmpdir@>=1.0.0 <2.0.0" + } + } } } }, "npmlog": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.0.2.tgz", - "from": "npmlog@>=4.0.1 <5.0.0", + "from": "npmlog@>=4.0.2 <5.0.0", "dependencies": { "are-we-there-yet": { "version": "1.1.2", @@ -535,8 +552,8 @@ "from": "delegates@>=1.0.0 <2.0.0" }, "readable-stream": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.2.tgz", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", "from": "readable-stream@>=2.0.0 <3.0.0||>=1.1.13 <2.0.0", "dependencies": { "buffer-shims": { @@ -589,8 +606,8 @@ "from": "gauge@>=2.7.1 <2.8.0", "dependencies": { "aproba": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.0.tgz", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", "from": "aproba@>=1.0.3 <2.0.0" }, "has-unicode": { @@ -659,9 +676,9 @@ } }, "rc": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.1.6.tgz", - "from": "rc@>=1.1.6 <1.2.0", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.1.7.tgz", + "from": "rc@>=1.1.7 <2.0.0", "dependencies": { "deep-extend": { "version": "0.4.1", @@ -679,16 +696,16 @@ "from": "minimist@>=1.2.0 <2.0.0" }, "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "from": "strip-json-comments@>=1.0.4 <1.1.0" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "from": "strip-json-comments@>=2.0.1 <2.1.0" } } }, "request": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", - "from": "request@>=2.79.0 <3.0.0", + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "from": "request@>=2.81.0 <3.0.0", "dependencies": { "aws-sign2": { "version": "0.6.0", @@ -701,9 +718,9 @@ "from": "aws4@>=1.2.1 <2.0.0" }, "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "from": "caseless@>=0.11.0 <0.12.0" + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "from": "caseless@>=0.12.0 <0.13.0" }, "combined-stream": { "version": "1.0.5", @@ -740,113 +757,38 @@ } }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "from": "har-validator@>=2.0.6 <2.1.0", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "from": "har-validator@>=4.2.1 <4.3.0", "dependencies": { - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "from": "chalk@>=1.1.1 <2.0.0", + "ajv": { + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.5.tgz", + "from": "ajv@>=4.9.1 <5.0.0", "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "from": "ansi-styles@>=2.2.1 <3.0.0" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "from": "escape-string-regexp@>=1.0.2 <2.0.0" + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "from": "co@>=4.6.0 <5.0.0" }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "from": "has-ansi@>=2.0.0 <3.0.0", - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "from": "ansi-regex@>=2.0.0 <3.0.0" - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "from": "strip-ansi@>=3.0.0 <4.0.0", - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "from": "ansi-regex@>=2.0.0 <3.0.0" - } - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "from": "supports-color@>=2.0.0 <3.0.0" - } - } - }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "from": "commander@>=2.9.0 <3.0.0", - "dependencies": { - "graceful-readlink": { + "json-stable-stringify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "from": "graceful-readlink@>=1.0.0" - } - } - }, - "is-my-json-valid": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz", - "from": "is-my-json-valid@>=2.12.4 <3.0.0", - "dependencies": { - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "from": "generate-function@>=2.0.0 <3.0.0" - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "from": "generate-object-property@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "from": "json-stable-stringify@>=1.0.1 <2.0.0", "dependencies": { - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "from": "is-property@>=1.0.0 <2.0.0" + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "from": "jsonify@>=0.0.0 <0.1.0" } } - }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "from": "jsonpointer@>=4.0.0 <5.0.0" - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "from": "xtend@>=4.0.0 <5.0.0" } } }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "from": "pinkie-promise@>=2.0.0 <3.0.0", - "dependencies": { - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "from": "pinkie@>=2.0.0 <3.0.0" - } - } + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "from": "har-schema@>=1.0.5 <2.0.0" } } }, @@ -888,10 +830,15 @@ "from": "assert-plus@>=0.2.0 <0.3.0" }, "jsprim": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", "from": "jsprim@>=1.2.2 <2.0.0", "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "from": "assert-plus@1.0.0" + }, "extsprintf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", @@ -910,8 +857,8 @@ } }, "sshpk": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.2.tgz", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.11.0.tgz", "from": "sshpk@>=1.7.0 <2.0.0", "dependencies": { "asn1": { @@ -950,8 +897,8 @@ "from": "jodid25519@>=1.0.0 <2.0.0" }, "jsbn": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "from": "jsbn@>=0.1.0 <0.2.0" }, "tweetnacl": { @@ -995,10 +942,20 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", "from": "oauth-sign@>=0.8.1 <0.9.0" }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "from": "performance-now@>=0.2.0 <0.3.0" + }, "qs": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.0.tgz", - "from": "qs@>=6.3.0 <6.4.0" + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "from": "qs@>=6.4.0 <6.5.0" + }, + "safe-buffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", + "from": "safe-buffer@>=5.0.1 <6.0.0" }, "stringstream": { "version": "0.0.5", @@ -1018,9 +975,9 @@ } }, "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "from": "tunnel-agent@>=0.4.1 <0.5.0" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "from": "tunnel-agent@>=0.6.0 <0.7.0" }, "uuid": { "version": "3.0.1", @@ -1030,9 +987,9 @@ } }, "rimraf": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.4.tgz", - "from": "rimraf@>=2.5.4 <2.6.0", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "from": "rimraf@>=2.6.1 <3.0.0", "dependencies": { "glob": { "version": "7.1.1", @@ -1109,12 +1066,12 @@ "semver": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "from": "semver@>=5.3.0 <5.4.0" + "from": "semver@>=5.3.0 <6.0.0" }, "tar": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "from": "tar@>=2.2.1 <2.3.0", + "from": "tar@>=2.2.1 <3.0.0", "dependencies": { "block-stream": { "version": "0.0.9", @@ -1122,8 +1079,8 @@ "from": "block-stream@*" }, "fstream": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.10.tgz", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", "from": "fstream@>=1.0.2 <2.0.0", "dependencies": { "graceful-fs": { @@ -1141,26 +1098,26 @@ } }, "tar-pack": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.3.0.tgz", - "from": "tar-pack@>=3.3.0 <3.4.0", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", + "from": "tar-pack@>=3.4.0 <4.0.0", "dependencies": { "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "from": "debug@>=2.2.0 <2.3.0", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.3.tgz", + "from": "debug@>=2.2.0 <3.0.0", "dependencies": { "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "from": "ms@0.7.1" + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "from": "ms@0.7.2" } } }, "fstream": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.10.tgz", - "from": "fstream@>=1.0.10 <1.1.0", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "from": "fstream@>=1.0.10 <2.0.0", "dependencies": { "graceful-fs": { "version": "4.1.11", @@ -1177,7 +1134,7 @@ "fstream-ignore": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", - "from": "fstream-ignore@>=1.0.5 <1.1.0", + "from": "fstream-ignore@>=1.0.5 <2.0.0", "dependencies": { "inherits": { "version": "2.0.3", @@ -1211,9 +1168,9 @@ } }, "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "from": "once@>=1.3.3 <1.4.0", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "from": "once@>=1.3.3 <2.0.0", "dependencies": { "wrappy": { "version": "1.0.2", @@ -1223,9 +1180,9 @@ } }, "readable-stream": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz", - "from": "readable-stream@>=2.1.4 <2.2.0", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", + "from": "readable-stream@>=2.1.4 <3.0.0", "dependencies": { "buffer-shims": { "version": "1.0.0", @@ -1240,7 +1197,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "from": "inherits@>=2.0.0 <3.0.0" + "from": "inherits@>=2.0.1 <2.1.0" }, "isarray": { "version": "1.0.0", @@ -1267,7 +1224,7 @@ "uid-number": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", - "from": "uid-number@>=0.0.6 <0.1.0" + "from": "uid-number@>=0.0.6 <0.0.7" } } } diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index fdd02b05d6c..deac55f473e 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -108,7 +108,7 @@ class GoogleVision { const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); this.visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { if (!error) { - console.log(RocketChat.models.Messages.setGoogleVisionData(message._id, this.getAnnotations(visionTypes, results))); + RocketChat.models.Messages.setGoogleVisionData(message._id, this.getAnnotations(visionTypes, results)); } else { console.trace('GoogleVision error: ', error.stack); } @@ -122,8 +122,9 @@ class GoogleVision { getAnnotations(visionTypes, visionData) { if (visionTypes.length === 1) { - visionData = {}; - visionData[`${visionTypes[0]}`] = visionData; + _visionData = {}; + _visionData[`${visionTypes[0]}`] = visionData; + visionData = _visionData; } const results = {}; for (const index in visionData) { @@ -132,11 +133,12 @@ class GoogleVision { case 'faces': case 'landmarks': case 'labels': - case 'safeSearch': case 'similar': case 'logos': results[index] = (results[index] || []).concat(visionData[index] || []); break; + case 'safeSearch': + results['safeSearch'] = visionData['safeSearch']; case 'properties': results['colors'] = visionData[index]['colors']; break; From 8836fdf0f909ee7c99a570a86e267bf659988d35 Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Tue, 21 Mar 2017 11:28:11 -0300 Subject: [PATCH 010/349] Fix Codacy Issues --- packages/rocketchat-google-vision/server/googlevision.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index deac55f473e..de441e114cf 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -122,7 +122,7 @@ class GoogleVision { getAnnotations(visionTypes, visionData) { if (visionTypes.length === 1) { - _visionData = {}; + const _visionData = {}; _visionData[`${visionTypes[0]}`] = visionData; visionData = _visionData; } @@ -139,6 +139,7 @@ class GoogleVision { break; case 'safeSearch': results['safeSearch'] = visionData['safeSearch']; + break; case 'properties': results['colors'] = visionData[index]['colors']; break; From 5aae1aa9b03ddb10c6ab722e31771938d084d8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kapp=C3=A9?= Date: Sun, 16 Apr 2017 17:22:24 +0100 Subject: [PATCH 011/349] Package to render issue numbers into links to an issue tracker. This package is incompatible with the "Hex Color Preview" plugin, which also uses the #-sign as an anchor to recognize numbers. --- .meteor/packages | 1 + .meteor/versions | 1 + packages/rocketchat-i18n/i18n/en.i18n.json | 4 ++++ packages/rocketchat-issuelinks/client.js | 16 ++++++++++++++++ packages/rocketchat-issuelinks/package.js | 14 ++++++++++++++ packages/rocketchat-issuelinks/settings.js | 17 +++++++++++++++++ 6 files changed, 53 insertions(+) create mode 100644 packages/rocketchat-issuelinks/client.js create mode 100644 packages/rocketchat-issuelinks/package.js create mode 100644 packages/rocketchat-issuelinks/settings.js diff --git a/.meteor/packages b/.meteor/packages index 6adcc33b297..51524686eff 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -74,6 +74,7 @@ rocketchat:importer-slack rocketchat:integrations rocketchat:internal-hubot rocketchat:irc +rocketchat:issuelinks rocketchat:katex rocketchat:ldap rocketchat:lib diff --git a/.meteor/versions b/.meteor/versions index 06ea825b6eb..64df609fbb4 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -160,6 +160,7 @@ rocketchat:importer-slack@0.0.1 rocketchat:integrations@0.0.1 rocketchat:internal-hubot@0.0.1 rocketchat:irc@0.0.2 +rocketchat:issuelinks@0.0.1 rocketchat:katex@0.0.1 rocketchat:ldap@0.0.1 rocketchat:ldapjs@1.0.0 diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index a11b1467df1..430e15397cf 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -787,6 +787,7 @@ "IRC_Message_Cache_Size": "The cache limit for outbound message handling.", "IRC_Port": "The port to bind to on the IRC host server.", "IRC_Quit": "Output upon quitting an IRC session.", + "Issue_Links": "Issue tracker links", "It_works": "It works", "italics": "italics", "Jitsi_Chrome_Extension": "Chrome Extension Id", @@ -893,6 +894,9 @@ "Leave_Room_Warning": "Are you sure you want to leave the room \"%s\"?", "Leave_the_current_channel": "Leave the current channel", "line": "line", + "IssueLinks_Incompatible": "Warning: do not enable this and the 'Hex Color Preview' at the same time.", + "IssueLinks_LinkTemplate": "Template for issue links", + "IssueLinks_LinkTemplate_Description": "Template for issue links; %s will be replaced by the issue number.", "List_of_Channels": "List of Channels", "List_of_Direct_Messages": "List of Direct Messages", "Livechat_agents": "Livechat agents", diff --git a/packages/rocketchat-issuelinks/client.js b/packages/rocketchat-issuelinks/client.js new file mode 100644 index 00000000000..e3284708636 --- /dev/null +++ b/packages/rocketchat-issuelinks/client.js @@ -0,0 +1,16 @@ +// +// IssueLink is a named function that will add issue links +// @param {Object} message - The message object +// + +function IssueLink(message) { + if (_.trim(message.html) && RocketChat.settings.get('IssueLinks_Enabled')) { + message.html = message.html.replace(/(?:^|\s|\n)(#[0-9]+)\b/g, function(match, issueNumber) { + var url = RocketChat.settings.get('IssueLinks_Template').replace('%s', issueNumber.substring(1)); + return match.replace(issueNumber, `${ issueNumber }`); + }); + } + return message; +} + +RocketChat.callbacks.add('renderMessage', IssueLink, RocketChat.callbacks.priority.MEDIUM); diff --git a/packages/rocketchat-issuelinks/package.js b/packages/rocketchat-issuelinks/package.js new file mode 100644 index 00000000000..f0e4afdd9c3 --- /dev/null +++ b/packages/rocketchat-issuelinks/package.js @@ -0,0 +1,14 @@ +Package.describe({ + name: 'rocketchat:issuelinks', + version: '0.0.1', + summary: 'Message pre-processor that will add links to issue numbers.', + git: '' +}); + +Package.onUse(function(api) { + api.use('rocketchat:lib'); + api.use('ecmascript'); + + api.addFiles('client.js', ['client']); + api.addFiles('settings.js', ['server']); +}); diff --git a/packages/rocketchat-issuelinks/settings.js b/packages/rocketchat-issuelinks/settings.js new file mode 100644 index 00000000000..ba93b95e6c4 --- /dev/null +++ b/packages/rocketchat-issuelinks/settings.js @@ -0,0 +1,17 @@ +RocketChat.settings.add('IssueLinks_Enabled', false, { + type: 'boolean', + i18nLabel: 'Enabled', + i18nDescription: 'IssueLinks_Incompatible', + group: 'Message', + section: 'Issue_Links', + public: true +}); + +RocketChat.settings.add('IssueLinks_Template', '', { + type: 'string', + i18nLabel: 'IssueLinks_LinkTemplate', + i18nDescription: 'IssueLinks_LinkTemplate_Description', + group: 'Message', + section: 'Issue_Links', + public: true +}); From 48b6129c7683bbc54a8982d16f653658c7f5ea26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kapp=C3=A9?= Date: Sun, 16 Apr 2017 19:46:57 +0100 Subject: [PATCH 012/349] Use "const" instead of "var" as suggested by codacy. --- packages/rocketchat-issuelinks/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-issuelinks/client.js b/packages/rocketchat-issuelinks/client.js index e3284708636..794fa8bd12d 100644 --- a/packages/rocketchat-issuelinks/client.js +++ b/packages/rocketchat-issuelinks/client.js @@ -6,7 +6,7 @@ function IssueLink(message) { if (_.trim(message.html) && RocketChat.settings.get('IssueLinks_Enabled')) { message.html = message.html.replace(/(?:^|\s|\n)(#[0-9]+)\b/g, function(match, issueNumber) { - var url = RocketChat.settings.get('IssueLinks_Template').replace('%s', issueNumber.substring(1)); + const url = RocketChat.settings.get('IssueLinks_Template').replace('%s', issueNumber.substring(1)); return match.replace(issueNumber, `${ issueNumber }`); }); } From 49383ab30585d5998687e5ffd418b3f1489eeba6 Mon Sep 17 00:00:00 2001 From: "T.A. de Jong" Date: Sun, 16 Apr 2017 21:21:33 +0200 Subject: [PATCH 013/349] Clear up language use --- packages/rocketchat-issuelinks/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-issuelinks/package.js b/packages/rocketchat-issuelinks/package.js index f0e4afdd9c3..ce9a0b72b37 100644 --- a/packages/rocketchat-issuelinks/package.js +++ b/packages/rocketchat-issuelinks/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'rocketchat:issuelinks', version: '0.0.1', - summary: 'Message pre-processor that will add links to issue numbers.', + summary: 'Message pre-processor that adds links to issue numbers.', git: '' }); From 50cb974fad339c679526aa91d1a8bd0e9473e8b0 Mon Sep 17 00:00:00 2001 From: Chris Nash Date: Wed, 5 Apr 2017 09:10:43 -0400 Subject: [PATCH 014/349] Addressing PR Feedback Modified localized strings to use individual keys rather than structured data. Moved flex-tab template for keyboard shortcuts because another developer moved the other flex-tab templates. --- packages/rocketchat-i18n/i18n/en.i18n.json | 25 +++++----- .../rocketchat-lib/client/defaultTabBars.js | 2 +- .../client/tabs/keyboardShortcuts.html | 48 +++++++++++++++++++ .../flex-tab/tabs/keyboardShortcuts.coffee | 16 ------- .../flex-tab/tabs/keyboardShortcuts.html | 14 ------ packages/rocketchat-ui-flextab/package.js | 17 ++++--- 6 files changed, 70 insertions(+), 52 deletions(-) create mode 100644 packages/rocketchat-ui-flextab/client/tabs/keyboardShortcuts.html delete mode 100644 packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee delete mode 100644 packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 545ef4babc7..ce9e84da219 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -797,18 +797,19 @@ "Katex_Enabled_Description": "Allow using katex for math typesetting in messages", "Katex_Parenthesis_Syntax": "Allow Parenthesis Syntax", "Katex_Parenthesis_Syntax_Description": "Allow using \\[katex block\\] and \\(inline katex\\) syntaxes", - "Keyboard_Shortcuts": { - "Title":"Keyboard Shortcuts", - "Items": [ - { "Description": "Open Channel / User search", "Keys": "Ctrl + p"}, - { "Description": "Edit previous message", "Keys": "Up Arrow"}, - { "Description": "Move to the beginning of the message", "Keys": "Command (or Alt) + Left Arrow"}, - { "Description": "Move to the beginning of the message", "Keys": "Command (or Alt) + Up Arrow"}, - { "Description": "Move to the end of the message", "Keys": "Command (or Alt) + Right Arrow"}, - { "Description": "Move to the end of the message", "Keys": "Command (or Alt) + Down Arrow"}, - { "Description": "New line in message compose input", "Keys": "Shift + Enter"} - ] - }, + "Keyboard_Shortcuts_Edit_Previous_Message": "Edit previous message", + "Keyboard_Shortcuts_Keys_1": "Ctrl + p", + "Keyboard_Shortcuts_Keys_2": "Up Arrow", + "Keyboard_Shortcuts_Keys_3": "Command (or Alt) + Left Arrow", + "Keyboard_Shortcuts_Keys_4": "Command (or Alt) + Up Arrow", + "Keyboard_Shortcuts_Keys_5": "Command (or Alt) + Right Arrow", + "Keyboard_Shortcuts_Keys_6": "Command (or Alt) + Down Arrow", + "Keyboard_Shortcuts_Keys_7": "Shift + Enter", + "Keyboard_Shortcuts_Move_To_Beginning_Of_Message": "Move to the beginning of the message", + "Keyboard_Shortcuts_Move_To_End_Of_Message": "Move to the end of the message", + "Keyboard_Shortcuts_Open_Channel_Slash_User_Search": "Open Channel / User search", + "Keyboard_Shortcuts_New_Line_In_Message": "New line in message compose input", + "Keyboard_Shortcuts_Title": "Keyboard Shortcuts", "Knowledge_Base": "Knowledge Base", "Label": "Label", "Language": "Language", diff --git a/packages/rocketchat-lib/client/defaultTabBars.js b/packages/rocketchat-lib/client/defaultTabBars.js index 91568da4ca6..2b9944a69ac 100644 --- a/packages/rocketchat-lib/client/defaultTabBars.js +++ b/packages/rocketchat-lib/client/defaultTabBars.js @@ -41,4 +41,4 @@ RocketChat.TabBar.addButton({ icon: 'icon-keyboard', template: 'keyboardShortcuts', order: 4 -}); \ No newline at end of file +}); diff --git a/packages/rocketchat-ui-flextab/client/tabs/keyboardShortcuts.html b/packages/rocketchat-ui-flextab/client/tabs/keyboardShortcuts.html new file mode 100644 index 00000000000..fc36833ffb8 --- /dev/null +++ b/packages/rocketchat-ui-flextab/client/tabs/keyboardShortcuts.html @@ -0,0 +1,48 @@ + diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee deleted file mode 100644 index 7b16f53ae85..00000000000 --- a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.coffee +++ /dev/null @@ -1,16 +0,0 @@ -Template.keyboardShortcuts.helpers -#Get all of the "Items" in the "Keyboard_Shortcuts" object in the translation file. -#This allows us to add more keyboard shortcuts in the future without modifying the template. - - shortcuts: -> - idx = 0 - data = [] - loop - shortcut = - "Description": TAPi18n.__("Keyboard_Shortcuts.Items." + idx + ".Description"), - "Keys": TAPi18n.__("Keyboard_Shortcuts.Items." + idx + ".Keys") - if shortcut.Keys is "Keyboard_Shortcuts.Items." + idx + ".Keys" - break # Tapi18n did not find this value, so there are no more shortcuts defined. - data.push(shortcut) - idx++ - return data \ No newline at end of file diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html b/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html deleted file mode 100644 index 21d4ceed0f7..00000000000 --- a/packages/rocketchat-ui-flextab/flex-tab/tabs/keyboardShortcuts.html +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file diff --git a/packages/rocketchat-ui-flextab/package.js b/packages/rocketchat-ui-flextab/package.js index c17687fc530..764c8ea4682 100644 --- a/packages/rocketchat-ui-flextab/package.js +++ b/packages/rocketchat-ui-flextab/package.js @@ -19,19 +19,18 @@ Package.onUse(function(api) { 'rocketchat:lib' ]); - api.addFiles('flex-tab/flexTabBar.html', 'client'); - api.addFiles('flex-tab/tabs/keyboardShortcuts.html', 'client'); - api.addFiles('flex-tab/tabs/membersList.html', 'client'); - api.addFiles('flex-tab/tabs/messageSearch.html', 'client'); - api.addFiles('flex-tab/tabs/uploadedFilesList.html', 'client'); - api.addFiles('flex-tab/tabs/userEdit.html', 'client'); - api.addFiles('flex-tab/tabs/userInfo.html', 'client'); + api.addFiles('client/flexTabBar.html', 'client'); + api.addFiles('client/tabs/membersList.html', 'client'); + api.addFiles('client/tabs/messageSearch.html', 'client'); + api.addFiles('client/tabs/uploadedFilesList.html', 'client'); + api.addFiles('client/tabs/userEdit.html', 'client'); + api.addFiles('client/tabs/userInfo.html', 'client'); - api.addFiles('flex-tab/flexTabBar.js', 'client'); - api.addFiles('flex-tab/tabs/keyboardShortcuts.coffee', 'client'); + api.addFiles('client/flexTabBar.js', 'client'); api.addFiles('client/tabs/membersList.js', 'client'); api.addFiles('client/tabs/messageSearch.js', 'client'); api.addFiles('client/tabs/uploadedFilesList.js', 'client'); api.addFiles('client/tabs/userEdit.js', 'client'); api.addFiles('client/tabs/userInfo.js', 'client'); + api.addFiles('client/tabs/keyboardShortcuts.html', 'client'); }); From 5bb1d9b5c42020d614942b385c87fc8774cedf36 Mon Sep 17 00:00:00 2001 From: Chris Nash Date: Tue, 9 May 2017 09:03:41 -0400 Subject: [PATCH 015/349] Update defaultTabBars.js --- packages/rocketchat-lib/client/defaultTabBars.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/rocketchat-lib/client/defaultTabBars.js b/packages/rocketchat-lib/client/defaultTabBars.js index 2b9944a69ac..9bccd70a717 100644 --- a/packages/rocketchat-lib/client/defaultTabBars.js +++ b/packages/rocketchat-lib/client/defaultTabBars.js @@ -42,3 +42,4 @@ RocketChat.TabBar.addButton({ template: 'keyboardShortcuts', order: 4 }); + From 71448fea9bd5cab745054eac845dd1bc039fd70e Mon Sep 17 00:00:00 2001 From: Marcelo Schmidt Date: Wed, 10 May 2017 23:21:52 -0300 Subject: [PATCH 016/349] Fix eslint errors --- packages/rocketchat-google-vision/client/googlevision.js | 6 +++--- packages/rocketchat-google-vision/server/googlevision.js | 6 +++--- packages/rocketchat-google-vision/server/models/Messages.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/rocketchat-google-vision/client/googlevision.js b/packages/rocketchat-google-vision/client/googlevision.js index b61a7dfc9d3..c237dd03f84 100644 --- a/packages/rocketchat-google-vision/client/googlevision.js +++ b/packages/rocketchat-google-vision/client/googlevision.js @@ -14,10 +14,10 @@ RocketChat.GoogleVision = { labels.push({ label: 'Violence', bgColor: 'red', fontColor: 'white' }); } if (attachment.colors && attachment.colors.length > 0) { - attributes.color = '#' + attachment.colors[0]; + attributes.color = `#${ attachment.colors[0] }`; } if (attachment.logos && attachment.logos.length > 0) { - labels.push({ label: `Logo: ${attachment.logos[0]}` }); + labels.push({ label: `Logo: ${ attachment.logos[0] }` }); } if (attachment.faces && attachment.faces.length > 0) { let faceCount = 0; @@ -36,7 +36,7 @@ RocketChat.GoogleVision = { faceAttributes.push('Surprise'); } if (faceAttributes.length > 0) { - labels.push({ label: `Face ${++faceCount}: ${faceAttributes.join(', ')}` }); + labels.push({ label: `Face ${ ++faceCount }: ${ faceAttributes.join(', ') }` }); } }); } diff --git a/packages/rocketchat-google-vision/server/googlevision.js b/packages/rocketchat-google-vision/server/googlevision.js index de441e114cf..45c3fa58875 100644 --- a/packages/rocketchat-google-vision/server/googlevision.js +++ b/packages/rocketchat-google-vision/server/googlevision.js @@ -51,7 +51,7 @@ class GoogleVision { if (file && file.type && file.type.indexOf('image') !== -1 && file.store === 'googleCloudStorage' && file.googleCloudStorage) { if (this.incCallCount(1)) { const bucket = this.storageClient.bucket(file.googleCloudStorage.bucket); - const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); + const bucketFile = bucket.file(`${ file.googleCloudStorage.path }${ file._id }`); const results = Meteor.wrapAsync(this.visionClient.detectSafeSearch, this.visionClient)(bucketFile); if (results && results.adult === true) { delete message.attachments[0]; @@ -105,7 +105,7 @@ class GoogleVision { if (file && file.type && file.type.indexOf('image') !== -1 && file.store === 'googleCloudStorage' && file.googleCloudStorage) { if (this.incCallCount(visionTypes.length)) { const bucket = this.storageClient.bucket(file.googleCloudStorage.bucket); - const bucketFile = bucket.file(`${file.googleCloudStorage.path}${file._id}`); + const bucketFile = bucket.file(`${ file.googleCloudStorage.path }${ file._id }`); this.visionClient.detect(bucketFile, visionTypes, Meteor.bindEnvironment((error, results) => { if (!error) { RocketChat.models.Messages.setGoogleVisionData(message._id, this.getAnnotations(visionTypes, results)); @@ -123,7 +123,7 @@ class GoogleVision { getAnnotations(visionTypes, visionData) { if (visionTypes.length === 1) { const _visionData = {}; - _visionData[`${visionTypes[0]}`] = visionData; + _visionData[`${ visionTypes[0] }`] = visionData; visionData = _visionData; } const results = {}; diff --git a/packages/rocketchat-google-vision/server/models/Messages.js b/packages/rocketchat-google-vision/server/models/Messages.js index 4dc23094183..47776984618 100644 --- a/packages/rocketchat-google-vision/server/models/Messages.js +++ b/packages/rocketchat-google-vision/server/models/Messages.js @@ -2,7 +2,7 @@ RocketChat.models.Messages.setGoogleVisionData = function(messageId, visionData) const updateObj = {}; for (const index in visionData) { if (visionData.hasOwnProperty(index)) { - updateObj[`attachments.0.${index}`] = visionData[index]; + updateObj[`attachments.0.${ index }`] = visionData[index]; } } From 8e5fd7f99e167c6d8aa92917a7926b75506487c0 Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Wed, 31 May 2017 16:10:25 -0300 Subject: [PATCH 017/349] add new variables to db --- packages/rocketchat-theme/server/server.js | 9 ++-- packages/rocketchat-theme/server/variables.js | 50 +++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/packages/rocketchat-theme/server/server.js b/packages/rocketchat-theme/server/server.js index 16b254185f6..2c29415c57d 100644 --- a/packages/rocketchat-theme/server/server.js +++ b/packages/rocketchat-theme/server/server.js @@ -117,7 +117,7 @@ RocketChat.theme = new class { }); } - addVariable(type, name, value, section, persist = true, editor, allowedTypes) { + addVariable(type, name, value, section, persist = true, editor, allowedTypes, property) { this.variables[name] = { type, value @@ -129,15 +129,16 @@ RocketChat.theme = new class { editor: editor || type, section, 'public': false, - allowedTypes + allowedTypes, + property }; return RocketChat.settings.add(`theme-${ type }-${ name }`, value, config); } } - addPublicColor(name, value, section, editor = 'color') { - return this.addVariable('color', name, value, section, true, editor, ['color', 'expression']); + addPublicColor(name, value, section, editor = 'color', property) { + return this.addVariable('color', name, value, section, true, editor, ['color', 'expression'], property); } addPublicFont(name, value) { diff --git a/packages/rocketchat-theme/server/variables.js b/packages/rocketchat-theme/server/variables.js index 96c292d83d6..4977435b353 100644 --- a/packages/rocketchat-theme/server/variables.js +++ b/packages/rocketchat-theme/server/variables.js @@ -39,6 +39,56 @@ const minorColors= { 'status-offline': '@transparent-darker' }; +const sidebar = [ + { + class: 'sidebar-background', + property: 'background-color', + value: '#2f343d' + }, + { + class: 'sidebar-content', + property: 'color', + value: '#6c727a' + }, + { + class: 'sidebar-content-active', + property: 'background-color', + value: '#6c727a' + }, + { + class: 'sidebar-content-unread', + property: 'color', + value: '#ffffff' + }, + { + class: 'sidebar-content:hover', + property: 'background-color', + value: '#26282d' + }, + { + class: 'sidebar-category-badge', + property: 'background-color', + value: '#414852' + }, + { + class: 'sidebar-category-badge-content', + property: 'color', + value: '#ffffff' + }, + { + class: 'sidebar-room-badge', + property: 'background-color', + value: '#414852' + }, + { + class: 'sidebar-room-badge-content', + property: 'color', + value: '#ffffff' + } +]; + +sidebar.forEach(setting => RocketChat.theme.addPublicColor(setting.class, setting.value, 'Sidebar', 'color', setting.property)); + // Bulk-add settings for color scheme Object.keys(majorColors).forEach((key) => { From a06c861c58f55f57d92637a902f52e3239cf6615 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 31 May 2017 18:15:51 -0300 Subject: [PATCH 018/349] render colors --- .meteor/.finished-upgraders | 1 + .meteor/packages | 21 ++++---- .meteor/release | 2 +- .meteor/versions | 47 ++++++++-------- packages/rocketchat-theme/server/server.js | 2 +- .../.npm/package/npm-shrinkwrap.json | 28 +++++----- packages/rocketchat-ui-master/client/main.js | 2 + .../server/dynamic-css.js | 35 ++++++++++++ .../rocketchat-ui-master/server/inject.js | 53 +++---------------- .../server/page-loading.css | 41 ++++++++++++++ 10 files changed, 139 insertions(+), 93 deletions(-) create mode 100644 packages/rocketchat-ui-master/server/dynamic-css.js create mode 100644 packages/rocketchat-ui-master/server/page-loading.css diff --git a/.meteor/.finished-upgraders b/.meteor/.finished-upgraders index a8020370920..2a56593d3f8 100644 --- a/.meteor/.finished-upgraders +++ b/.meteor/.finished-upgraders @@ -15,3 +15,4 @@ notices-for-facebook-graph-api-2 1.4.0-remove-old-dev-bundle-link 1.4.1-add-shell-server-package 1.4.3-split-account-service-packages +1.5-add-dynamic-import-package diff --git a/.meteor/packages b/.meteor/packages index 3c749d04714..b1b91a38037 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -4,17 +4,17 @@ # but you can also edit it by hand. rocketchat:cors -accounts-facebook@1.1.1 -accounts-github@1.2.1 -accounts-google@1.1.2 -accounts-meteor-developer@1.2.1 +accounts-facebook@1.2.0 +accounts-github@1.3.0 +accounts-google@1.2.0 +accounts-meteor-developer@1.3.0 accounts-password@1.3.6 -accounts-twitter@1.2.1 +accounts-twitter@1.3.0 blaze-html-templates check@1.2.5 coffeescript@1.11.1_4 ddp-rate-limiter@1.0.7 -ecmascript@0.7.3 +ecmascript@0.8.0 ejson@1.0.13 email@1.2.1 fastclick@1.0.13 @@ -22,19 +22,19 @@ http@1.2.12 jquery@1.11.10 less@2.7.9 logging@1.1.17 -meteor-base@1.0.4 +meteor-base@1.1.0 mobile-experience@1.0.4 -mongo@1.1.17 +mongo@1.1.18 random@1.0.10 rate-limit@1.0.8 -reactive-dict@1.1.8 +reactive-dict@1.1.9 reactive-var@1.0.11 reload@1.1.11 service-configuration@1.0.11 session@1.1.7 shell-server@0.2.3 spacebars -standard-minifier-js@2.0.0 +standard-minifier-js@2.1.0 tracker@1.1.3 rocketchat:2fa @@ -172,3 +172,4 @@ yasaricli:slugify yasinuslu:blaze-meta deepwell:bootstrap-datepicker2 rocketchat:postcss +dynamic-import diff --git a/.meteor/release b/.meteor/release index fb6f3bc15e2..025f64e7073 100644 --- a/.meteor/release +++ b/.meteor/release @@ -1 +1 @@ -METEOR@1.4.4.2 +METEOR@1.5 diff --git a/.meteor/versions b/.meteor/versions index db53171f666..b4428f44654 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,22 +1,22 @@ -accounts-base@1.2.17 -accounts-facebook@1.1.1 -accounts-github@1.2.1 -accounts-google@1.1.2 -accounts-meteor-developer@1.2.1 +accounts-base@1.3.0 +accounts-facebook@1.2.0 +accounts-github@1.3.0 +accounts-google@1.2.0 +accounts-meteor-developer@1.3.0 accounts-oauth@1.1.15 accounts-password@1.3.6 -accounts-twitter@1.2.1 +accounts-twitter@1.3.0 aldeed:simple-schema@1.5.3 allow-deny@1.0.5 autoupdate@1.3.12 -babel-compiler@6.18.2 +babel-compiler@6.19.1 babel-runtime@1.0.1 base64@1.0.10 binary-heap@1.0.10 blaze@2.3.2 blaze-html-templates@1.1.2 blaze-tools@1.0.10 -boilerplate-generator@1.0.11 +boilerplate-generator@1.1.0 caching-compiler@1.1.9 caching-html-compiler@1.1.2 callback-hook@1.0.10 @@ -33,13 +33,16 @@ deepwell:bootstrap-datepicker2@1.3.0 deps@1.0.12 diff-sequence@1.0.7 dispatch:run-as-user@1.1.1 -ecmascript@0.7.3 -ecmascript-runtime@0.3.15 +dynamic-import@0.1.0 +ecmascript@0.8.0 +ecmascript-runtime@0.4.1 +ecmascript-runtime-client@0.4.1 +ecmascript-runtime-server@0.4.1 edgee:slingshot@0.7.1 ejson@1.0.13 email@1.2.1 emojione:emojione@2.2.6 -facebook-oauth@1.3.0 +facebook-oauth@1.3.1 fastclick@1.0.13 francocatena:status@1.5.3 geojson-utils@1.0.10 @@ -69,26 +72,26 @@ konecty:user-presence@1.2.9 launch-screen@1.1.1 less@2.7.9 livedata@1.0.18 -localstorage@1.0.12 +localstorage@1.1.0 logging@1.1.17 matb33:collection-hooks@0.8.4 mdg:validation-error@0.5.1 meteor@1.6.1 -meteor-base@1.0.4 +meteor-base@1.1.0 meteor-developer-oauth@1.2.0 meteorhacks:inject-initial@1.0.4 meteorhacks:meteorx@1.4.1 meteorspark:util@0.2.0 minifier-css@1.2.16 -minifier-js@2.0.0 -minimongo@1.0.23 +minifier-js@2.1.0 +minimongo@1.2.0 mizzao:autocomplete@0.5.1 mizzao:timesync@0.3.4 mobile-experience@1.0.4 mobile-status-bar@1.0.14 -modules@0.8.2 -modules-runtime@0.7.10 -mongo@1.1.17 +modules@0.9.0 +modules-runtime@0.8.0 +mongo@1.1.18 mongo-id@1.0.6 mongo-livedata@1.0.12 mrt:reactive-store@0.0.1 @@ -108,7 +111,7 @@ pauli:linkedin-oauth@1.1.0 peerlibrary:aws-sdk@2.4.9_1 peerlibrary:blocking@0.5.2 percolate:synced-cron@1.3.2 -promise@0.8.8 +promise@0.8.9 raix:eventemitter@0.1.3 raix:eventstate@0.0.4 raix:handlebar-helpers@0.2.5 @@ -116,7 +119,7 @@ raix:push@3.0.3-rc.7 raix:ui-dropped-event@0.0.7 random@1.0.10 rate-limit@1.0.8 -reactive-dict@1.1.8 +reactive-dict@1.1.9 reactive-var@1.0.11 reload@1.1.11 retry@1.0.9 @@ -232,7 +235,7 @@ smoral:sweetalert@1.1.1 spacebars@1.0.15 spacebars-compiler@1.1.2 srp@1.0.10 -standard-minifier-js@2.0.0 +standard-minifier-js@2.1.0 steffo:meteor-accounts-saml@0.0.1 tap:i18n@1.8.2 templating@1.3.2 @@ -248,7 +251,7 @@ ui@1.0.13 underscore@1.0.10 underscorestring:underscore.string@3.3.4 url@1.1.0 -webapp@1.3.15 +webapp@1.3.16 webapp-hashing@1.0.9 yasaricli:slugify@0.0.7 yasinuslu:blaze-meta@0.3.3 diff --git a/packages/rocketchat-theme/server/server.js b/packages/rocketchat-theme/server/server.js index 2c29415c57d..102129dcb42 100644 --- a/packages/rocketchat-theme/server/server.js +++ b/packages/rocketchat-theme/server/server.js @@ -128,7 +128,7 @@ RocketChat.theme = new class { type, editor: editor || type, section, - 'public': false, + 'public': true, allowedTypes, property }; diff --git a/packages/rocketchat-ui-master/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-ui-master/.npm/package/npm-shrinkwrap.json index 7db964c3bb1..6a227016546 100644 --- a/packages/rocketchat-ui-master/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-ui-master/.npm/package/npm-shrinkwrap.json @@ -1,28 +1,28 @@ { "dependencies": { "clipboard": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.5.12.tgz", - "from": "clipboard@1.5.12" + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.6.1.tgz", + "from": "clipboard@1.6.1" }, "delegate": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.1.0.tgz", - "from": "delegate@>=3.1.0 <4.0.0" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.1.2.tgz", + "from": "delegate@>=3.1.2 <4.0.0" }, "good-listener": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.0.tgz", - "from": "good-listener@>=1.1.6 <2.0.0" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "from": "good-listener@>=1.2.0 <2.0.0" }, "select": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/select/-/select-1.1.0.tgz", - "from": "select@>=1.0.6 <2.0.0" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "from": "select@>=1.1.2 <2.0.0" }, "tiny-emitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-1.1.0.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-1.2.0.tgz", "from": "tiny-emitter@>=1.0.0 <2.0.0" } } diff --git a/packages/rocketchat-ui-master/client/main.js b/packages/rocketchat-ui-master/client/main.js index 9e91eea3687..6301a72dde6 100644 --- a/packages/rocketchat-ui-master/client/main.js +++ b/packages/rocketchat-ui-master/client/main.js @@ -1,6 +1,8 @@ /* globals toolbarSearch, menu, isRtl, fireGlobalEvent, CachedChatSubscription */ import Clipboard from 'clipboard'; +RocketChat.settings.collection.find({_id:/theme/}, {fields:{ value: 1 }}).observe({changed: (key) => { console.log(key); }}); + Template.body.onRendered(function() { new Clipboard('.clipboard'); diff --git a/packages/rocketchat-ui-master/server/dynamic-css.js b/packages/rocketchat-ui-master/server/dynamic-css.js new file mode 100644 index 00000000000..16c1ad6b9e7 --- /dev/null +++ b/packages/rocketchat-ui-master/server/dynamic-css.js @@ -0,0 +1,35 @@ +'use strict'; +export default () => { + const debounce = (func, wait, immediate) => { + let timeout; + return function(...args) { + const later = () => { + timeout = null; + !immediate && func.apply(this, args); + }; + const callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + callNow && func.apply(this, args); + }; + }; + + const style = document.createElement('style'); + style.type = 'text/css'; + + DynamicCss = typeof DynamicCss !=='undefined'? DynamicCss : {list:[]}; + + const settingBackground = (setting) => `.${ setting._id }-background { background-color: ${ setting.value }; }`; + const settingColor = (setting) => `.${ setting._id }-color { color: ${ setting.value }; }`; + + const properties = [settingBackground, settingColor]; + const run = list => list.map(setting => properties.map(f => f(setting)).join('')).join(''); + + DynamicCss.run = debounce(() => { + const list = typeof RocketChat !== 'undefined' ? RocketChat.settings.collection.find({_id:/theme/}).fetch() : []; + return style.innerHTML = run(list.length && list || DynamicCss.list); + }, 1000); + + document.head.appendChild(style); + DynamicCss.run(); +}; diff --git a/packages/rocketchat-ui-master/server/inject.js b/packages/rocketchat-ui-master/server/inject.js index 5c022c0ca76..521749ae727 100644 --- a/packages/rocketchat-ui-master/server/inject.js +++ b/packages/rocketchat-ui-master/server/inject.js @@ -1,49 +1,13 @@ /* globals Inject */ +const variables = RocketChat.models.Settings.find({_id:/theme-/}, {fields: { value: 1 }}).fetch(); +Inject.rawHead('dynamic-variables', ``); +Inject.rawHead('dynamic', ``); -Inject.rawHead('page-loading', ` -`); + +// Inject.rawHead('page-loading', ` `); Inject.rawBody('page-loading-div', `
@@ -152,4 +116,3 @@ Meteor.defer(() => { } Inject.rawHead('base', ``); }); - diff --git a/packages/rocketchat-ui-master/server/page-loading.css b/packages/rocketchat-ui-master/server/page-loading.css new file mode 100644 index 00000000000..54a198723b6 --- /dev/null +++ b/packages/rocketchat-ui-master/server/page-loading.css @@ -0,0 +1,41 @@ +.loading-animation { + top: 0; + right: 0; + bottom: 0; + left: 0; + display: flex; + align-items: center; + position: absolute; + justify-content: center; + text-align: center; +} +.loading-animation > div { + width: 10px; + height: 10px; + margin: 2px; + border-radius: 100%; + display: inline-block; + background-color: rgba(255,255,255,0.6); + -webkit-animation: loading-bouncedelay 1.4s infinite ease-in-out both; + animation: loading-bouncedelay 1.4s infinite ease-in-out both; +} +.loading-animation .bounce1 { + -webkit-animation-delay: -0.32s; + animation-delay: -0.32s; +} +.loading-animation .bounce2 { + -webkit-animation-delay: -0.16s; + animation-delay: -0.16s; +} +@-webkit-keyframes loading-bouncedelay { + 0%, + 80%, + 100% { -webkit-transform: scale(0) } + 40% { -webkit-transform: scale(1.0) } +} +@keyframes loading-bouncedelay { + 0%, + 80%, + 100% { transform: scale(0); } + 40% { transform: scale(1.0); } +} From bbd9d856465f94e255985da36843600937d2407b Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 31 May 2017 19:38:08 -0300 Subject: [PATCH 019/349] fix observer --- packages/rocketchat-ui-master/client/main.js | 2 +- packages/rocketchat-ui-master/server/dynamic-css.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-ui-master/client/main.js b/packages/rocketchat-ui-master/client/main.js index 6301a72dde6..1c7ece111eb 100644 --- a/packages/rocketchat-ui-master/client/main.js +++ b/packages/rocketchat-ui-master/client/main.js @@ -1,7 +1,7 @@ /* globals toolbarSearch, menu, isRtl, fireGlobalEvent, CachedChatSubscription */ import Clipboard from 'clipboard'; -RocketChat.settings.collection.find({_id:/theme/}, {fields:{ value: 1 }}).observe({changed: (key) => { console.log(key); }}); +RocketChat.settings.collection.find({_id:/theme/}, {fields:{ value: 1 }}).observe({changed: () => { DynamicCss.run(); }}); Template.body.onRendered(function() { new Clipboard('.clipboard'); diff --git a/packages/rocketchat-ui-master/server/dynamic-css.js b/packages/rocketchat-ui-master/server/dynamic-css.js index 16c1ad6b9e7..e1ab1a7e60e 100644 --- a/packages/rocketchat-ui-master/server/dynamic-css.js +++ b/packages/rocketchat-ui-master/server/dynamic-css.js @@ -16,6 +16,7 @@ export default () => { const style = document.createElement('style'); style.type = 'text/css'; + style.id = 'rocketchat-dynamic-css'; DynamicCss = typeof DynamicCss !=='undefined'? DynamicCss : {list:[]}; From 98a5e80b2cef1c838f12d33b7870b7157c0ca7db Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Thu, 1 Jun 2017 10:02:25 -0300 Subject: [PATCH 020/349] . --- .../rocketchat-lib/client/lib/settings.js | 9 +-- .../rocketchat-lib/server/startup/settings.js | 70 ++++++++++--------- packages/rocketchat-theme/server/server.js | 13 ++++ packages/rocketchat-theme/server/variables.js | 6 +- packages/rocketchat-ui-master/client/main.js | 4 +- .../server/dynamic-css.js | 11 +-- .../rocketchat-ui-master/server/inject.js | 2 +- 7 files changed, 67 insertions(+), 48 deletions(-) diff --git a/packages/rocketchat-lib/client/lib/settings.js b/packages/rocketchat-lib/client/lib/settings.js index 0f0c946ecd8..76ba9cba5eb 100644 --- a/packages/rocketchat-lib/client/lib/settings.js +++ b/packages/rocketchat-lib/client/lib/settings.js @@ -28,20 +28,21 @@ RocketChat.settings.init = function() { added(record) { Meteor.settings[record._id] = record.value; RocketChat.settings.dict.set(record._id, record.value); - return RocketChat.settings.load(record._id, record.value, initialLoad); + RocketChat.settings.load(record._id, record.value, initialLoad); }, changed(record) { + console.log('changed', record); Meteor.settings[record._id] = record.value; RocketChat.settings.dict.set(record._id, record.value); - return RocketChat.settings.load(record._id, record.value, initialLoad); + RocketChat.settings.load(record._id, record.value, initialLoad); }, removed(record) { delete Meteor.settings[record._id]; RocketChat.settings.dict.set(record._id, null); - return RocketChat.settings.load(record._id, null, initialLoad); + RocketChat.settings.load(record._id, null, initialLoad); } }); - return initialLoad = false; + initialLoad = false; }; RocketChat.settings.init(); diff --git a/packages/rocketchat-lib/server/startup/settings.js b/packages/rocketchat-lib/server/startup/settings.js index e62787932de..02b73ae93bf 100644 --- a/packages/rocketchat-lib/server/startup/settings.js +++ b/packages/rocketchat-lib/server/startup/settings.js @@ -188,7 +188,7 @@ RocketChat.settings.addGroup('Accounts', function() { value: 'FileSystem' } }); - return this.add('Accounts_SetDefaultAvatar', true, { + this.add('Accounts_SetDefaultAvatar', true, { type: 'boolean' }); }); @@ -212,7 +212,7 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Facebook_callback_url', '_oauth/facebook', { + this.add('Accounts_OAuth_Facebook_callback_url', '_oauth/facebook', { type: 'relativeUrl', readonly: true, force: true, @@ -236,7 +236,7 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Google_callback_url', '_oauth/google', { + this.add('Accounts_OAuth_Google_callback_url', '_oauth/google', { type: 'relativeUrl', readonly: true, force: true, @@ -260,7 +260,7 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Github_callback_url', '_oauth/github', { + this.add('Accounts_OAuth_Github_callback_url', '_oauth/github', { type: 'relativeUrl', readonly: true, force: true, @@ -284,7 +284,7 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Linkedin_callback_url', '_oauth/linkedin', { + this.add('Accounts_OAuth_Linkedin_callback_url', '_oauth/linkedin', { type: 'relativeUrl', readonly: true, force: true, @@ -308,7 +308,7 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Meteor_callback_url', '_oauth/meteor', { + this.add('Accounts_OAuth_Meteor_callback_url', '_oauth/meteor', { type: 'relativeUrl', readonly: true, force: true, @@ -332,19 +332,19 @@ RocketChat.settings.addGroup('OAuth', function() { type: 'string', enableQuery }); - return this.add('Accounts_OAuth_Twitter_callback_url', '_oauth/twitter', { + this.add('Accounts_OAuth_Twitter_callback_url', '_oauth/twitter', { type: 'relativeUrl', readonly: true, force: true, enableQuery }); }); - return this.section('Proxy', function() { + this.section('Proxy', function() { this.add('Accounts_OAuth_Proxy_host', 'https://oauth-proxy.rocket.chat', { type: 'string', 'public': true }); - return this.add('Accounts_OAuth_Proxy_services', '', { + this.add('Accounts_OAuth_Proxy_services', '', { type: 'string', 'public': true }); @@ -402,25 +402,25 @@ RocketChat.settings.addGroup('General', function() { 'public': true, i18nDescription: 'UTF8_Names_Validation_Description' }); - return this.add('UTF8_Names_Slugify', true, { + this.add('UTF8_Names_Slugify', true, { type: 'boolean', 'public': true }); }); this.section('Reporting', function() { - return this.add('Statistics_reporting', true, { + this.add('Statistics_reporting', true, { type: 'boolean' }); }); this.section('Notifications', function() { - return this.add('Desktop_Notifications_Duration', 0, { + this.add('Desktop_Notifications_Duration', 0, { type: 'int', 'public': true, i18nDescription: 'Desktop_Notification_Durations_Description' }); }); this.section('REST API', function() { - return this.add('API_User_Limit', 500, { + this.add('API_User_Limit', 500, { type: 'int', 'public': true, i18nDescription: 'API_User_Limit' @@ -443,7 +443,7 @@ RocketChat.settings.addGroup('General', function() { type: 'boolean', 'public': true }); - return this.add('Iframe_Integration_receive_origin', '*', { + this.add('Iframe_Integration_receive_origin', '*', { type: 'string', 'public': true, enableQuery: { @@ -453,13 +453,13 @@ RocketChat.settings.addGroup('General', function() { }); }); this.section('Translations', function() { - return this.add('Custom_Translations', '', { + this.add('Custom_Translations', '', { type: 'code', 'public': true }); }); - return this.section('Stream_Cast', function() { - return this.add('Stream_Cast_Address', '', { + this.section('Stream_Cast', function() { + this.add('Stream_Cast_Address', '', { type: 'string' }); }); @@ -473,7 +473,7 @@ RocketChat.settings.addGroup('Email', function() { multiline: true, i18nLabel: 'Header' }); - return this.add('Email_Footer', 'Powered by Rocket.Chat', { + this.add('Email_Footer', 'Powered by Rocket.Chat', { type: 'code', code: 'text/html', multiline: true, @@ -533,7 +533,7 @@ RocketChat.settings.addGroup('Email', function() { type: 'string', placeholder: 'email@domain' }); - return this.add('SMTP_Test_Button', 'sendSMTPTestEmail', { + this.add('SMTP_Test_Button', 'sendSMTPTestEmail', { type: 'action', actionText: 'Send_a_test_mail_to_my_user' }); @@ -555,7 +555,7 @@ RocketChat.settings.addGroup('Email', function() { value: false } }); - return this.add('Invitation_HTML', '', { + this.add('Invitation_HTML', '', { type: 'code', code: 'text/html', multiline: true, @@ -588,7 +588,7 @@ RocketChat.settings.addGroup('Email', function() { value: false } }); - return this.add('Accounts_Enrollment_Email', '', { + this.add('Accounts_Enrollment_Email', '', { type: 'code', code: 'text/html', multiline: true, @@ -620,7 +620,7 @@ RocketChat.settings.addGroup('Email', function() { value: false } }); - return this.add('Accounts_UserAddedEmail', '', { + this.add('Accounts_UserAddedEmail', '', { type: 'code', code: 'text/html', multiline: true, @@ -653,7 +653,7 @@ RocketChat.settings.addGroup('Email', function() { value: false } }); - return this.add('Forgot_Password_Email', '', { + this.add('Forgot_Password_Email', '', { type: 'code', code: 'text/html', multiline: true, @@ -669,7 +669,7 @@ RocketChat.settings.addGroup('Email', function() { } }); }); - return this.section('Verification', function() { + this.section('Verification', function() { this.add('Verification_Customized', false, { type: 'boolean', i18nLabel: 'Custom' @@ -686,7 +686,7 @@ RocketChat.settings.addGroup('Email', function() { value: false } }); - return this.add('Verification_Email', '', { + this.add('Verification_Email', '', { type: 'code', code: 'text/html', multiline: true, @@ -840,7 +840,7 @@ RocketChat.settings.addGroup('Message', function() { type: 'boolean', 'public': true }); - return this.add('Message_HideType_mute_unmute', false, { + this.add('Message_HideType_mute_unmute', false, { type: 'boolean', 'public': true }); @@ -862,7 +862,7 @@ RocketChat.settings.addGroup('Meta', function() { this.add('Meta_msvalidate01', '', { type: 'string' }); - return this.add('Meta_custom', '', { + this.add('Meta_custom', '', { type: 'code', code: 'text/html', multiline: true @@ -948,23 +948,25 @@ RocketChat.settings.addGroup('Push', function() { this.add('Push_gcm_api_key', '', { type: 'string' }); - return this.add('Push_gcm_project_number', '', { + this.add('Push_gcm_project_number', '', { type: 'string', 'public': true }); }); - return this.section('Privacy', function() { + this.section('Privacy', function() { this.add('Push_show_username_room', true, { type: 'boolean', 'public': true }); - return this.add('Push_show_message', true, { + this.add('Push_show_message', true, { type: 'boolean', 'public': true }); }); }); +RocketChat.settings.addGroup('Colors'); + RocketChat.settings.addGroup('Layout', function() { this.section('Content', function() { this.add('Layout_Home_Title', 'Home', { @@ -994,7 +996,7 @@ RocketChat.settings.addGroup('Layout', function() { multiline: true, 'public': true }); - return this.add('Layout_Sidenav_Footer', '', { + this.add('Layout_Sidenav_Footer', '', { type: 'code', code: 'text/html', 'public': true, @@ -1007,13 +1009,13 @@ RocketChat.settings.addGroup('Layout', function() { multiline: true, 'public': true }); - return this.add('Custom_Script_Logged_In', '//Add your script', { + this.add('Custom_Script_Logged_In', '//Add your script', { type: 'code', multiline: true, 'public': true }); }); - return this.section('User_Interface', function() { + this.section('User_Interface', function() { this.add('UI_DisplayRoles', true, { type: 'boolean', 'public': true @@ -1058,7 +1060,7 @@ RocketChat.settings.addGroup('Logs', function() { type: 'boolean', 'public': true }); - return this.add('Log_View_Limit', 1000, { + this.add('Log_View_Limit', 1000, { type: 'int' }); }); diff --git a/packages/rocketchat-theme/server/server.js b/packages/rocketchat-theme/server/server.js index 102129dcb42..04018ed14f3 100644 --- a/packages/rocketchat-theme/server/server.js +++ b/packages/rocketchat-theme/server/server.js @@ -117,6 +117,19 @@ RocketChat.theme = new class { }); } + addColor(name, value, section, property) { + const config = { + group: 'Colors', + type: 'color', + editor: 'color', + public: true, + property, + section + }; + + return RocketChat.settings.add(`theme-color-${ name }`, value, config); + } + addVariable(type, name, value, section, persist = true, editor, allowedTypes, property) { this.variables[name] = { type, diff --git a/packages/rocketchat-theme/server/variables.js b/packages/rocketchat-theme/server/variables.js index 4977435b353..e6d46be05bf 100644 --- a/packages/rocketchat-theme/server/variables.js +++ b/packages/rocketchat-theme/server/variables.js @@ -87,7 +87,7 @@ const sidebar = [ } ]; -sidebar.forEach(setting => RocketChat.theme.addPublicColor(setting.class, setting.value, 'Sidebar', 'color', setting.property)); +sidebar.forEach(setting => RocketChat.theme.addColor(setting.class, setting.value, 'Sidebar', setting.property)); // Bulk-add settings for color scheme @@ -106,8 +106,8 @@ RocketChat.theme.addPublicFont('body-font-family', '-apple-system, BlinkMacSyste RocketChat.settings.add('theme-custom-css', '', { group: 'Layout', type: 'code', - code: 'text/x-less', + code: 'text/css', multiline: true, section: 'Custom CSS', - public: false + public: true }); diff --git a/packages/rocketchat-ui-master/client/main.js b/packages/rocketchat-ui-master/client/main.js index 1c7ece111eb..fde1a82aaee 100644 --- a/packages/rocketchat-ui-master/client/main.js +++ b/packages/rocketchat-ui-master/client/main.js @@ -1,7 +1,7 @@ -/* globals toolbarSearch, menu, isRtl, fireGlobalEvent, CachedChatSubscription */ +/* globals toolbarSearch, menu, isRtl, fireGlobalEvent, CachedChatSubscription, DynamicCss */ import Clipboard from 'clipboard'; -RocketChat.settings.collection.find({_id:/theme/}, {fields:{ value: 1 }}).observe({changed: () => { DynamicCss.run(); }}); +RocketChat.settings.collection.find({_id:/theme/}, {fields:{ value: 1, property: 1, type: 1 }}).observe({changed: () => { DynamicCss.run(); }}); Template.body.onRendered(function() { new Clipboard('.clipboard'); diff --git a/packages/rocketchat-ui-master/server/dynamic-css.js b/packages/rocketchat-ui-master/server/dynamic-css.js index e1ab1a7e60e..4d78f701315 100644 --- a/packages/rocketchat-ui-master/server/dynamic-css.js +++ b/packages/rocketchat-ui-master/server/dynamic-css.js @@ -1,3 +1,5 @@ +/* global DynamicCss */ + 'use strict'; export default () => { const debounce = (func, wait, immediate) => { @@ -20,11 +22,12 @@ export default () => { DynamicCss = typeof DynamicCss !=='undefined'? DynamicCss : {list:[]}; - const settingBackground = (setting) => `.${ setting._id }-background { background-color: ${ setting.value }; }`; - const settingColor = (setting) => `.${ setting._id }-color { color: ${ setting.value }; }`; + const colors = setting => setting._id.indexOf('theme-color') > -1 ? `.${ setting._id.replace('theme-color-', '') }{${ setting.property }:${ setting.value }}` : ''; + const customCss = setting => setting._id.indexOf('theme-custom-css') > -1 ? setting.value : ''; + const fontFamily = setting => setting._id.indexOf('theme-font-body-font-family') > -1 ? `body{${ setting.value }}` : ''; - const properties = [settingBackground, settingColor]; - const run = list => list.map(setting => properties.map(f => f(setting)).join('')).join(''); + const properties = [fontFamily, colors, customCss]; + const run = list => list.filter(setting => setting.value && setting.property || setting.type !== 'color').map(setting => properties.reduce((ret, f) => ret || f(setting), '')).join('\n'); DynamicCss.run = debounce(() => { const list = typeof RocketChat !== 'undefined' ? RocketChat.settings.collection.find({_id:/theme/}).fetch() : []; diff --git a/packages/rocketchat-ui-master/server/inject.js b/packages/rocketchat-ui-master/server/inject.js index 521749ae727..4130a8fa525 100644 --- a/packages/rocketchat-ui-master/server/inject.js +++ b/packages/rocketchat-ui-master/server/inject.js @@ -1,5 +1,5 @@ /* globals Inject */ -const variables = RocketChat.models.Settings.find({_id:/theme-/}, {fields: { value: 1 }}).fetch(); +const variables = RocketChat.models.Settings.find({_id:/theme-/}, {fields: { value: 1, property: 1, type: 1 }}).fetch(); Inject.rawHead('dynamic-variables', ``); -Inject.rawHead('dynamic', ``); +const renderDynamicCssList = () => { + const variables = RocketChat.models.Settings.find({_id:/theme-/}, {fields: { value: 1, property: 1, type: 1 }}).fetch(); + + Inject.rawHead('dynamic-variables', + ``); +}; + +renderDynamicCssList(); +RocketChat.models.Settings.find({_id:/theme-/}, {fields: { value: 1, property: 1, type: 1 }}).observe({ + changed: renderDynamicCssList +}); + +Inject.rawHead('dynamic', ``); -// Inject.rawHead('page-loading', ` `); +Inject.rawHead('page-loading', ``); Inject.rawBody('page-loading-div', `
From 72f3f4611282a252e7448b66cab8bbfe74517682 Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Thu, 1 Jun 2017 16:04:50 -0300 Subject: [PATCH 023/349] change sidebar background color --- packages/rocketchat-theme/server/colors.less | 4 ---- packages/rocketchat-ui-sidenav/client/accountBox.html | 4 ++-- packages/rocketchat-ui-sidenav/client/sideNav.html | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/rocketchat-theme/server/colors.less b/packages/rocketchat-theme/server/colors.less index 0c191b7c3f1..46cc6acbe6b 100755 --- a/packages/rocketchat-theme/server/colors.less +++ b/packages/rocketchat-theme/server/colors.less @@ -641,10 +641,6 @@ a:hover { background-color: @tertiary-font-color; } - .rooms-list { - background-color: lighten(@primary-background-color, 2.5%); - } - li.active { background-color: @transparent-light !important; } diff --git a/packages/rocketchat-ui-sidenav/client/accountBox.html b/packages/rocketchat-ui-sidenav/client/accountBox.html index f7151a3442a..1d63a7df9de 100644 --- a/packages/rocketchat-ui-sidenav/client/accountBox.html +++ b/packages/rocketchat-ui-sidenav/client/accountBox.html @@ -1,7 +1,7 @@