From 34f819dea90f996392a0e8fb4980a8ac7bc419a8 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Fri, 17 May 2019 12:55:56 +0530 Subject: [PATCH 01/18] add setting for articles --- app/articles/README.md | 1 + app/articles/client/index.js | 1 + app/articles/index.js | 0 app/articles/server/index.js | 3 + app/articles/server/settings.js | 16 ++ client/importPackages.js | 1 + package-lock.json | 318 ++++++++------------------------ server/importPackages.js | 1 + 8 files changed, 97 insertions(+), 244 deletions(-) create mode 100644 app/articles/README.md create mode 100644 app/articles/client/index.js create mode 100644 app/articles/index.js create mode 100644 app/articles/server/index.js create mode 100644 app/articles/server/settings.js diff --git a/app/articles/README.md b/app/articles/README.md new file mode 100644 index 000000000000..f117eed00aab --- /dev/null +++ b/app/articles/README.md @@ -0,0 +1 @@ +Readme file for articles. diff --git a/app/articles/client/index.js b/app/articles/client/index.js new file mode 100644 index 000000000000..527454399bb2 --- /dev/null +++ b/app/articles/client/index.js @@ -0,0 +1 @@ +console.log('Client side'); diff --git a/app/articles/index.js b/app/articles/index.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/app/articles/server/index.js b/app/articles/server/index.js new file mode 100644 index 000000000000..3fa82d58f5c2 --- /dev/null +++ b/app/articles/server/index.js @@ -0,0 +1,3 @@ +import './settings'; + +console.log('Server side'); diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js new file mode 100644 index 000000000000..6b5808904b28 --- /dev/null +++ b/app/articles/server/settings.js @@ -0,0 +1,16 @@ +import { Meteor } from 'meteor/meteor'; + +import { settings } from '../../settings'; + +const defaults = { + enable: true, +}; + +Meteor.startup(() => { + settings.addGroup('Articles', function() { + this.add('Articles_enable', defaults.enable, { + type: 'boolean', + i18nLabel: 'Enable', + }); + }); +}); diff --git a/client/importPackages.js b/client/importPackages.js index 32e492e5d21d..f9044032e831 100644 --- a/client/importPackages.js +++ b/client/importPackages.js @@ -108,3 +108,4 @@ import '../app/ui-cached-collection'; import '../app/action-links'; import '../app/reactions/client'; import '../app/livechat/client'; +import '../app/articles/client'; diff --git a/package-lock.json b/package-lock.json index 672f1a1c6ad8..09e0c4b6e895 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3978,16 +3978,6 @@ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "dev": true }, - "camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", @@ -4324,13 +4314,11 @@ "chromedriver": "^2.35", "colors": "1.1.2", "commander": "^2.9.0", - "cucumber": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", "deep-extend": "^0.4.1", "exit": "^0.1.2", "fibers": "^1.0.14", "freeport": "~1.0.5", "fs-extra": "^1.0.0", - "glob": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", "hapi": "8.8.0", "jasmine": "^2.4.1", "loglevel": "~1.4.0", @@ -4368,6 +4356,27 @@ "type-detect": "^4.0.0" } }, + "cucumber": { + "version": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", + "from": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", + "requires": { + "camel-case": "^3.0.0", + "cli-table": "^0.3.1", + "co": "^4.6.0", + "colors": "^1.1.2", + "commander": "^2.9.0", + "duration": "^0.2.0", + "fibers": "^1.0.7", + "figures": "1.7.0", + "gherkin": "4.0.0", + "glob": "^7.0.0", + "is-generator": "^1.0.2", + "lodash": "^4.0.0", + "meteor-promise": "^0.8.0", + "stack-chain": "^1.3.5", + "stacktrace-js": "^1.3.0" + } + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -4386,13 +4395,11 @@ "fibers": { "version": "1.0.15", "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", - "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", - "dev": true + "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=" }, "glob": { - "version": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", - "from": "github:lucetius/node-glob#chimp", - "dev": true, + "version": "7.1.1", + "resolved": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4469,8 +4476,7 @@ "once": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/once/-/once-1.3.0.tgz", - "integrity": "sha1-FRr4a/wfCMS58H0GqyUP/L61ZYE=", - "dev": true + "integrity": "sha1-FRr4a/wfCMS58H0GqyUP/L61ZYE=" }, "progress": { "version": "1.1.8", @@ -4616,23 +4622,6 @@ "restore-cursor": "^2.0.0" } }, - "cli-table": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", - "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", - "dev": true, - "requires": { - "colors": "1.0.3" - }, - "dependencies": { - "colors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", - "dev": true - } - } - }, "cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", @@ -4750,8 +4739,7 @@ "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" }, "colour": { "version": "0.7.1", @@ -5179,36 +5167,6 @@ "integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=", "dev": true }, - "cucumber": { - "version": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", - "from": "github:xolvio/cucumber-js#v1.3.0-chimp.6", - "dev": true, - "requires": { - "camel-case": "^3.0.0", - "cli-table": "^0.3.1", - "co": "^4.6.0", - "colors": "^1.1.2", - "commander": "^2.9.0", - "duration": "^0.2.0", - "fibers": "^1.0.7", - "figures": "1.7.0", - "gherkin": "4.0.0", - "glob": "^7.0.0", - "is-generator": "^1.0.2", - "lodash": "^4.0.0", - "meteor-promise": "^0.8.0", - "stack-chain": "^1.3.5", - "stacktrace-js": "^1.3.0" - }, - "dependencies": { - "fibers": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", - "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", - "dev": true - } - } - }, "cuid": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/cuid/-/cuid-1.3.8.tgz", @@ -5246,15 +5204,6 @@ "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", "dev": true }, - "d": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", - "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true, - "requires": { - "es5-ext": "^0.10.9" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -5830,16 +5779,6 @@ "stream-shift": "^1.0.0" } }, - "duration": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/duration/-/duration-0.2.2.tgz", - "integrity": "sha512-06kgtea+bGreF5eKYgI/36A6pLXggY7oR4p1pq4SmdFBn1ReOL5D8RhG64VrqfTTKNucqqtBAwEj8aB88mcqrg==", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.46" - } - }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -6025,15 +5964,6 @@ } } }, - "error-stack-parser": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-1.3.6.tgz", - "integrity": "sha1-4Oc7k+QXE40c18C3RrGkoUhUwpI=", - "dev": true, - "requires": { - "stackframe": "^0.3.1" - } - }, "es-abstract": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", @@ -6056,28 +5986,6 @@ "is-symbol": "^1.0.2" } }, - "es5-ext": { - "version": "0.10.50", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz", - "integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==", - "dev": true, - "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "^1.0.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, "es6-promise": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", @@ -6091,16 +5999,6 @@ "es6-promise": "^4.0.3" } }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -7067,16 +6965,6 @@ "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", "dev": true }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, "file-entry-cache": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", @@ -7409,12 +7297,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7429,17 +7319,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7556,7 +7449,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7568,6 +7462,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7582,6 +7477,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7589,12 +7485,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7613,6 +7511,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7693,7 +7592,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7705,6 +7605,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7826,6 +7727,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8010,12 +7912,6 @@ "assert-plus": "^1.0.0" } }, - "gherkin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-4.0.0.tgz", - "integrity": "sha1-edzgTRIj6kO0hip2vlzo+JwSwyw=", - "dev": true - }, "github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -9159,6 +9055,18 @@ "hoek": "2.x.x", "joi": "6.x.x", "wreck": "5.x.x" + }, + "dependencies": { + "wreck": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/wreck/-/wreck-5.6.1.tgz", + "integrity": "sha1-r/ADBAATiJ11YZtccYcN0qjdBpo=", + "dev": true, + "requires": { + "boom": "2.x.x", + "hoek": "2.x.x" + } + } } }, "heavy": { @@ -9170,6 +9078,20 @@ "boom": "2.x.x", "hoek": "2.x.x", "joi": "5.x.x" + }, + "dependencies": { + "joi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-5.1.0.tgz", + "integrity": "sha1-FSrQfbjunGQBmX/1/SwSiWBwv1g=", + "dev": true, + "requires": { + "hoek": "^2.2.x", + "isemail": "1.x.x", + "moment": "2.x.x", + "topo": "1.x.x" + } + } } }, "hoek": { @@ -10315,12 +10237,6 @@ "number-is-nan": "^1.0.0" } }, - "is-generator": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", - "integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=", - "dev": true - }, "is-glob": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", @@ -11523,12 +11439,6 @@ "signal-exit": "^3.0.0" } }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", - "dev": true - }, "lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -12029,8 +11939,7 @@ "meteor-promise": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/meteor-promise/-/meteor-promise-0.8.6.tgz", - "integrity": "sha512-HP6tOr67z/9XU2Dr0F2SSr8WRTuE23AG9Dj578DCJPEYHs67OLKBviU8A8rwvbwMD7Lu2+Of+yAMz2Wd8r4yxg==", - "dev": true + "integrity": "sha512-HP6tOr67z/9XU2Dr0F2SSr8WRTuE23AG9Dj578DCJPEYHs67OLKBviU8A8rwvbwMD7Lu2+Of+yAMz2Wd8r4yxg==" }, "methods": { "version": "1.1.2", @@ -12609,26 +12518,11 @@ "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", "dev": true }, - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", - "dev": true - }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, - "no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "dev": true, - "requires": { - "lower-case": "^1.1.1" - } - }, "node-abi": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.7.1.tgz", @@ -15934,69 +15828,11 @@ "figgy-pudding": "^3.5.1" } }, - "stack-chain": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz", - "integrity": "sha1-0ZLJ/06moiyUxN1FkXHj8AzqEoU=", - "dev": true - }, - "stack-generator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-1.1.0.tgz", - "integrity": "sha1-NvapIHUabBD0maE8Msu19RoLiyU=", - "dev": true, - "requires": { - "stackframe": "^1.0.2" - }, - "dependencies": { - "stackframe": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.4.tgz", - "integrity": "sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw==", - "dev": true - } - } - }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, - "stackframe": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-0.3.1.tgz", - "integrity": "sha1-M6qE8Rd6VUjIk1Uzy/6zQgl19aQ=", - "dev": true - }, - "stacktrace-gps": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-2.4.4.tgz", - "integrity": "sha1-acgn6dbW9Bz0ONfxleLjy/zyjEQ=", - "dev": true, - "requires": { - "source-map": "0.5.6", - "stackframe": "~0.3" - }, - "dependencies": { - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", - "dev": true - } - } - }, - "stacktrace-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-1.3.1.tgz", - "integrity": "sha1-Z8qyWJr1xBe5Yvc2mUAne7O2oYs=", - "dev": true, - "requires": { - "error-stack-parser": "^1.3.6", - "stack-generator": "^1.0.7", - "stacktrace-gps": "^2.4.3" - } - }, "starttls": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/starttls/-/starttls-1.0.1.tgz", @@ -17322,12 +17158,6 @@ "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, - "upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", - "dev": true - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", diff --git a/server/importPackages.js b/server/importPackages.js index 40daed01b3de..646d2864a492 100644 --- a/server/importPackages.js +++ b/server/importPackages.js @@ -116,3 +116,4 @@ import '../app/ui-utils'; import '../app/action-links'; import '../app/reactions/server'; import '../app/livechat/server'; +import '../app/articles/server'; From d445ea46b42d0cf6ec23542cbcf114307b7c1d4b Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Fri, 17 May 2019 18:52:58 +0530 Subject: [PATCH 02/18] add redirect to articles admin --- app/articles/server/index.js | 2 -- app/articles/server/methods/admin.js | 17 +++++++++++++++++ app/articles/server/methods/user.js | 0 app/articles/server/settings.js | 7 ++++++- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 app/articles/server/methods/admin.js create mode 100644 app/articles/server/methods/user.js diff --git a/app/articles/server/index.js b/app/articles/server/index.js index 3fa82d58f5c2..97097791afdc 100644 --- a/app/articles/server/index.js +++ b/app/articles/server/index.js @@ -1,3 +1 @@ import './settings'; - -console.log('Server side'); diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js new file mode 100644 index 000000000000..41dff6d15512 --- /dev/null +++ b/app/articles/server/methods/admin.js @@ -0,0 +1,17 @@ +import { Meteor } from 'meteor/meteor'; + +import { settings } from '../../../settings'; + +Meteor.methods({ + Articles_admin_panel() { + const enabled = settings.get('Articles_enabled'); + + if (!enabled) { + throw new Meteor.Error('Articles are disabled'); + } + + return { + message: 'Redirecting to articles admin panel', + }; + }, +}); diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 6b5808904b28..e8a224367a43 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -8,9 +8,14 @@ const defaults = { Meteor.startup(() => { settings.addGroup('Articles', function() { - this.add('Articles_enable', defaults.enable, { + this.add('Articles_enabled', defaults.enable, { type: 'boolean', i18nLabel: 'Enable', }); + + this.add('Articles_admin_panel', 'Articles_admin_panel', { + type: 'action', + actionText: 'Article_Admin_Panel', + }); }); }); From 6c1d6b64e05eea466bf3eecdfd075557f0c6303c Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Thu, 30 May 2019 13:48:50 +0530 Subject: [PATCH 03/18] add icon and redirect for user --- app/articles/client/admin.js | 0 app/articles/client/index.js | 2 +- app/articles/server/index.js | 2 + app/articles/server/methods/admin.js | 66 ++++++++++++++++++- app/articles/server/methods/user.js | 17 +++++ app/articles/server/settings.js | 18 +++++- app/ui-admin/client/admin.html | 8 +++ app/ui-admin/client/admin.js | 21 +++++- app/ui-master/public/icons/articles.svg | 81 ++++++++++++++++++++++++ app/ui-sidenav/client/sidebarHeader.js | 28 +++++++- app/ui-utils/client/index.js | 1 + app/ui-utils/client/lib/redirectToUrl.js | 8 +++ private/public/icons.svg | 67 ++++++++++++++++++++ public/public/icons.html | 69 +++++++++++++++++++- 14 files changed, 377 insertions(+), 11 deletions(-) create mode 100644 app/articles/client/admin.js create mode 100644 app/ui-master/public/icons/articles.svg create mode 100644 app/ui-utils/client/lib/redirectToUrl.js diff --git a/app/articles/client/admin.js b/app/articles/client/admin.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/app/articles/client/index.js b/app/articles/client/index.js index 527454399bb2..e69620c8cbc8 100644 --- a/app/articles/client/index.js +++ b/app/articles/client/index.js @@ -1 +1 @@ -console.log('Client side'); +import './admin'; diff --git a/app/articles/server/index.js b/app/articles/server/index.js index 97097791afdc..c01f07b9128c 100644 --- a/app/articles/server/index.js +++ b/app/articles/server/index.js @@ -1 +1,3 @@ import './settings'; +import './methods/admin'; +import './methods/user'; diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 41dff6d15512..b28200989c15 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,7 +1,11 @@ import { Meteor } from 'meteor/meteor'; +import { HTTP } from 'meteor/http'; import { settings } from '../../../settings'; +const blogUrl = 'http://localhost:2368/ghost/api/v2/admin/authentication/setup/'; +const sessionUrl = 'http://localhost:2368/ghost/api/v2/admin/session/'; + Meteor.methods({ Articles_admin_panel() { const enabled = settings.get('Articles_enabled'); @@ -9,9 +13,65 @@ Meteor.methods({ if (!enabled) { throw new Meteor.Error('Articles are disabled'); } - - return { - message: 'Redirecting to articles admin panel', + const user = Meteor.users.findOne(Meteor.userId()); + const options = { + data: { + username: user.emails[0].address, + password: 'qwe123qwe123', + }, + headers: { + 'Content-Type': 'application/json', + Referer: 'http://localhost:2368/ghost/', + }, }; + let response = HTTP.call('GET', blogUrl); + if (response.data && response.data.setup && response.data.setup[0]) { + if (response.data.setup[0].status) { // Ghost site is already setup + response = HTTP.call('POST', sessionUrl, options); + console.log(response); + if (response.statusCode === 201 && response.content === 'Created') { + console.log(response); + return { + link: 'http://localhost:2368/ghost/', + options, + message: 'Ghost is Set up. Redirecting...', + }; + } + } else { // Setup Ghost Site and set title + const blogTitle = settings.get('Article_Site_title'); + const data = { + setup: [{ + name: user.name, + email: user.emails[0].address, + password: 'qwe123qwe123', + blogTitle, + }], + }; + response = HTTP.call('POST', blogUrl, { data, headers: { 'Content-Type': 'application/json' } }); + if (response.statusCode === 201 && response.content && response.content.users[0]) { + response = HTTP.call('POST', sessionUrl, options); + if (response.status === 201 && response.content === 'Created') { + return { + link: 'http://localhost:2368/ghost/', + options, + message: 'Ghost is Set up. Redirecting...', + }; + } + } else if (response.errors) { + throw new Meteor.Error(response.errors.message || 'Unable to redirect. Make sure Ghost is running'); + } + } + } + throw new Meteor.Error('Unable to redirect. Make sure Ghost is running'); }, }); + +/* + *function getVerifiedEmail(emails) { + * const email = emails[0].address; + * emails.forEach((e) => { + * if (e.verified) { return e.address; } + * return email; + * }); + *} + */ diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index e69de29bb2d1..81ead833277e 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -0,0 +1,17 @@ +import { Meteor } from 'meteor/meteor'; + +import { settings } from '../../../settings'; + +Meteor.methods({ + redirectUserToArticles() { + const enabled = settings.get('Articles_enabled'); + + if (!enabled) { + throw new Meteor.Error('Articles are disabled'); + } + + return { + message: 'Redirecting to articles admin panel', + }; + }, +}); diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index e8a224367a43..770bbf3c96b7 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -11,11 +11,25 @@ Meteor.startup(() => { this.add('Articles_enabled', defaults.enable, { type: 'boolean', i18nLabel: 'Enable', + public: true, + }); + + this.add('Article_Site_title', 'Rocket.Chat', { + type: 'string', + enableQuery: { + _id: 'Articles_enabled', + value: true, + }, + public: true, }); this.add('Articles_admin_panel', 'Articles_admin_panel', { - type: 'action', - actionText: 'Article_Admin_Panel', + type: 'link', + enableQuery: { + _id: 'Articles_enabled', + value: true, + }, + linkText: 'Article_Admin_Panel', }); }); }); diff --git a/app/ui-admin/client/admin.html b/app/ui-admin/client/admin.html index 1eaa5c0c81a0..25d7118ba457 100644 --- a/app/ui-admin/client/admin.html +++ b/app/ui-admin/client/admin.html @@ -153,6 +153,14 @@ {{/if}} {{/if}} + {{#if $eq type 'link'}} + {{#if hasChanges section}} + {{_ "Save_to_enable_this_action"}} + {{else}} + + {{/if}} + {{/if}} + {{#if $eq type 'asset'}} {{#if value.url}}
diff --git a/app/ui-admin/client/admin.js b/app/ui-admin/client/admin.js index 0167a036e680..63169f8e358e 100644 --- a/app/ui-admin/client/admin.js +++ b/app/ui-admin/client/admin.js @@ -11,7 +11,7 @@ import s from 'underscore.string'; import toastr from 'toastr'; import { settings } from '../../settings'; -import { SideNav, modal } from '../../ui-utils'; +import { SideNav, modal, redirectToUrl } from '../../ui-utils'; import { t, handleError } from '../../utils'; import { CachedCollection } from '../../ui-cached-collection'; @@ -571,6 +571,25 @@ Template.admin.events({ toastr.success(TAPi18n.__.apply(TAPi18n, args), TAPi18n.__('Success')); }); }, + 'click button.link'() { + if (this.type !== 'link') { + return; + } + toastr.success('here', 'yo'); + Meteor.call(this.value, function(err, data) { + if (err != null) { + err.details = _.extend(err.details || {}, { + errorTitle: 'Error', + }); + handleError(err); + return; + } + toastr.success(data.message, 'yo'); + if (data.link && data.options) { redirectToUrl(data.link, data.options); } + const args = [data.message].concat(data.params); + toastr.success(TAPi18n.__.apply(TAPi18n, args), TAPi18n.__('Success')); + }); + }, 'click .button-fullscreen'() { const codeMirrorBox = $(`.code-mirror-box[data-editor-id="${ this._id }"]`); codeMirrorBox.addClass('code-mirror-box-fullscreen content-background-color'); diff --git a/app/ui-master/public/icons/articles.svg b/app/ui-master/public/icons/articles.svg new file mode 100644 index 000000000000..f97bc75e92c5 --- /dev/null +++ b/app/ui-master/public/icons/articles.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/ui-sidenav/client/sidebarHeader.js b/app/ui-sidenav/client/sidebarHeader.js index a35519ed0c62..edc1faad2d91 100644 --- a/app/ui-sidenav/client/sidebarHeader.js +++ b/app/ui-sidenav/client/sidebarHeader.js @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; +import toastr from 'toastr'; import { popover, AccountBox, menu, SideNav, modal } from '../../ui-utils'; import { t, getUserPreference, handleError } from '../../utils'; @@ -217,6 +218,25 @@ const toolbarButtons = (user) => [{ popover.open(config); }, }, +{ + name: t('Articles'), + icon: 'articles', + condition: () => settings.get('Articles_enabled'), + action: () => { + const userID = localStorage.getItem('Meteor.userId'); + const loginToken = localStorage.getItem('Meteor.loginToken'); + const url = `http://www.localhost:2368/ghost/session?user_id=${ userID }&access_token=${ loginToken }`; + const redirectWindow = window.open(url, '_blank'); + // redirectWindow.document.cookie = "name=oeschger"; + toastr.success(redirectWindow.document.cookie, 'Success'); + redirectWindow.location; + // Meteor.call('redirectUserToArticles', function(error) { + // if (error) { + // return handleError(error); + // } + // }); + }, +}, { name: t('Options'), icon: 'menu', @@ -293,9 +313,11 @@ Template.sidebarHeader.helpers({ status: 'online', }; } - return id && Meteor.users.findOne(id, { fields: { - username: 1, status: 1, - } }); + return id && Meteor.users.findOne(id, { + fields: { + username: 1, status: 1, + }, + }); }, toolbarButtons() { return toolbarButtons(Meteor.userId()).filter((button) => !button.condition || button.condition()); diff --git a/app/ui-utils/client/index.js b/app/ui-utils/client/index.js index 293698e9d66f..558e8a19d74a 100644 --- a/app/ui-utils/client/index.js +++ b/app/ui-utils/client/index.js @@ -25,6 +25,7 @@ export { MessageTypes } from '../lib/MessageTypes'; export { alerts } from './lib/alerts'; export { Message } from '../lib/Message'; export { openRoom } from './lib/openRoom'; +export { redirectToUrl } from './lib/redirectToUrl'; export * from './lib/rtl'; export * from './lib/keyCodes'; export * from './lib/prependReplies'; diff --git a/app/ui-utils/client/lib/redirectToUrl.js b/app/ui-utils/client/lib/redirectToUrl.js new file mode 100644 index 000000000000..e24525f3e369 --- /dev/null +++ b/app/ui-utils/client/lib/redirectToUrl.js @@ -0,0 +1,8 @@ +//import { Meteor } from 'meteor/meteor'; +import toastr from 'toastr'; + +export const redirectToUrl = (url, options) => { + toastr.success(options, 'Success'); + const redirectWindow = window.open(url, '_blank'); + redirectWindow.location; +}; diff --git a/private/public/icons.svg b/private/public/icons.svg index 6ae97ffaea94..2e0c613ab60c 100644 --- a/private/public/icons.svg +++ b/private/public/icons.svg @@ -5,6 +5,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/public/icons.html b/public/public/icons.html index 050d518c5196..c0d77c7f6c7a 100644 --- a/public/public/icons.html +++ b/public/public/icons.html @@ -22,13 +22,80 @@ height: 20px; color: blue; } -
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5bb8d9aff2bc44faa529779fc62759fcbffd4d38 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Tue, 4 Jun 2019 04:20:25 +0530 Subject: [PATCH 04/18] improve code structure --- app/articles/client/admin.js | 0 app/articles/client/index.js | 2 +- app/articles/server/methods/admin.js | 92 ++-- app/articles/server/methods/user.js | 97 +++- app/articles/server/settings.js | 9 + app/articles/server/utils/url.js | 38 ++ app/ui-admin/client/admin.js | 13 +- app/ui-sidenav/client/sidebarHeader.js | 21 +- app/ui-utils/client/index.js | 1 - app/ui-utils/client/lib/redirectToUrl.js | 8 - package-lock.json | 570 +++++++++++++++-------- 11 files changed, 580 insertions(+), 271 deletions(-) delete mode 100644 app/articles/client/admin.js create mode 100644 app/articles/server/utils/url.js delete mode 100644 app/ui-utils/client/lib/redirectToUrl.js diff --git a/app/articles/client/admin.js b/app/articles/client/admin.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/app/articles/client/index.js b/app/articles/client/index.js index e69620c8cbc8..dcd62b2ff2d7 100644 --- a/app/articles/client/index.js +++ b/app/articles/client/index.js @@ -1 +1 @@ -import './admin'; +console.log('articles'); diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index b28200989c15..b905e7f8e830 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,68 +1,78 @@ import { Meteor } from 'meteor/meteor'; import { HTTP } from 'meteor/http'; +import { API } from '../utils/url'; import { settings } from '../../../settings'; -const blogUrl = 'http://localhost:2368/ghost/api/v2/admin/authentication/setup/'; -const sessionUrl = 'http://localhost:2368/ghost/api/v2/admin/session/'; +const api = new API(); + +function setupGhost(user, token, rcUrl) { + const blogTitle = settings.get('Article_Site_title'); + const data = { + setup: [{ + rc_url: rcUrl, + rc_id: user._id, + rc_token: token, + name: user.name, + email: user.emails[0].address, + password: 'qwe123qwe123', // TODO send random password; remove password field + blogTitle, + }], + }; + return HTTP.call('POST', api.setup(), { data, headers: { 'Content-Type': 'application/json' } }); +} + +function createSession(options) { + const response = HTTP.call('POST', api.session(), options); + if (response.statusCode === 201 && response.content === 'Created' && response.headers && response.headers['set-cookie']) { + let cookie = response.headers['set-cookie'][0].split(';'); + cookie = `${ cookie[0] };${ cookie[1] };${ cookie[2] };${ cookie[4] }`; + return { + link: api.siteUrl(), + cookie, + message: 'Ghost is Set up. Redirecting.', + }; + } +} Meteor.methods({ - Articles_admin_panel() { + Articles_admin_panel(token) { const enabled = settings.get('Articles_enabled'); if (!enabled) { throw new Meteor.Error('Articles are disabled'); } const user = Meteor.users.findOne(Meteor.userId()); + const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const options = { data: { - username: user.emails[0].address, - password: 'qwe123qwe123', + rc_id: user._id, + rc_token: token, }, headers: { 'Content-Type': 'application/json', - Referer: 'http://localhost:2368/ghost/', + Referer: api.siteUrl(), }, }; - let response = HTTP.call('GET', blogUrl); - if (response.data && response.data.setup && response.data.setup[0]) { - if (response.data.setup[0].status) { // Ghost site is already setup - response = HTTP.call('POST', sessionUrl, options); - console.log(response); - if (response.statusCode === 201 && response.content === 'Created') { - console.log(response); - return { - link: 'http://localhost:2368/ghost/', - options, - message: 'Ghost is Set up. Redirecting...', - }; - } - } else { // Setup Ghost Site and set title - const blogTitle = settings.get('Article_Site_title'); - const data = { - setup: [{ - name: user.name, - email: user.emails[0].address, - password: 'qwe123qwe123', - blogTitle, - }], - }; - response = HTTP.call('POST', blogUrl, { data, headers: { 'Content-Type': 'application/json' } }); - if (response.statusCode === 201 && response.content && response.content.users[0]) { - response = HTTP.call('POST', sessionUrl, options); - if (response.status === 201 && response.content === 'Created') { - return { - link: 'http://localhost:2368/ghost/', - options, - message: 'Ghost is Set up. Redirecting...', - }; - } - } else if (response.errors) { + try { + let response = HTTP.call('GET', api.setup()); + + if (response.data && response.data.setup && response.data.setup[0]) { + if (response.data.setup[0].status) { // Ghost site is already setup + return createSession(options); + } // Setup Ghost Site and set title + response = setupGhost(user, token, rcUrl); + if (response.statusCode === 201 && response.content) { + return createSession(options); + } if (response.errors) { throw new Meteor.Error(response.errors.message || 'Unable to redirect. Make sure Ghost is running'); } + } else { + throw new Meteor.Error('Unable to redirect. Make sure Ghost is running.'); } + } catch (e) { + throw new Meteor.Error(e.error || 'Unable to connect to Ghost. Make sure Ghost is running.'); } - throw new Meteor.Error('Unable to redirect. Make sure Ghost is running'); }, }); diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index 81ead833277e..ed3159e68479 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -1,17 +1,106 @@ import { Meteor } from 'meteor/meteor'; +import { HTTP } from 'meteor/http'; +import { API } from '../utils/url'; import { settings } from '../../../settings'; +const api = new API(); + +// Adding user everytime when user redirects, server will return error if user already exist. +// TODO: Find any better way exist. +function addUser(user, accessToken) { + const data = { + user: [{ + rc_username: user.username, + role: 'Author', // User can add itself as Author, even if he/she is admin in RC + rc_uid: user._id, + rc_token: accessToken, + }], + }; + return HTTP.call('POST', api.createAccount(), { data, headers: { 'Content-Type': 'application/json' } }); +} + +function userExist(user, accessToken) { + const data = { + user: [{ + rc_uid: user._id, + rc_token: accessToken, + }], + }; + const response = HTTP.call('GET', api.userExist(), { data, headers: { 'Content-Type': 'application/json' } }); + return response.data && response.data.users[0] && response.data.users[0].exist; +} + +function inviteSetting() { + const response = HTTP.call('GET', api.invite()); + const { settings } = response.data; + + if (settings && settings[0] && settings[0].key === 'invite_only') { + return settings[0].value; + } + // default value in Ghost + return false; +} + +function createSession(options) { + const response = HTTP.call('POST', api.session(), options); + if (response.statusCode === 201 && response.content === 'Created' && response.headers && response.headers['set-cookie']) { + let cookie = response.headers['set-cookie'][0].split(';'); + cookie = `${ cookie[0] };${ cookie[1] };${ cookie[2] };${ cookie[4] }`; + return { + link: api.siteUrl(), + cookie, + message: 'Ghost is Set up. Redirecting.', + }; + } + throw new Meteor.Error('Unable to create Ghost Session.'); +} + Meteor.methods({ - redirectUserToArticles() { + redirectUserToArticles(accessToken) { const enabled = settings.get('Articles_enabled'); if (!enabled) { throw new Meteor.Error('Articles are disabled'); } - - return { - message: 'Redirecting to articles admin panel', + const user = Meteor.users.findOne(Meteor.userId()); + const options = { + data: { + rc_id: user._id, + rc_token: accessToken, + }, + headers: { + 'Content-Type': 'application/json', + Referer: api.siteUrl(), + }, }; + try { + let response = HTTP.call('GET', api.setup()); + if (response.data && response.data.setup && response.data.setup[0]) { + if (response.data.setup[0].status) { // Ghost site is already setup + const exist = userExist(user, accessToken); + if (exist) { + return createSession(options); + } + const inviteOnly = inviteSetting(); + + if (!inviteOnly) { + response = addUser(user, accessToken); + if (response.statusCode === 200) { + return createSession(options); + } + throw new Meteor.Error('Unable to setup your account.'); + } else { + throw new Meteor.Error('You are not a member of Ghost. Ask admin to add'); + } + } else { // Cannot setup Ghost from sidenav + throw new Meteor.Error('Ghost is not set up. Setup can be done from Admin Panel.'); + } + } else { + throw new Meteor.Error('Unable to redirect.'); + } + } catch (e) { + throw new Meteor.Error(e.error || 'Unable to connect to Ghost.'); + } }, }); diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 770bbf3c96b7..47cc506dcd5e 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -23,6 +23,15 @@ Meteor.startup(() => { public: true, }); + this.add('Article_Site_Url', 'http://localhost:2368', { + type: 'string', + enableQuery: { + _id: 'Articles_enabled', + value: true, + }, + public: true, + }); + this.add('Articles_admin_panel', 'Articles_admin_panel', { type: 'link', enableQuery: { diff --git a/app/articles/server/utils/url.js b/app/articles/server/utils/url.js new file mode 100644 index 000000000000..ba2be4c72c0c --- /dev/null +++ b/app/articles/server/utils/url.js @@ -0,0 +1,38 @@ +import { settings } from '../../../settings'; + +export class API { + constructor() { + this.adminApi = '/ghost/api/v2/admin'; + } + + buildAPIUrl(type, subtype = '') { + const base = settings.get('Article_Site_Url').replace(/\/$/, ''); + const dir = `/${ type }/${ subtype }`; + return base + this.adminApi + dir; + } + + siteUrl() { + const base = settings.get('Article_Site_Url').replace(/\/$/, ''); + return `${ base }/ghost`; + } + + setup() { + return this.buildAPIUrl('authentication', 'setup'); + } + + session() { + return this.buildAPIUrl('session'); + } + + invite() { + return this.buildAPIUrl('invitesetting'); + } + + createAccount() { + return this.buildAPIUrl('authentication', 'adduser'); + } + + userExist() { + return this.buildAPIUrl('userexist'); + } +} diff --git a/app/ui-admin/client/admin.js b/app/ui-admin/client/admin.js index 63169f8e358e..e73e2060ea5b 100644 --- a/app/ui-admin/client/admin.js +++ b/app/ui-admin/client/admin.js @@ -11,7 +11,7 @@ import s from 'underscore.string'; import toastr from 'toastr'; import { settings } from '../../settings'; -import { SideNav, modal, redirectToUrl } from '../../ui-utils'; +import { SideNav, modal } from '../../ui-utils'; import { t, handleError } from '../../utils'; import { CachedCollection } from '../../ui-cached-collection'; @@ -575,8 +575,8 @@ Template.admin.events({ if (this.type !== 'link') { return; } - toastr.success('here', 'yo'); - Meteor.call(this.value, function(err, data) { + const loginToken = localStorage.getItem('Meteor.loginToken'); + Meteor.call(this.value, loginToken, function(err, data) { if (err != null) { err.details = _.extend(err.details || {}, { errorTitle: 'Error', @@ -584,8 +584,11 @@ Template.admin.events({ handleError(err); return; } - toastr.success(data.message, 'yo'); - if (data.link && data.options) { redirectToUrl(data.link, data.options); } + if (data.link) { + const redirectWindow = window.open(data.link, '_blank'); + redirectWindow.document.cookie = data.cookie; + redirectWindow.location; + } const args = [data.message].concat(data.params); toastr.success(TAPi18n.__.apply(TAPi18n, args), TAPi18n.__('Success')); }); diff --git a/app/ui-sidenav/client/sidebarHeader.js b/app/ui-sidenav/client/sidebarHeader.js index edc1faad2d91..2d1186b16368 100644 --- a/app/ui-sidenav/client/sidebarHeader.js +++ b/app/ui-sidenav/client/sidebarHeader.js @@ -223,18 +223,17 @@ const toolbarButtons = (user) => [{ icon: 'articles', condition: () => settings.get('Articles_enabled'), action: () => { - const userID = localStorage.getItem('Meteor.userId'); const loginToken = localStorage.getItem('Meteor.loginToken'); - const url = `http://www.localhost:2368/ghost/session?user_id=${ userID }&access_token=${ loginToken }`; - const redirectWindow = window.open(url, '_blank'); - // redirectWindow.document.cookie = "name=oeschger"; - toastr.success(redirectWindow.document.cookie, 'Success'); - redirectWindow.location; - // Meteor.call('redirectUserToArticles', function(error) { - // if (error) { - // return handleError(error); - // } - // }); + + Meteor.call('redirectUserToArticles', loginToken, (error, result) => { + if (error) { + return handleError(error); + } + const redirectWindow = window.open(result.link, '_blank'); + redirectWindow.document.cookie = result.cookie; + toastr.success(result.message, 'Success'); + redirectWindow.location; + }); }, }, { diff --git a/app/ui-utils/client/index.js b/app/ui-utils/client/index.js index 558e8a19d74a..293698e9d66f 100644 --- a/app/ui-utils/client/index.js +++ b/app/ui-utils/client/index.js @@ -25,7 +25,6 @@ export { MessageTypes } from '../lib/MessageTypes'; export { alerts } from './lib/alerts'; export { Message } from '../lib/Message'; export { openRoom } from './lib/openRoom'; -export { redirectToUrl } from './lib/redirectToUrl'; export * from './lib/rtl'; export * from './lib/keyCodes'; export * from './lib/prependReplies'; diff --git a/app/ui-utils/client/lib/redirectToUrl.js b/app/ui-utils/client/lib/redirectToUrl.js deleted file mode 100644 index e24525f3e369..000000000000 --- a/app/ui-utils/client/lib/redirectToUrl.js +++ /dev/null @@ -1,8 +0,0 @@ -//import { Meteor } from 'meteor/meteor'; -import toastr from 'toastr'; - -export const redirectToUrl = (url, options) => { - toastr.success(options, 'Success'); - const redirectWindow = window.open(url, '_blank'); - redirectWindow.location; -}; diff --git a/package-lock.json b/package-lock.json index 09e0c4b6e895..91d917ae189f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Rocket.Chat", - "version": "1.1.0-develop", + "version": "1.2.0-develop", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -758,7 +758,7 @@ }, "@types/events": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" }, "@types/express": { @@ -1684,7 +1684,7 @@ }, "axios": { "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "requires": { "follow-redirects": "^1.3.0", @@ -2022,7 +2022,7 @@ }, "babel-plugin-add-module-exports": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz", "integrity": "sha1-mumh9KjcZ/DN7E9K7aHkOl/2XiU=", "dev": true }, @@ -2043,79 +2043,79 @@ }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, "babel-plugin-syntax-async-generators": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", "dev": true }, "babel-plugin-syntax-class-constructor-call": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", "dev": true }, "babel-plugin-syntax-class-properties": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", "dev": true }, "babel-plugin-syntax-decorators": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", "dev": true }, "babel-plugin-syntax-do-expressions": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz", "integrity": "sha1-V0d1YTmqJtOQ0JQQsDdEugfkeW0=", "dev": true }, "babel-plugin-syntax-dynamic-import": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", "dev": true }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "dev": true }, "babel-plugin-syntax-export-extensions": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", "dev": true }, "babel-plugin-syntax-flow": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", "dev": true }, "babel-plugin-syntax-function-bind": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz", "integrity": "sha1-SMSV8Xe98xqYHnMvVa3AvdJgH0Y=", "dev": true }, "babel-plugin-syntax-jsx": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=", "dev": true }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, @@ -2512,7 +2512,7 @@ }, "babel-preset-es2015": { "version": "6.3.13", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.3.13.tgz", + "resolved": "http://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.3.13.tgz", "integrity": "sha1-l9zn7ykuGMubK3VF2AxZPCjZUX8=", "dev": true, "requires": { @@ -2540,7 +2540,7 @@ }, "babel-preset-react": { "version": "6.3.13", - "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.3.13.tgz", + "resolved": "http://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.3.13.tgz", "integrity": "sha1-E9VeBqZfqqoHw5v2Op2DbgMhFvo=", "dev": true, "requires": { @@ -2554,7 +2554,7 @@ }, "babel-preset-stage-0": { "version": "6.3.13", - "resolved": "https://registry.npmjs.org/babel-preset-stage-0/-/babel-preset-stage-0-6.3.13.tgz", + "resolved": "http://registry.npmjs.org/babel-preset-stage-0/-/babel-preset-stage-0-6.3.13.tgz", "integrity": "sha1-eKN8VvCzmI8qeZMtywzrj/N3sNE=", "dev": true, "requires": { @@ -3461,7 +3461,7 @@ }, "bl": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz", "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", "requires": { "readable-stream": "^2.3.5", @@ -3560,7 +3560,7 @@ }, "boom": { "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "resolved": "http://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "requires": { "hoek": "2.x.x" @@ -3845,7 +3845,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -3978,6 +3978,16 @@ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "dev": true }, + "camel-case": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", + "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", + "dev": true, + "requires": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", @@ -4191,7 +4201,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { "ansi-styles": "^2.2.1", @@ -4294,7 +4304,7 @@ }, "chimp": { "version": "0.51.1", - "resolved": "https://registry.npmjs.org/chimp/-/chimp-0.51.1.tgz", + "resolved": "http://registry.npmjs.org/chimp/-/chimp-0.51.1.tgz", "integrity": "sha1-6hIbzfJsidV/jvNBlUDPPCeaPMU=", "dev": true, "requires": { @@ -4314,11 +4324,13 @@ "chromedriver": "^2.35", "colors": "1.1.2", "commander": "^2.9.0", + "cucumber": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", "deep-extend": "^0.4.1", "exit": "^0.1.2", "fibers": "^1.0.14", "freeport": "~1.0.5", "fs-extra": "^1.0.0", + "glob": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", "hapi": "8.8.0", "jasmine": "^2.4.1", "loglevel": "~1.4.0", @@ -4338,7 +4350,7 @@ "dependencies": { "async": { "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -4356,27 +4368,6 @@ "type-detect": "^4.0.0" } }, - "cucumber": { - "version": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", - "from": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", - "requires": { - "camel-case": "^3.0.0", - "cli-table": "^0.3.1", - "co": "^4.6.0", - "colors": "^1.1.2", - "commander": "^2.9.0", - "duration": "^0.2.0", - "fibers": "^1.0.7", - "figures": "1.7.0", - "gherkin": "4.0.0", - "glob": "^7.0.0", - "is-generator": "^1.0.2", - "lodash": "^4.0.0", - "meteor-promise": "^0.8.0", - "stack-chain": "^1.3.5", - "stacktrace-js": "^1.3.0" - } - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -4395,11 +4386,13 @@ "fibers": { "version": "1.0.15", "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", - "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=" + "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", + "dev": true }, "glob": { - "version": "7.1.1", - "resolved": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", + "version": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", + "from": "github:lucetius/node-glob#chimp", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4429,7 +4422,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -4476,11 +4469,12 @@ "once": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/once/-/once-1.3.0.tgz", - "integrity": "sha1-FRr4a/wfCMS58H0GqyUP/L61ZYE=" + "integrity": "sha1-FRr4a/wfCMS58H0GqyUP/L61ZYE=", + "dev": true }, "progress": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -4503,7 +4497,7 @@ }, "chokidar": { "version": "1.6.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.6.1.tgz", + "resolved": "http://registry.npmjs.org/chokidar/-/chokidar-1.6.1.tgz", "integrity": "sha1-L0RHq16W5Q+z14n9kNTHLg5McMI=", "dev": true, "requires": { @@ -4622,6 +4616,23 @@ "restore-cursor": "^2.0.0" } }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + }, + "dependencies": { + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + } + } + }, "cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", @@ -4739,7 +4750,8 @@ "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true }, "colour": { "version": "0.7.1", @@ -5058,7 +5070,7 @@ }, "cryptiles": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "resolved": "http://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "requires": { "boom": "2.x.x" @@ -5163,10 +5175,40 @@ }, "ctype": { "version": "0.5.3", - "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", + "resolved": "http://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", "integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=", "dev": true }, + "cucumber": { + "version": "github:xolvio/cucumber-js#cf953cb5b5de30dbcc279f59e4ebff3aa040071c", + "from": "github:xolvio/cucumber-js#v1.3.0-chimp.6", + "dev": true, + "requires": { + "camel-case": "^3.0.0", + "cli-table": "^0.3.1", + "co": "^4.6.0", + "colors": "^1.1.2", + "commander": "^2.9.0", + "duration": "^0.2.0", + "fibers": "^1.0.7", + "figures": "1.7.0", + "gherkin": "4.0.0", + "glob": "^7.0.0", + "is-generator": "^1.0.2", + "lodash": "^4.0.0", + "meteor-promise": "^0.8.0", + "stack-chain": "^1.3.5", + "stacktrace-js": "^1.3.0" + }, + "dependencies": { + "fibers": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", + "dev": true + } + } + }, "cuid": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/cuid/-/cuid-1.3.8.tgz", @@ -5179,7 +5221,7 @@ "dependencies": { "core-js": { "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "resolved": "http://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" } } @@ -5204,6 +5246,15 @@ "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", "dev": true }, + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "^0.10.9" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -5557,7 +5608,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -5587,7 +5638,7 @@ }, "deprecate": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deprecate/-/deprecate-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/deprecate/-/deprecate-1.0.0.tgz", "integrity": "sha1-ZhSQ7SQokWpsiIPYg05WRvTkpKg=" }, "deprecated-decorator": { @@ -5639,7 +5690,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -5687,7 +5738,7 @@ }, "doctrine": { "version": "1.5.0", - "resolved": "http://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { @@ -5706,7 +5757,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" } } @@ -5779,6 +5830,16 @@ "stream-shift": "^1.0.0" } }, + "duration": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/duration/-/duration-0.2.2.tgz", + "integrity": "sha512-06kgtea+bGreF5eKYgI/36A6pLXggY7oR4p1pq4SmdFBn1ReOL5D8RhG64VrqfTTKNucqqtBAwEj8aB88mcqrg==", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.46" + } + }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -5964,6 +6025,15 @@ } } }, + "error-stack-parser": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-1.3.6.tgz", + "integrity": "sha1-4Oc7k+QXE40c18C3RrGkoUhUwpI=", + "dev": true, + "requires": { + "stackframe": "^0.3.1" + } + }, "es-abstract": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", @@ -5986,6 +6056,28 @@ "is-symbol": "^1.0.2" } }, + "es5-ext": { + "version": "0.10.50", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz", + "integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "^1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, "es6-promise": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", @@ -5993,12 +6085,22 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "requires": { "es6-promise": "^4.0.3" } }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -6395,7 +6497,7 @@ }, "events": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, "evp_bytestokey": { @@ -6796,7 +6898,7 @@ }, "external-editor": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", "dev": true, "requires": { @@ -6939,13 +7041,13 @@ "dependencies": { "lodash": { "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "resolved": "http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", "dev": true }, "underscore.string": { "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", + "resolved": "http://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", "dev": true } @@ -6965,6 +7067,16 @@ "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", "dev": true }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, "file-entry-cache": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", @@ -7297,14 +7409,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7319,20 +7429,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -7449,8 +7556,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -7462,7 +7568,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7477,7 +7582,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7485,14 +7589,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7511,7 +7613,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7592,8 +7693,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7605,7 +7705,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7727,7 +7826,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7876,7 +7974,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" }, "get-value": { @@ -7912,6 +8010,12 @@ "assert-plus": "^1.0.0" } }, + "gherkin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-4.0.0.tgz", + "integrity": "sha1-edzgTRIj6kO0hip2vlzo+JwSwyw=", + "dev": true + }, "github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -8093,7 +8197,7 @@ "dependencies": { "minimist": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", "integrity": "sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag=", "dev": true } @@ -8948,7 +9052,7 @@ }, "hapi": { "version": "8.8.0", - "resolved": "https://registry.npmjs.org/hapi/-/hapi-8.8.0.tgz", + "resolved": "http://registry.npmjs.org/hapi/-/hapi-8.8.0.tgz", "integrity": "sha1-h+N6Bum0meiXkOLcERqpZotuYX8=", "dev": true, "requires": { @@ -8979,7 +9083,7 @@ "dependencies": { "accept": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/accept/-/accept-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/accept/-/accept-1.0.0.tgz", "integrity": "sha1-g++IOWi4WkDFARYEKCoiD/AeYq0=", "dev": true, "requires": { @@ -8989,7 +9093,7 @@ }, "ammo": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ammo/-/ammo-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/ammo/-/ammo-1.0.0.tgz", "integrity": "sha1-4FlIG/aAhzj66G1GT3L6DBLWeoU=", "dev": true, "requires": { @@ -8999,7 +9103,7 @@ }, "boom": { "version": "2.7.2", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.7.2.tgz", + "resolved": "http://registry.npmjs.org/boom/-/boom-2.7.2.tgz", "integrity": "sha1-2tYo2Jf3/S4yzIIZfxMweXHPg1Q=", "dev": true, "requires": { @@ -9008,7 +9112,7 @@ }, "call": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/call/-/call-2.0.1.tgz", + "resolved": "http://registry.npmjs.org/call/-/call-2.0.1.tgz", "integrity": "sha1-SbQnCZQ96JoyJYqpEbWHUeI3eg4=", "dev": true, "requires": { @@ -9018,7 +9122,7 @@ }, "catbox": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/catbox/-/catbox-4.3.0.tgz", + "resolved": "http://registry.npmjs.org/catbox/-/catbox-4.3.0.tgz", "integrity": "sha1-IiN3vWfxKRrA4l0AAC0GWp3385o=", "dev": true, "requires": { @@ -9029,7 +9133,7 @@ }, "catbox-memory": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/catbox-memory/-/catbox-memory-1.1.1.tgz", "integrity": "sha1-QqUvgLye+nJmAeltQBYDNhJIGig=", "dev": true, "requires": { @@ -9038,7 +9142,7 @@ }, "cryptiles": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.4.tgz", + "resolved": "http://registry.npmjs.org/cryptiles/-/cryptiles-2.0.4.tgz", "integrity": "sha1-CeoXdbnhx95+YKmdQqtvCM4aEoU=", "dev": true, "requires": { @@ -9055,54 +9159,28 @@ "hoek": "2.x.x", "joi": "6.x.x", "wreck": "5.x.x" - }, - "dependencies": { - "wreck": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/wreck/-/wreck-5.6.1.tgz", - "integrity": "sha1-r/ADBAATiJ11YZtccYcN0qjdBpo=", - "dev": true, - "requires": { - "boom": "2.x.x", - "hoek": "2.x.x" - } - } } }, "heavy": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/heavy/-/heavy-3.0.0.tgz", + "resolved": "http://registry.npmjs.org/heavy/-/heavy-3.0.0.tgz", "integrity": "sha1-/QEIdiExYy+IVIontVQSws9SKwA=", "dev": true, "requires": { "boom": "2.x.x", "hoek": "2.x.x", "joi": "5.x.x" - }, - "dependencies": { - "joi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/joi/-/joi-5.1.0.tgz", - "integrity": "sha1-FSrQfbjunGQBmX/1/SwSiWBwv1g=", - "dev": true, - "requires": { - "hoek": "^2.2.x", - "isemail": "1.x.x", - "moment": "2.x.x", - "topo": "1.x.x" - } - } } }, "hoek": { "version": "2.14.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz", + "resolved": "http://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz", "integrity": "sha1-gSEWkfUqWoNa5J7b8eickANHaqQ=", "dev": true }, "inert": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/inert/-/inert-2.1.5.tgz", + "resolved": "http://registry.npmjs.org/inert/-/inert-2.1.5.tgz", "integrity": "sha1-eybZTEHGLAPsHU726LRe1WuDSFk=", "dev": true, "requires": { @@ -9124,7 +9202,7 @@ }, "iron": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/iron/-/iron-2.1.2.tgz", + "resolved": "http://registry.npmjs.org/iron/-/iron-2.1.2.tgz", "integrity": "sha1-WR2RiiVAdTxEbY5DfNzwz6gBEU8=", "dev": true, "requires": { @@ -9141,7 +9219,7 @@ }, "joi": { "version": "6.4.1", - "resolved": "https://registry.npmjs.org/joi/-/joi-6.4.1.tgz", + "resolved": "http://registry.npmjs.org/joi/-/joi-6.4.1.tgz", "integrity": "sha1-9Q9CRTVgBo5jg9oVrC0w3Xzra24=", "dev": true, "requires": { @@ -9153,7 +9231,7 @@ "dependencies": { "isemail": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz", "integrity": "sha1-4Mj23D9HCX53dzlcaJYnGqJWw7U=", "dev": true }, @@ -9167,7 +9245,7 @@ }, "kilt": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/kilt/-/kilt-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/kilt/-/kilt-1.1.1.tgz", "integrity": "sha1-d7SmFjyn+lshN6iMFzNCFuwj1ds=", "dev": true, "requires": { @@ -9176,7 +9254,7 @@ }, "mimos": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/mimos/-/mimos-2.0.2.tgz", + "resolved": "http://registry.npmjs.org/mimos/-/mimos-2.0.2.tgz", "integrity": "sha1-wyQXF+dblZkr54esfdbbGptTmx4=", "dev": true, "requires": { @@ -9186,7 +9264,7 @@ "dependencies": { "mime-db": { "version": "1.14.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.14.0.tgz", + "resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.14.0.tgz", "integrity": "sha1-1WHxC27mbbUflK5leilRp0IX7YM=", "dev": true } @@ -9194,7 +9272,7 @@ }, "peekaboo": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/peekaboo/-/peekaboo-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/peekaboo/-/peekaboo-1.0.0.tgz", "integrity": "sha1-wNspJq1lTSygH3ymUKtFkadk/EI=", "dev": true }, @@ -9206,7 +9284,7 @@ }, "shot": { "version": "1.5.3", - "resolved": "https://registry.npmjs.org/shot/-/shot-1.5.3.tgz", + "resolved": "http://registry.npmjs.org/shot/-/shot-1.5.3.tgz", "integrity": "sha1-SGEHREO8VHLCNRthpGtOrsAH9Xo=", "dev": true, "requires": { @@ -9215,7 +9293,7 @@ }, "statehood": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/statehood/-/statehood-2.1.1.tgz", + "resolved": "http://registry.npmjs.org/statehood/-/statehood-2.1.1.tgz", "integrity": "sha1-AfFwtmxeklqvZ5qdMiulkYb8AAk=", "dev": true, "requires": { @@ -9229,7 +9307,7 @@ }, "subtext": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/subtext/-/subtext-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/subtext/-/subtext-1.1.1.tgz", "integrity": "sha1-DJGCWuZdUXhVWT2DHjPvdaKEFWs=", "dev": true, "requires": { @@ -9243,7 +9321,7 @@ "dependencies": { "content": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/content/-/content-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/content/-/content-1.0.1.tgz", "integrity": "sha1-gD60s7eJVGD9jGnGhMd1RmmvG6E=", "dev": true, "requires": { @@ -9253,7 +9331,7 @@ }, "pez": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pez/-/pez-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/pez/-/pez-1.0.0.tgz", "integrity": "sha1-hEMYpc5wku7d/6KV4YB5rHefoBg=", "dev": true, "requires": { @@ -9266,7 +9344,7 @@ "dependencies": { "b64": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/b64/-/b64-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/b64/-/b64-2.0.0.tgz", "integrity": "sha1-tZlbJPR+v9nxMQF6bntdZHVvtvM=", "dev": true, "requires": { @@ -9275,7 +9353,7 @@ }, "nigel": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/nigel/-/nigel-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/nigel/-/nigel-1.0.1.tgz", "integrity": "sha1-RjmJr4gSePuqHTzJOCPb0XtDYKE=", "dev": true, "requires": { @@ -9285,7 +9363,7 @@ "dependencies": { "vise": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/vise/-/vise-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/vise/-/vise-1.0.0.tgz", "integrity": "sha1-KDRb5N5aNB4V/SgW/Z6j5zA+jfM=", "dev": true, "requires": { @@ -9300,7 +9378,7 @@ }, "topo": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/topo/-/topo-1.0.2.tgz", "integrity": "sha1-QhV8N8HeTTeIPM3R1skChHqGDbk=", "dev": true, "requires": { @@ -9309,7 +9387,7 @@ }, "vision": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/vision/-/vision-2.0.1.tgz", + "resolved": "http://registry.npmjs.org/vision/-/vision-2.0.1.tgz", "integrity": "sha1-0BIlW6buQm0GlqNOHfMy/sVeZzw=", "dev": true, "requires": { @@ -9321,7 +9399,7 @@ }, "wreck": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/wreck/-/wreck-6.0.0.tgz", + "resolved": "http://registry.npmjs.org/wreck/-/wreck-6.0.0.tgz", "integrity": "sha1-T0CGaWHl14rOBPMqa38x8/PFFjg=", "dev": true, "requires": { @@ -9443,7 +9521,7 @@ }, "hawk": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "resolved": "http://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "requires": { "boom": "2.x.x", @@ -9482,7 +9560,7 @@ }, "hoek": { "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "resolved": "http://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" }, "home-or-tmp": { @@ -9786,7 +9864,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -10122,7 +10200,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -10237,6 +10315,12 @@ "number-is-nan": "^1.0.0" } }, + "is-generator": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", + "integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=", + "dev": true + }, "is-glob": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", @@ -10277,7 +10361,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-object": { @@ -10468,7 +10552,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -10668,7 +10752,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -10774,7 +10858,7 @@ }, "kew": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "resolved": "http://registry.npmjs.org/kew/-/kew-0.7.0.tgz", "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "dev": true }, @@ -10935,7 +11019,7 @@ }, "graceful-fs": { "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "optional": true, "requires": { @@ -10956,7 +11040,7 @@ }, "promise": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/promise/-/promise-6.1.0.tgz", "integrity": "sha1-LOcp9rlLRcJoka0GAsXJDgTG7vY=", "optional": true, "requires": { @@ -11125,7 +11209,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -11137,7 +11221,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -11439,6 +11523,12 @@ "signal-exit": "^3.0.0" } }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", + "dev": true + }, "lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -11581,7 +11671,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -11939,7 +12029,8 @@ "meteor-promise": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/meteor-promise/-/meteor-promise-0.8.6.tgz", - "integrity": "sha512-HP6tOr67z/9XU2Dr0F2SSr8WRTuE23AG9Dj578DCJPEYHs67OLKBviU8A8rwvbwMD7Lu2+Of+yAMz2Wd8r4yxg==" + "integrity": "sha512-HP6tOr67z/9XU2Dr0F2SSr8WRTuE23AG9Dj578DCJPEYHs67OLKBviU8A8rwvbwMD7Lu2+Of+yAMz2Wd8r4yxg==", + "dev": true }, "methods": { "version": "1.1.2", @@ -12062,7 +12153,7 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minimist-options": { @@ -12150,7 +12241,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -12508,7 +12599,7 @@ }, "ncp": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", "optional": true }, @@ -12518,11 +12609,26 @@ "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", "dev": true }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, + "no-case": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", + "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "dev": true, + "requires": { + "lower-case": "^1.1.1" + } + }, "node-abi": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.7.1.tgz", @@ -12801,7 +12907,7 @@ }, "npm-install-package": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz", "integrity": "sha1-1+/jz816sAYUuJbqUxGdyaslkSU=", "dev": true }, @@ -13046,7 +13152,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "requires": { "lcid": "^1.0.0" @@ -13379,7 +13485,7 @@ }, "es6-promise": { "version": "4.0.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", "integrity": "sha1-eILzCt3lskDM+n99eMVIMwlRrkI=", "dev": true }, @@ -13435,7 +13541,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -13483,7 +13589,7 @@ }, "tough-cookie": { "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "resolved": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { @@ -14586,7 +14692,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } @@ -14602,7 +14708,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -14636,7 +14742,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -14699,7 +14805,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -14811,7 +14917,7 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, @@ -14997,7 +15103,7 @@ }, "requestretry": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.5.0.tgz", + "resolved": "http://registry.npmjs.org/requestretry/-/requestretry-1.5.0.tgz", "integrity": "sha1-7RV7ulNSbt6z7DKo5wSkmYvs5ic=", "dev": true, "requires": { @@ -15123,7 +15229,7 @@ }, "rimraf": { "version": "2.4.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", "requires": { "glob": "^6.0.1" @@ -15218,7 +15324,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -15240,7 +15346,7 @@ }, "sax": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "resolved": "http://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" }, "schema-inspector": { @@ -15253,7 +15359,7 @@ "dependencies": { "async": { "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" } } @@ -15678,7 +15784,7 @@ }, "sntp": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "resolved": "http://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "requires": { "hoek": "2.x.x" @@ -15828,11 +15934,69 @@ "figgy-pudding": "^3.5.1" } }, + "stack-chain": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz", + "integrity": "sha1-0ZLJ/06moiyUxN1FkXHj8AzqEoU=", + "dev": true + }, + "stack-generator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-1.1.0.tgz", + "integrity": "sha1-NvapIHUabBD0maE8Msu19RoLiyU=", + "dev": true, + "requires": { + "stackframe": "^1.0.2" + }, + "dependencies": { + "stackframe": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.4.tgz", + "integrity": "sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw==", + "dev": true + } + } + }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, + "stackframe": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-0.3.1.tgz", + "integrity": "sha1-M6qE8Rd6VUjIk1Uzy/6zQgl19aQ=", + "dev": true + }, + "stacktrace-gps": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-2.4.4.tgz", + "integrity": "sha1-acgn6dbW9Bz0ONfxleLjy/zyjEQ=", + "dev": true, + "requires": { + "source-map": "0.5.6", + "stackframe": "~0.3" + }, + "dependencies": { + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + } + } + }, + "stacktrace-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-1.3.1.tgz", + "integrity": "sha1-Z8qyWJr1xBe5Yvc2mUAne7O2oYs=", + "dev": true, + "requires": { + "error-stack-parser": "^1.3.6", + "stack-generator": "^1.0.7", + "stacktrace-gps": "^2.4.3" + } + }, "starttls": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/starttls/-/starttls-1.0.1.tgz", @@ -15999,7 +16163,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -16566,7 +16730,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -17158,6 +17322,12 @@ "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, + "upper-case": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", + "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", + "dev": true + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -17250,7 +17420,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" } } @@ -17486,7 +17656,7 @@ }, "fibers": { "version": "1.0.15", - "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true }, @@ -17858,7 +18028,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", @@ -17962,7 +18132,7 @@ }, "xolvio-ddp": { "version": "0.12.3", - "resolved": "https://registry.npmjs.org/xolvio-ddp/-/xolvio-ddp-0.12.3.tgz", + "resolved": "http://registry.npmjs.org/xolvio-ddp/-/xolvio-ddp-0.12.3.tgz", "integrity": "sha1-NqarlhKyQLWg0cCoNJCK8XwLjwI=", "dev": true, "requires": { @@ -17987,7 +18157,7 @@ }, "async": { "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -17999,7 +18169,7 @@ }, "bl": { "version": "0.9.5", - "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz", + "resolved": "http://registry.npmjs.org/bl/-/bl-0.9.5.tgz", "integrity": "sha1-wGt5evCF6gC8Unr8jvzxHeIjIFQ=", "dev": true, "requires": { @@ -18008,7 +18178,7 @@ }, "bluebird": { "version": "2.11.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "resolved": "http://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", "dev": true }, @@ -18020,7 +18190,7 @@ }, "combined-stream": { "version": "0.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", "dev": true, "requires": { @@ -18041,7 +18211,7 @@ }, "form-data": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", + "resolved": "http://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", "integrity": "sha1-Jvi8JtpkQOKZy9z7aQNcT3em5GY=", "dev": true, "requires": { @@ -18052,7 +18222,7 @@ }, "hawk": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", + "resolved": "http://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", "integrity": "sha1-HnMc45RH+h0PbXB/e87r7A/R7B8=", "dev": true, "requires": { @@ -18081,13 +18251,13 @@ }, "mime-db": { "version": "1.12.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", + "resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", "integrity": "sha1-PQxjGA9FjrENMlqqN9fFiuMS6dc=", "dev": true }, "mime-types": { "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", + "resolved": "http://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", "integrity": "sha1-MQ4VnbI+B3+Lsit0jav6SVcUCqY=", "dev": true, "requires": { @@ -18114,7 +18284,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -18126,7 +18296,7 @@ }, "request": { "version": "2.53.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.53.0.tgz", + "resolved": "http://registry.npmjs.org/request/-/request-2.53.0.tgz", "integrity": "sha1-GAo66St7Y5gC5PlUXdj83rcddgw=", "dev": true, "requires": { @@ -18165,7 +18335,7 @@ }, "xolvio-fiber-utils": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/xolvio-fiber-utils/-/xolvio-fiber-utils-2.0.3.tgz", + "resolved": "http://registry.npmjs.org/xolvio-fiber-utils/-/xolvio-fiber-utils-2.0.3.tgz", "integrity": "sha1-vsjXDHQGGjFjFbun0w0lyz6C3FA=", "dev": true, "requires": { @@ -18175,7 +18345,7 @@ "dependencies": { "fibers": { "version": "1.0.15", - "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true } @@ -18183,7 +18353,7 @@ }, "xolvio-jasmine-expect": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xolvio-jasmine-expect/-/xolvio-jasmine-expect-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/xolvio-jasmine-expect/-/xolvio-jasmine-expect-1.1.0.tgz", "integrity": "sha1-vCud1ghCMR8EV59agtzqaisxnH0=", "dev": true, "requires": { @@ -18206,7 +18376,7 @@ "dependencies": { "fibers": { "version": "1.0.15", - "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true } @@ -18244,7 +18414,7 @@ }, "yargs": { "version": "3.32.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", "requires": { "camelcase": "^2.0.1", From 7511a97c5d4b24cd5bc053b72aec377089cc8c47 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Fri, 14 Jun 2019 18:59:02 +0530 Subject: [PATCH 05/18] change auth workflow, createSession will be managed from Ghost side. --- app/articles/client/index.js | 1 - app/articles/server/logoutCleanUp.js | 15 +++++++ app/articles/server/methods/admin.js | 59 +++++++++----------------- app/articles/server/methods/user.js | 34 ++++----------- app/articles/server/settings.js | 2 +- app/ui-admin/client/admin.js | 1 - app/ui-sidenav/client/sidebarHeader.js | 2 +- app/ui/client/lib/iframeCommands.js | 2 +- server/methods/logoutCleanUp.js | 5 ++- 9 files changed, 50 insertions(+), 71 deletions(-) create mode 100644 app/articles/server/logoutCleanUp.js diff --git a/app/articles/client/index.js b/app/articles/client/index.js index dcd62b2ff2d7..e69de29bb2d1 100644 --- a/app/articles/client/index.js +++ b/app/articles/client/index.js @@ -1 +0,0 @@ -console.log('articles'); diff --git a/app/articles/server/logoutCleanUp.js b/app/articles/server/logoutCleanUp.js new file mode 100644 index 000000000000..4a83dcf09b4c --- /dev/null +++ b/app/articles/server/logoutCleanUp.js @@ -0,0 +1,15 @@ +import { Meteor } from 'meteor/meteor'; +import { HTTP } from 'meteor/http'; + +import { settings } from '../../settings'; +import { API } from './utils/url'; + +const api = new API(); + +export function ghostCleanUp(cookie) { + const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); + + if (settings.get('Articles_enabled')) { + HTTP.call('DELETE', api.session(), { headers: { cookie, referer: rcUrl } }); + } +} diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index b905e7f8e830..0694de67c0ae 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,12 +1,20 @@ import { Meteor } from 'meteor/meteor'; import { HTTP } from 'meteor/http'; +import _ from 'underscore'; import { API } from '../utils/url'; import { settings } from '../../../settings'; const api = new API(); -function setupGhost(user, token, rcUrl) { +// Try to get a verified email, if available. +function getVerifiedEmail(emails) { + const email = _.find(emails, (e) => e.verified); + return email || emails[0].address; +} + +function setupGhost(user, token) { + const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const blogTitle = settings.get('Article_Site_title'); const data = { setup: [{ @@ -14,25 +22,18 @@ function setupGhost(user, token, rcUrl) { rc_id: user._id, rc_token: token, name: user.name, - email: user.emails[0].address, - password: 'qwe123qwe123', // TODO send random password; remove password field + email: getVerifiedEmail(user.emails), blogTitle, }], }; return HTTP.call('POST', api.setup(), { data, headers: { 'Content-Type': 'application/json' } }); } -function createSession(options) { - const response = HTTP.call('POST', api.session(), options); - if (response.statusCode === 201 && response.content === 'Created' && response.headers && response.headers['set-cookie']) { - let cookie = response.headers['set-cookie'][0].split(';'); - cookie = `${ cookie[0] };${ cookie[1] };${ cookie[2] };${ cookie[4] }`; - return { - link: api.siteUrl(), - cookie, - message: 'Ghost is Set up. Redirecting.', - }; - } +function redirectGhost() { + return { + link: api.siteUrl(), + message: 'Ghost is Set up. Redirecting.', + }; } Meteor.methods({ @@ -43,29 +44,19 @@ Meteor.methods({ throw new Meteor.Error('Articles are disabled'); } const user = Meteor.users.findOne(Meteor.userId()); - const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); - const options = { - data: { - rc_id: user._id, - rc_token: token, - }, - headers: { - 'Content-Type': 'application/json', - Referer: api.siteUrl(), - }, - }; + try { let response = HTTP.call('GET', api.setup()); if (response.data && response.data.setup && response.data.setup[0]) { if (response.data.setup[0].status) { // Ghost site is already setup - return createSession(options); + return redirectGhost(); } // Setup Ghost Site and set title - response = setupGhost(user, token, rcUrl); + response = setupGhost(user, token); if (response.statusCode === 201 && response.content) { - return createSession(options); + return redirectGhost(); } if (response.errors) { - throw new Meteor.Error(response.errors.message || 'Unable to redirect. Make sure Ghost is running'); + throw new Meteor.Error(response.errors.message || 'Unable to setup. Make sure Ghost is running'); } } else { throw new Meteor.Error('Unable to redirect. Make sure Ghost is running.'); @@ -75,13 +66,3 @@ Meteor.methods({ } }, }); - -/* - *function getVerifiedEmail(emails) { - * const email = emails[0].address; - * emails.forEach((e) => { - * if (e.verified) { return e.address; } - * return email; - * }); - *} - */ diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index ed3159e68479..414502ef2068 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -6,8 +6,6 @@ import { settings } from '../../../settings'; const api = new API(); -// Adding user everytime when user redirects, server will return error if user already exist. -// TODO: Find any better way exist. function addUser(user, accessToken) { const data = { user: [{ @@ -42,18 +40,11 @@ function inviteSetting() { return false; } -function createSession(options) { - const response = HTTP.call('POST', api.session(), options); - if (response.statusCode === 201 && response.content === 'Created' && response.headers && response.headers['set-cookie']) { - let cookie = response.headers['set-cookie'][0].split(';'); - cookie = `${ cookie[0] };${ cookie[1] };${ cookie[2] };${ cookie[4] }`; - return { - link: api.siteUrl(), - cookie, - message: 'Ghost is Set up. Redirecting.', - }; - } - throw new Meteor.Error('Unable to create Ghost Session.'); +function redirectGhost() { + return { + link: api.siteUrl(), + message: 'Ghost is Set up. Redirecting.', + }; } Meteor.methods({ @@ -64,30 +55,21 @@ Meteor.methods({ throw new Meteor.Error('Articles are disabled'); } const user = Meteor.users.findOne(Meteor.userId()); - const options = { - data: { - rc_id: user._id, - rc_token: accessToken, - }, - headers: { - 'Content-Type': 'application/json', - Referer: api.siteUrl(), - }, - }; + try { let response = HTTP.call('GET', api.setup()); if (response.data && response.data.setup && response.data.setup[0]) { if (response.data.setup[0].status) { // Ghost site is already setup const exist = userExist(user, accessToken); if (exist) { - return createSession(options); + return redirectGhost(); } const inviteOnly = inviteSetting(); if (!inviteOnly) { response = addUser(user, accessToken); if (response.statusCode === 200) { - return createSession(options); + return redirectGhost(); } throw new Meteor.Error('Unable to setup your account.'); } else { diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 47cc506dcd5e..8c466596cab4 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor'; import { settings } from '../../settings'; const defaults = { - enable: true, + enable: false, }; Meteor.startup(() => { diff --git a/app/ui-admin/client/admin.js b/app/ui-admin/client/admin.js index e73e2060ea5b..d65e6fc4cb12 100644 --- a/app/ui-admin/client/admin.js +++ b/app/ui-admin/client/admin.js @@ -586,7 +586,6 @@ Template.admin.events({ } if (data.link) { const redirectWindow = window.open(data.link, '_blank'); - redirectWindow.document.cookie = data.cookie; redirectWindow.location; } const args = [data.message].concat(data.params); diff --git a/app/ui-sidenav/client/sidebarHeader.js b/app/ui-sidenav/client/sidebarHeader.js index 2d1186b16368..cd0a80a844b4 100644 --- a/app/ui-sidenav/client/sidebarHeader.js +++ b/app/ui-sidenav/client/sidebarHeader.js @@ -392,7 +392,7 @@ Template.sidebarHeader.events({ action: () => { Meteor.logout(() => { callbacks.run('afterLogoutCleanUp', user); - Meteor.call('logoutCleanUp', user); + Meteor.call('logoutCleanUp', user, document.cookie); FlowRouter.go('home'); popover.close(); }); diff --git a/app/ui/client/lib/iframeCommands.js b/app/ui/client/lib/iframeCommands.js index 83dfe611db0b..b2e8b3d39c41 100644 --- a/app/ui/client/lib/iframeCommands.js +++ b/app/ui/client/lib/iframeCommands.js @@ -57,7 +57,7 @@ const commands = { const user = Meteor.user(); Meteor.logout(() => { callbacks.run('afterLogoutCleanUp', user); - Meteor.call('logoutCleanUp', user); + Meteor.call('logoutCleanUp', user, document.cookie); return FlowRouter.go('home'); }); }, diff --git a/server/methods/logoutCleanUp.js b/server/methods/logoutCleanUp.js index db6cba739aa3..d8dbd6a7a856 100644 --- a/server/methods/logoutCleanUp.js +++ b/server/methods/logoutCleanUp.js @@ -1,12 +1,15 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; +import { ghostCleanUp } from '../../app/articles/server/logoutCleanUp'; import { callbacks } from '../../app/callbacks'; Meteor.methods({ - logoutCleanUp(user) { + logoutCleanUp(user, cookie = '') { check(user, Object); + ghostCleanUp(cookie); + Meteor.defer(function() { callbacks.run('afterLogoutCleanUp', user); }); From 5f0183deb1f0cb961642fe625eba7b02b13d042e Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Sat, 15 Jun 2019 02:19:34 +0530 Subject: [PATCH 06/18] handle error for logout --- app/articles/server/logoutCleanUp.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/articles/server/logoutCleanUp.js b/app/articles/server/logoutCleanUp.js index 4a83dcf09b4c..9c527585ac91 100644 --- a/app/articles/server/logoutCleanUp.js +++ b/app/articles/server/logoutCleanUp.js @@ -8,8 +8,12 @@ const api = new API(); export function ghostCleanUp(cookie) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); - - if (settings.get('Articles_enabled')) { - HTTP.call('DELETE', api.session(), { headers: { cookie, referer: rcUrl } }); + try { + if (settings.get('Articles_enabled')) { + HTTP.call('DELETE', api.session(), { headers: { cookie, referer: rcUrl } }); + } + } catch (e) { + // Do nothing if failed to logout from Ghost. + // Error will be because user has not logged in to Ghost. } } From a3bd74d475e4ff38bdc8c2cc776c19f541e477f3 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Sat, 15 Jun 2019 15:53:37 +0530 Subject: [PATCH 07/18] fix indentation and empty cookie --- app/ui-sidenav/client/sidebarHeader.js | 9 +- package-lock.json | 252 ++++++++++++------------- 2 files changed, 129 insertions(+), 132 deletions(-) diff --git a/app/ui-sidenav/client/sidebarHeader.js b/app/ui-sidenav/client/sidebarHeader.js index cd0a80a844b4..b0cb6fcec865 100644 --- a/app/ui-sidenav/client/sidebarHeader.js +++ b/app/ui-sidenav/client/sidebarHeader.js @@ -230,7 +230,6 @@ const toolbarButtons = (user) => [{ return handleError(error); } const redirectWindow = window.open(result.link, '_blank'); - redirectWindow.document.cookie = result.cookie; toastr.success(result.message, 'Success'); redirectWindow.location; }); @@ -312,11 +311,9 @@ Template.sidebarHeader.helpers({ status: 'online', }; } - return id && Meteor.users.findOne(id, { - fields: { - username: 1, status: 1, - }, - }); + return id && Meteor.users.findOne(id, { fields: { + username: 1, status: 1, + } }); }, toolbarButtons() { return toolbarButtons(Meteor.userId()).filter((button) => !button.condition || button.condition()); diff --git a/package-lock.json b/package-lock.json index 91d917ae189f..672f1a1c6ad8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Rocket.Chat", - "version": "1.2.0-develop", + "version": "1.1.0-develop", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -758,7 +758,7 @@ }, "@types/events": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" }, "@types/express": { @@ -1684,7 +1684,7 @@ }, "axios": { "version": "0.18.0", - "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "requires": { "follow-redirects": "^1.3.0", @@ -2022,7 +2022,7 @@ }, "babel-plugin-add-module-exports": { "version": "0.2.1", - "resolved": "http://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz", "integrity": "sha1-mumh9KjcZ/DN7E9K7aHkOl/2XiU=", "dev": true }, @@ -2043,79 +2043,79 @@ }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, "babel-plugin-syntax-async-generators": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", "dev": true }, "babel-plugin-syntax-class-constructor-call": { "version": "6.18.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", "dev": true }, "babel-plugin-syntax-class-properties": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", "dev": true }, "babel-plugin-syntax-decorators": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", "dev": true }, "babel-plugin-syntax-do-expressions": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz", "integrity": "sha1-V0d1YTmqJtOQ0JQQsDdEugfkeW0=", "dev": true }, "babel-plugin-syntax-dynamic-import": { "version": "6.18.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", "dev": true }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "dev": true }, "babel-plugin-syntax-export-extensions": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", "dev": true }, "babel-plugin-syntax-flow": { "version": "6.18.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", "dev": true }, "babel-plugin-syntax-function-bind": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz", "integrity": "sha1-SMSV8Xe98xqYHnMvVa3AvdJgH0Y=", "dev": true }, "babel-plugin-syntax-jsx": { "version": "6.18.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=", "dev": true }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, @@ -2512,7 +2512,7 @@ }, "babel-preset-es2015": { "version": "6.3.13", - "resolved": "http://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.3.13.tgz", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.3.13.tgz", "integrity": "sha1-l9zn7ykuGMubK3VF2AxZPCjZUX8=", "dev": true, "requires": { @@ -2540,7 +2540,7 @@ }, "babel-preset-react": { "version": "6.3.13", - "resolved": "http://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.3.13.tgz", + "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.3.13.tgz", "integrity": "sha1-E9VeBqZfqqoHw5v2Op2DbgMhFvo=", "dev": true, "requires": { @@ -2554,7 +2554,7 @@ }, "babel-preset-stage-0": { "version": "6.3.13", - "resolved": "http://registry.npmjs.org/babel-preset-stage-0/-/babel-preset-stage-0-6.3.13.tgz", + "resolved": "https://registry.npmjs.org/babel-preset-stage-0/-/babel-preset-stage-0-6.3.13.tgz", "integrity": "sha1-eKN8VvCzmI8qeZMtywzrj/N3sNE=", "dev": true, "requires": { @@ -3461,7 +3461,7 @@ }, "bl": { "version": "1.2.2", - "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", "requires": { "readable-stream": "^2.3.5", @@ -3560,7 +3560,7 @@ }, "boom": { "version": "2.10.1", - "resolved": "http://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "requires": { "hoek": "2.x.x" @@ -3845,7 +3845,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -4201,7 +4201,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { "ansi-styles": "^2.2.1", @@ -4304,7 +4304,7 @@ }, "chimp": { "version": "0.51.1", - "resolved": "http://registry.npmjs.org/chimp/-/chimp-0.51.1.tgz", + "resolved": "https://registry.npmjs.org/chimp/-/chimp-0.51.1.tgz", "integrity": "sha1-6hIbzfJsidV/jvNBlUDPPCeaPMU=", "dev": true, "requires": { @@ -4350,7 +4350,7 @@ "dependencies": { "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -4422,7 +4422,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -4474,7 +4474,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -4497,7 +4497,7 @@ }, "chokidar": { "version": "1.6.1", - "resolved": "http://registry.npmjs.org/chokidar/-/chokidar-1.6.1.tgz", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.6.1.tgz", "integrity": "sha1-L0RHq16W5Q+z14n9kNTHLg5McMI=", "dev": true, "requires": { @@ -5070,7 +5070,7 @@ }, "cryptiles": { "version": "2.0.5", - "resolved": "http://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "requires": { "boom": "2.x.x" @@ -5175,7 +5175,7 @@ }, "ctype": { "version": "0.5.3", - "resolved": "http://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", + "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", "integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=", "dev": true }, @@ -5221,7 +5221,7 @@ "dependencies": { "core-js": { "version": "1.2.7", - "resolved": "http://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" } } @@ -5608,7 +5608,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -5638,7 +5638,7 @@ }, "deprecate": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/deprecate/-/deprecate-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/deprecate/-/deprecate-1.0.0.tgz", "integrity": "sha1-ZhSQ7SQokWpsiIPYg05WRvTkpKg=" }, "deprecated-decorator": { @@ -5690,7 +5690,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -5738,7 +5738,7 @@ }, "doctrine": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "resolved": "http://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { @@ -5757,7 +5757,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" } } @@ -6085,7 +6085,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "requires": { "es6-promise": "^4.0.3" @@ -6497,7 +6497,7 @@ }, "events": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, "evp_bytestokey": { @@ -6898,7 +6898,7 @@ }, "external-editor": { "version": "2.2.0", - "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", "dev": true, "requires": { @@ -7041,13 +7041,13 @@ "dependencies": { "lodash": { "version": "2.4.2", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", "dev": true }, "underscore.string": { "version": "2.3.3", - "resolved": "http://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", "dev": true } @@ -7974,7 +7974,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" }, "get-value": { @@ -8197,7 +8197,7 @@ "dependencies": { "minimist": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", "integrity": "sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag=", "dev": true } @@ -9052,7 +9052,7 @@ }, "hapi": { "version": "8.8.0", - "resolved": "http://registry.npmjs.org/hapi/-/hapi-8.8.0.tgz", + "resolved": "https://registry.npmjs.org/hapi/-/hapi-8.8.0.tgz", "integrity": "sha1-h+N6Bum0meiXkOLcERqpZotuYX8=", "dev": true, "requires": { @@ -9083,7 +9083,7 @@ "dependencies": { "accept": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/accept/-/accept-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/accept/-/accept-1.0.0.tgz", "integrity": "sha1-g++IOWi4WkDFARYEKCoiD/AeYq0=", "dev": true, "requires": { @@ -9093,7 +9093,7 @@ }, "ammo": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/ammo/-/ammo-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/ammo/-/ammo-1.0.0.tgz", "integrity": "sha1-4FlIG/aAhzj66G1GT3L6DBLWeoU=", "dev": true, "requires": { @@ -9103,7 +9103,7 @@ }, "boom": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/boom/-/boom-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.7.2.tgz", "integrity": "sha1-2tYo2Jf3/S4yzIIZfxMweXHPg1Q=", "dev": true, "requires": { @@ -9112,7 +9112,7 @@ }, "call": { "version": "2.0.1", - "resolved": "http://registry.npmjs.org/call/-/call-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/call/-/call-2.0.1.tgz", "integrity": "sha1-SbQnCZQ96JoyJYqpEbWHUeI3eg4=", "dev": true, "requires": { @@ -9122,7 +9122,7 @@ }, "catbox": { "version": "4.3.0", - "resolved": "http://registry.npmjs.org/catbox/-/catbox-4.3.0.tgz", + "resolved": "https://registry.npmjs.org/catbox/-/catbox-4.3.0.tgz", "integrity": "sha1-IiN3vWfxKRrA4l0AAC0GWp3385o=", "dev": true, "requires": { @@ -9133,7 +9133,7 @@ }, "catbox-memory": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/catbox-memory/-/catbox-memory-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-1.1.1.tgz", "integrity": "sha1-QqUvgLye+nJmAeltQBYDNhJIGig=", "dev": true, "requires": { @@ -9142,7 +9142,7 @@ }, "cryptiles": { "version": "2.0.4", - "resolved": "http://registry.npmjs.org/cryptiles/-/cryptiles-2.0.4.tgz", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.4.tgz", "integrity": "sha1-CeoXdbnhx95+YKmdQqtvCM4aEoU=", "dev": true, "requires": { @@ -9163,7 +9163,7 @@ }, "heavy": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/heavy/-/heavy-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/heavy/-/heavy-3.0.0.tgz", "integrity": "sha1-/QEIdiExYy+IVIontVQSws9SKwA=", "dev": true, "requires": { @@ -9174,13 +9174,13 @@ }, "hoek": { "version": "2.14.0", - "resolved": "http://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz", "integrity": "sha1-gSEWkfUqWoNa5J7b8eickANHaqQ=", "dev": true }, "inert": { "version": "2.1.5", - "resolved": "http://registry.npmjs.org/inert/-/inert-2.1.5.tgz", + "resolved": "https://registry.npmjs.org/inert/-/inert-2.1.5.tgz", "integrity": "sha1-eybZTEHGLAPsHU726LRe1WuDSFk=", "dev": true, "requires": { @@ -9202,7 +9202,7 @@ }, "iron": { "version": "2.1.2", - "resolved": "http://registry.npmjs.org/iron/-/iron-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/iron/-/iron-2.1.2.tgz", "integrity": "sha1-WR2RiiVAdTxEbY5DfNzwz6gBEU8=", "dev": true, "requires": { @@ -9219,7 +9219,7 @@ }, "joi": { "version": "6.4.1", - "resolved": "http://registry.npmjs.org/joi/-/joi-6.4.1.tgz", + "resolved": "https://registry.npmjs.org/joi/-/joi-6.4.1.tgz", "integrity": "sha1-9Q9CRTVgBo5jg9oVrC0w3Xzra24=", "dev": true, "requires": { @@ -9231,7 +9231,7 @@ "dependencies": { "isemail": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz", "integrity": "sha1-4Mj23D9HCX53dzlcaJYnGqJWw7U=", "dev": true }, @@ -9245,7 +9245,7 @@ }, "kilt": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/kilt/-/kilt-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/kilt/-/kilt-1.1.1.tgz", "integrity": "sha1-d7SmFjyn+lshN6iMFzNCFuwj1ds=", "dev": true, "requires": { @@ -9254,7 +9254,7 @@ }, "mimos": { "version": "2.0.2", - "resolved": "http://registry.npmjs.org/mimos/-/mimos-2.0.2.tgz", + "resolved": "https://registry.npmjs.org/mimos/-/mimos-2.0.2.tgz", "integrity": "sha1-wyQXF+dblZkr54esfdbbGptTmx4=", "dev": true, "requires": { @@ -9264,7 +9264,7 @@ "dependencies": { "mime-db": { "version": "1.14.0", - "resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.14.0.tgz", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.14.0.tgz", "integrity": "sha1-1WHxC27mbbUflK5leilRp0IX7YM=", "dev": true } @@ -9272,7 +9272,7 @@ }, "peekaboo": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/peekaboo/-/peekaboo-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/peekaboo/-/peekaboo-1.0.0.tgz", "integrity": "sha1-wNspJq1lTSygH3ymUKtFkadk/EI=", "dev": true }, @@ -9284,7 +9284,7 @@ }, "shot": { "version": "1.5.3", - "resolved": "http://registry.npmjs.org/shot/-/shot-1.5.3.tgz", + "resolved": "https://registry.npmjs.org/shot/-/shot-1.5.3.tgz", "integrity": "sha1-SGEHREO8VHLCNRthpGtOrsAH9Xo=", "dev": true, "requires": { @@ -9293,7 +9293,7 @@ }, "statehood": { "version": "2.1.1", - "resolved": "http://registry.npmjs.org/statehood/-/statehood-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/statehood/-/statehood-2.1.1.tgz", "integrity": "sha1-AfFwtmxeklqvZ5qdMiulkYb8AAk=", "dev": true, "requires": { @@ -9307,7 +9307,7 @@ }, "subtext": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/subtext/-/subtext-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/subtext/-/subtext-1.1.1.tgz", "integrity": "sha1-DJGCWuZdUXhVWT2DHjPvdaKEFWs=", "dev": true, "requires": { @@ -9321,7 +9321,7 @@ "dependencies": { "content": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/content/-/content-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/content/-/content-1.0.1.tgz", "integrity": "sha1-gD60s7eJVGD9jGnGhMd1RmmvG6E=", "dev": true, "requires": { @@ -9331,7 +9331,7 @@ }, "pez": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/pez/-/pez-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/pez/-/pez-1.0.0.tgz", "integrity": "sha1-hEMYpc5wku7d/6KV4YB5rHefoBg=", "dev": true, "requires": { @@ -9344,7 +9344,7 @@ "dependencies": { "b64": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/b64/-/b64-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/b64/-/b64-2.0.0.tgz", "integrity": "sha1-tZlbJPR+v9nxMQF6bntdZHVvtvM=", "dev": true, "requires": { @@ -9353,7 +9353,7 @@ }, "nigel": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/nigel/-/nigel-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/nigel/-/nigel-1.0.1.tgz", "integrity": "sha1-RjmJr4gSePuqHTzJOCPb0XtDYKE=", "dev": true, "requires": { @@ -9363,7 +9363,7 @@ "dependencies": { "vise": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/vise/-/vise-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/vise/-/vise-1.0.0.tgz", "integrity": "sha1-KDRb5N5aNB4V/SgW/Z6j5zA+jfM=", "dev": true, "requires": { @@ -9378,7 +9378,7 @@ }, "topo": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/topo/-/topo-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.2.tgz", "integrity": "sha1-QhV8N8HeTTeIPM3R1skChHqGDbk=", "dev": true, "requires": { @@ -9387,7 +9387,7 @@ }, "vision": { "version": "2.0.1", - "resolved": "http://registry.npmjs.org/vision/-/vision-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/vision/-/vision-2.0.1.tgz", "integrity": "sha1-0BIlW6buQm0GlqNOHfMy/sVeZzw=", "dev": true, "requires": { @@ -9399,7 +9399,7 @@ }, "wreck": { "version": "6.0.0", - "resolved": "http://registry.npmjs.org/wreck/-/wreck-6.0.0.tgz", + "resolved": "https://registry.npmjs.org/wreck/-/wreck-6.0.0.tgz", "integrity": "sha1-T0CGaWHl14rOBPMqa38x8/PFFjg=", "dev": true, "requires": { @@ -9521,7 +9521,7 @@ }, "hawk": { "version": "3.1.3", - "resolved": "http://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "requires": { "boom": "2.x.x", @@ -9560,7 +9560,7 @@ }, "hoek": { "version": "2.16.3", - "resolved": "http://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" }, "home-or-tmp": { @@ -9864,7 +9864,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -10200,7 +10200,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -10361,7 +10361,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-object": { @@ -10552,7 +10552,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -10752,7 +10752,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -10858,7 +10858,7 @@ }, "kew": { "version": "0.7.0", - "resolved": "http://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "dev": true }, @@ -11019,7 +11019,7 @@ }, "graceful-fs": { "version": "3.0.11", - "resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "optional": true, "requires": { @@ -11040,7 +11040,7 @@ }, "promise": { "version": "6.1.0", - "resolved": "http://registry.npmjs.org/promise/-/promise-6.1.0.tgz", + "resolved": "https://registry.npmjs.org/promise/-/promise-6.1.0.tgz", "integrity": "sha1-LOcp9rlLRcJoka0GAsXJDgTG7vY=", "optional": true, "requires": { @@ -11209,7 +11209,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -11221,7 +11221,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -11671,7 +11671,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -12153,7 +12153,7 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minimist-options": { @@ -12241,7 +12241,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -12599,7 +12599,7 @@ }, "ncp": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", "optional": true }, @@ -12907,7 +12907,7 @@ }, "npm-install-package": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz", "integrity": "sha1-1+/jz816sAYUuJbqUxGdyaslkSU=", "dev": true }, @@ -13152,7 +13152,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "requires": { "lcid": "^1.0.0" @@ -13485,7 +13485,7 @@ }, "es6-promise": { "version": "4.0.5", - "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", "integrity": "sha1-eILzCt3lskDM+n99eMVIMwlRrkI=", "dev": true }, @@ -13541,7 +13541,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -13589,7 +13589,7 @@ }, "tough-cookie": { "version": "2.3.4", - "resolved": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { @@ -14692,7 +14692,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } @@ -14708,7 +14708,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -14742,7 +14742,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -14805,7 +14805,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -14917,7 +14917,7 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, @@ -15103,7 +15103,7 @@ }, "requestretry": { "version": "1.5.0", - "resolved": "http://registry.npmjs.org/requestretry/-/requestretry-1.5.0.tgz", + "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.5.0.tgz", "integrity": "sha1-7RV7ulNSbt6z7DKo5wSkmYvs5ic=", "dev": true, "requires": { @@ -15229,7 +15229,7 @@ }, "rimraf": { "version": "2.4.5", - "resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", "requires": { "glob": "^6.0.1" @@ -15324,7 +15324,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -15346,7 +15346,7 @@ }, "sax": { "version": "1.2.1", - "resolved": "http://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" }, "schema-inspector": { @@ -15359,7 +15359,7 @@ "dependencies": { "async": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" } } @@ -15784,7 +15784,7 @@ }, "sntp": { "version": "1.0.9", - "resolved": "http://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "requires": { "hoek": "2.x.x" @@ -16163,7 +16163,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -16730,7 +16730,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -17420,7 +17420,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" } } @@ -17656,7 +17656,7 @@ }, "fibers": { "version": "1.0.15", - "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true }, @@ -18028,7 +18028,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", @@ -18132,7 +18132,7 @@ }, "xolvio-ddp": { "version": "0.12.3", - "resolved": "http://registry.npmjs.org/xolvio-ddp/-/xolvio-ddp-0.12.3.tgz", + "resolved": "https://registry.npmjs.org/xolvio-ddp/-/xolvio-ddp-0.12.3.tgz", "integrity": "sha1-NqarlhKyQLWg0cCoNJCK8XwLjwI=", "dev": true, "requires": { @@ -18157,7 +18157,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -18169,7 +18169,7 @@ }, "bl": { "version": "0.9.5", - "resolved": "http://registry.npmjs.org/bl/-/bl-0.9.5.tgz", + "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz", "integrity": "sha1-wGt5evCF6gC8Unr8jvzxHeIjIFQ=", "dev": true, "requires": { @@ -18178,7 +18178,7 @@ }, "bluebird": { "version": "2.11.0", - "resolved": "http://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", "dev": true }, @@ -18190,7 +18190,7 @@ }, "combined-stream": { "version": "0.0.7", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", "dev": true, "requires": { @@ -18211,7 +18211,7 @@ }, "form-data": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", "integrity": "sha1-Jvi8JtpkQOKZy9z7aQNcT3em5GY=", "dev": true, "requires": { @@ -18222,7 +18222,7 @@ }, "hawk": { "version": "2.3.1", - "resolved": "http://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", "integrity": "sha1-HnMc45RH+h0PbXB/e87r7A/R7B8=", "dev": true, "requires": { @@ -18251,13 +18251,13 @@ }, "mime-db": { "version": "1.12.0", - "resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", "integrity": "sha1-PQxjGA9FjrENMlqqN9fFiuMS6dc=", "dev": true }, "mime-types": { "version": "2.0.14", - "resolved": "http://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", "integrity": "sha1-MQ4VnbI+B3+Lsit0jav6SVcUCqY=", "dev": true, "requires": { @@ -18284,7 +18284,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -18296,7 +18296,7 @@ }, "request": { "version": "2.53.0", - "resolved": "http://registry.npmjs.org/request/-/request-2.53.0.tgz", + "resolved": "https://registry.npmjs.org/request/-/request-2.53.0.tgz", "integrity": "sha1-GAo66St7Y5gC5PlUXdj83rcddgw=", "dev": true, "requires": { @@ -18335,7 +18335,7 @@ }, "xolvio-fiber-utils": { "version": "2.0.3", - "resolved": "http://registry.npmjs.org/xolvio-fiber-utils/-/xolvio-fiber-utils-2.0.3.tgz", + "resolved": "https://registry.npmjs.org/xolvio-fiber-utils/-/xolvio-fiber-utils-2.0.3.tgz", "integrity": "sha1-vsjXDHQGGjFjFbun0w0lyz6C3FA=", "dev": true, "requires": { @@ -18345,7 +18345,7 @@ "dependencies": { "fibers": { "version": "1.0.15", - "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true } @@ -18353,7 +18353,7 @@ }, "xolvio-jasmine-expect": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/xolvio-jasmine-expect/-/xolvio-jasmine-expect-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/xolvio-jasmine-expect/-/xolvio-jasmine-expect-1.1.0.tgz", "integrity": "sha1-vCud1ghCMR8EV59agtzqaisxnH0=", "dev": true, "requires": { @@ -18376,7 +18376,7 @@ "dependencies": { "fibers": { "version": "1.0.15", - "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true } @@ -18414,7 +18414,7 @@ }, "yargs": { "version": "3.32.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", "requires": { "camelcase": "^2.0.1", From 4e3cf13da62152af4f0f2b953288f7c4a7acde0a Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Mon, 15 Jul 2019 12:14:31 +0530 Subject: [PATCH 08/18] improve code structure --- app/articles/server/methods/admin.js | 27 +++++++++--------- app/articles/server/methods/user.js | 41 +++++++++++++--------------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 0694de67c0ae..9ca718bb5aac 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -44,25 +44,26 @@ Meteor.methods({ throw new Meteor.Error('Articles are disabled'); } const user = Meteor.users.findOne(Meteor.userId()); + let errMsg = 'Unable to connect to Ghost. Make sure Ghost is running'; try { let response = HTTP.call('GET', api.setup()); - if (response.data && response.data.setup && response.data.setup[0]) { - if (response.data.setup[0].status) { // Ghost site is already setup - return redirectGhost(); - } // Setup Ghost Site and set title - response = setupGhost(user, token); - if (response.statusCode === 201 && response.content) { - return redirectGhost(); - } if (response.errors) { - throw new Meteor.Error(response.errors.message || 'Unable to setup. Make sure Ghost is running'); - } - } else { - throw new Meteor.Error('Unable to redirect. Make sure Ghost is running.'); + if (response.data.setup[0].status) { // Ghost site is already setup + return redirectGhost(); } + + // Setup Ghost Site and set title + response = setupGhost(user, token); + errMsg = 'Unable to setup. Make sure Ghost is running'; + + if (response.statusCode === 201 && response.content) { + return redirectGhost(); + } + + throw new Meteor.Error(errMsg); } catch (e) { - throw new Meteor.Error(e.error || 'Unable to connect to Ghost. Make sure Ghost is running.'); + throw new Meteor.Error(e.error || errMsg); } }, }); diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index 414502ef2068..1a4709595fb3 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -10,7 +10,7 @@ function addUser(user, accessToken) { const data = { user: [{ rc_username: user.username, - role: 'Author', // User can add itself as Author, even if he/she is admin in RC + role: 'Author', // User can add itself only as Author, even if he/she is admin in RC rc_uid: user._id, rc_token: accessToken, }], @@ -55,32 +55,29 @@ Meteor.methods({ throw new Meteor.Error('Articles are disabled'); } const user = Meteor.users.findOne(Meteor.userId()); + let errMsg = 'Ghost is not set up. Setup can be done from Admin Panel'; try { - let response = HTTP.call('GET', api.setup()); - if (response.data && response.data.setup && response.data.setup[0]) { - if (response.data.setup[0].status) { // Ghost site is already setup - const exist = userExist(user, accessToken); - if (exist) { - return redirectGhost(); - } - const inviteOnly = inviteSetting(); + const response = HTTP.call('GET', api.setup()); - if (!inviteOnly) { - response = addUser(user, accessToken); - if (response.statusCode === 200) { - return redirectGhost(); - } - throw new Meteor.Error('Unable to setup your account.'); - } else { - throw new Meteor.Error('You are not a member of Ghost. Ask admin to add'); - } - } else { // Cannot setup Ghost from sidenav - throw new Meteor.Error('Ghost is not set up. Setup can be done from Admin Panel.'); + if (response.data.setup[0].status) { // Ghost site is already setup + // user exist in ghost + if (userExist(user, accessToken)) { + return redirectGhost(); } - } else { - throw new Meteor.Error('Unable to redirect.'); + + const inviteOnly = inviteSetting(); + + // create user account in ghost + if (!inviteOnly && addUser(user, accessToken).statusCode === 200) { + return redirectGhost(); + } + + errMsg = inviteOnly ? 'You are not a member of Ghost. Ask admin to add' : 'Unable to setup your account'; } + + // Cannot setup Ghost from sidenav + throw new Meteor.Error(errMsg); } catch (e) { throw new Meteor.Error(e.error || 'Unable to connect to Ghost.'); } From 1e9b610713813d497f0378003de709f4b69b7408 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Mon, 10 Jun 2019 23:12:35 +0530 Subject: [PATCH 09/18] add api for ghooks --- app/articles/server/api/api.js | 90 ++++++++++++++++++++++++++++ app/articles/server/index.js | 1 + app/articles/server/methods/admin.js | 8 +++ app/articles/server/settings.js | 18 ++++++ 4 files changed, 117 insertions(+) create mode 100644 app/articles/server/api/api.js diff --git a/app/articles/server/api/api.js b/app/articles/server/api/api.js new file mode 100644 index 000000000000..40a01fc22c55 --- /dev/null +++ b/app/articles/server/api/api.js @@ -0,0 +1,90 @@ +import { Restivus } from 'meteor/nimble:restivus'; +import _ from 'underscore'; + +import { processWebhookMessage } from '../../../lib'; +import { API } from '../../../api'; +import { settings } from '../../../settings'; +import * as Models from '../../../models'; + +const Api = new Restivus({ + enableCors: true, + apiPath: 'ghooks/', + auth: { + user() { + const payloadKeys = Object.keys(this.bodyParams); + const payloadIsWrapped = (this.bodyParams && this.bodyParams.payload) && payloadKeys.length === 1; + if (payloadIsWrapped && this.request.headers['content-type'] === 'application/x-www-form-urlencoded') { + try { + this.bodyParams = JSON.parse(this.bodyParams.payload); + } catch ({ message }) { + return { + error: { + statusCode: 400, + body: { + success: false, + error: message, + }, + }, + }; + } + } + + this.announceToken = settings.get('Announcement_Token'); + + if (this.announceToken !== decodeURIComponent(this.request.params.token)) { + + return { + error: { + statusCode: 404, + body: { + success: false, + error: 'Invalid token provided.', + }, + }, + }; + } + + const user = Models.Users.findOne({ + _id: this.bodyParams.userId, + }); + + return { user }; + }, + }, +}); + +function executeAnnouncementRest() { + + + const defaultValues = { + channel: this.bodyParams.channel, + alias: this.bodyParams.alias, + avatar: this.bodyParams.avatar, + emoji: this.bodyParams.emoji, + }; + + // TODO: Turn this into an option on the integrations - no body means a success + // TODO: Temporary fix for https://github.com/RocketChat/Rocket.Chat/issues/7770 until the above is implemented + if (!this.bodyParams || (_.isEmpty(this.bodyParams) && !this.integration.scriptEnabled)) { + // return RocketChat.API.v1.failure('body-empty'); + return API.v1.success(); + } + + // this.bodyParams.bot = { i: this.integration._id }; + + try { + const message = processWebhookMessage(this.bodyParams, this.user, defaultValues); + if (_.isEmpty(message)) { + return API.v1.failure('unknown-error'); + } + + return API.v1.success(); + } catch ({ error, message }) { + return API.v1.failure(error || message); + } +} + +Api.addRoute(':blogId/:token', { authRequired: true }, { + post: executeAnnouncementRest, + get: executeAnnouncementRest, +}); \ No newline at end of file diff --git a/app/articles/server/index.js b/app/articles/server/index.js index c01f07b9128c..eb672b4731f1 100644 --- a/app/articles/server/index.js +++ b/app/articles/server/index.js @@ -1,3 +1,4 @@ import './settings'; import './methods/admin'; import './methods/user'; +import './api/api'; diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 9ca718bb5aac..800143f0d15f 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,6 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { HTTP } from 'meteor/http'; import _ from 'underscore'; +import { Random } from 'meteor/random'; import { API } from '../utils/url'; import { settings } from '../../../settings'; @@ -16,6 +17,11 @@ function getVerifiedEmail(emails) { function setupGhost(user, token) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const blogTitle = settings.get('Article_Site_title'); + const blogToken = Random.id(17); + const announceToken = `${blogToken}/${Random.id(24)}`; + const collabToken = `${blogToken}/${Random.id(24)}`; + settings.updateById('Announcement_Token', announce_token); + settings.updateById('Collaboration_Token', announce_token); const data = { setup: [{ rc_url: rcUrl, @@ -23,6 +29,8 @@ function setupGhost(user, token) { rc_token: token, name: user.name, email: getVerifiedEmail(user.emails), + announce_token: announceToken, + collaboration_token: collabToken, blogTitle, }], }; diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 8c466596cab4..ff4724e6cf23 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -32,6 +32,24 @@ Meteor.startup(() => { public: true, }); + this.add('Announcement_Token', 'announcement_token', { + type: 'string', + enableQuery: { + _id: 'Articles_enabled', + value: true, + }, + public: true, + }); + + this.add('Collaboration_Token', 'collaboration_token', { + type: 'string', + enableQuery: { + _id: 'Articles_enabled', + value: true, + }, + public: true, + }); + this.add('Articles_admin_panel', 'Articles_admin_panel', { type: 'link', enableQuery: { From 4c9c89e5158e5672a8955041f0dce3ede6b3a8ea Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Tue, 11 Jun 2019 18:44:02 +0530 Subject: [PATCH 10/18] fix a var bug --- app/articles/server/api/api.js | 11 +++++------ app/articles/server/methods/admin.js | 8 ++++---- app/articles/server/settings.js | 2 ++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/articles/server/api/api.js b/app/articles/server/api/api.js index 40a01fc22c55..634378c80a75 100644 --- a/app/articles/server/api/api.js +++ b/app/articles/server/api/api.js @@ -29,10 +29,11 @@ const Api = new Restivus({ } } - this.announceToken = settings.get('Announcement_Token'); - - if (this.announceToken !== decodeURIComponent(this.request.params.token)) { + this.announceToken = settings.get('Announcement_Token'); + const { blogId } = this.request.params; + const token = decodeURIComponent(this.request.params.token); + if (this.announceToken !== `${ blogId }/${ token }`) { return { error: { statusCode: 404, @@ -54,8 +55,6 @@ const Api = new Restivus({ }); function executeAnnouncementRest() { - - const defaultValues = { channel: this.bodyParams.channel, alias: this.bodyParams.alias, @@ -87,4 +86,4 @@ function executeAnnouncementRest() { Api.addRoute(':blogId/:token', { authRequired: true }, { post: executeAnnouncementRest, get: executeAnnouncementRest, -}); \ No newline at end of file +}); diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 800143f0d15f..660a87efe019 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -18,10 +18,10 @@ function setupGhost(user, token) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const blogTitle = settings.get('Article_Site_title'); const blogToken = Random.id(17); - const announceToken = `${blogToken}/${Random.id(24)}`; - const collabToken = `${blogToken}/${Random.id(24)}`; - settings.updateById('Announcement_Token', announce_token); - settings.updateById('Collaboration_Token', announce_token); + const announceToken = `${ blogToken }/${ Random.id(24) }`; + const collabToken = `${ blogToken }/${ Random.id(24) }`; + settings.updateById('Announcement_Token', announceToken); + settings.updateById('Collaboration_Token', collabToken); const data = { setup: [{ rc_url: rcUrl, diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index ff4724e6cf23..62f6e2080335 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -34,6 +34,7 @@ Meteor.startup(() => { this.add('Announcement_Token', 'announcement_token', { type: 'string', + readonly: true, enableQuery: { _id: 'Articles_enabled', value: true, @@ -43,6 +44,7 @@ Meteor.startup(() => { this.add('Collaboration_Token', 'collaboration_token', { type: 'string', + readonly: true, enableQuery: { _id: 'Articles_enabled', value: true, From 1bf9287c6bd123f407075f7615fbd7e1d383e7a9 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Sun, 16 Jun 2019 13:49:22 +0530 Subject: [PATCH 11/18] add type for discussion in api params --- app/api/server/v1/rooms.js | 3 ++- app/discussion/server/methods/createDiscussion.js | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/api/server/v1/rooms.js b/app/api/server/v1/rooms.js index 7cab7a10977b..c4892b409ad0 100644 --- a/app/api/server/v1/rooms.js +++ b/app/api/server/v1/rooms.js @@ -222,7 +222,7 @@ API.v1.addRoute('rooms.leave', { authRequired: true }, { API.v1.addRoute('rooms.createDiscussion', { authRequired: true }, { post() { - const { prid, pmid, reply, t_name, users } = this.bodyParams; + const { prid, pmid, reply, t_name, users, t } = this.bodyParams; if (!prid) { return API.v1.failure('Body parameter "prid" is required.'); } @@ -238,6 +238,7 @@ API.v1.addRoute('rooms.createDiscussion', { authRequired: true }, { pmid, t_name, reply, + t, users: users || [], })); diff --git a/app/discussion/server/methods/createDiscussion.js b/app/discussion/server/methods/createDiscussion.js index 78535311ad9d..63cd7470483d 100644 --- a/app/discussion/server/methods/createDiscussion.js +++ b/app/discussion/server/methods/createDiscussion.js @@ -33,7 +33,7 @@ const mentionMessage = (rid, { _id, username, name }, message_embedded) => { return Messages.insert(welcomeMessage); }; -const create = ({ prid, pmid, t_name, reply, users }) => { +const create = ({ prid, pmid, t_name, reply, t, users }) => { // if you set both, prid and pmid, and the rooms doesnt match... should throw an error) let message = false; if (pmid) { @@ -86,8 +86,10 @@ const create = ({ prid, pmid, t_name, reply, users }) => { // auto invite the replied message owner const invitedUsers = message ? [message.u.username, ...users] : users; - // discussions are always created as private groups - const discussion = createRoom('p', name, user.username, [...new Set(invitedUsers)], false, { + // discussions are created as private groups, if t is not given as 'c' + const type = t === 'c' ? 'c' : 'p'; + + const discussion = createRoom(type, name, user.username, [...new Set(invitedUsers)], false, { fname: t_name, description: message.msg, // TODO discussions remove topic: p_room.name, // TODO discussions remove @@ -121,7 +123,7 @@ Meteor.methods({ * @param {string} t_name - discussion name * @param {string[]} users - users to be added */ - createDiscussion({ prid, pmid, t_name, reply, users }) { + createDiscussion({ prid, pmid, t_name, reply, t, users }) { if (!settings.get('Discussion_enabled')) { throw new Meteor.Error('error-action-not-allowed', 'You are not allowed to create a discussion', { method: 'createDiscussion' }); } @@ -135,6 +137,6 @@ Meteor.methods({ throw new Meteor.Error('error-action-not-allowed', 'You are not allowed to create a discussion', { method: 'createDiscussion' }); } - return create({ uid, prid, pmid, t_name, reply, users }); + return create({ uid, prid, pmid, t_name, reply, t, users }); }, }); From 4457e32e4a259b81a391b8066751b3765f1cce58 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Mon, 24 Jun 2019 22:27:04 +0530 Subject: [PATCH 12/18] add outgoing webhook for articles for syncDB --- app/articles/server/index.js | 2 + app/articles/server/lib/triggerHandler.js | 150 ++++++++++++++++++ app/articles/server/methods/admin.js | 6 +- app/articles/server/settings.js | 2 +- app/articles/server/triggers.js | 22 +++ app/articles/server/utils/url.js | 4 + .../server/functions/saveRoomType.js | 2 + app/lib/server/functions/setEmail.js | 4 +- app/lib/server/functions/setRealName.js | 2 + app/lib/server/functions/setUserAvatar.js | 2 + app/lib/server/functions/setUsername.js | 2 + app/utils/lib/RoomTypeConfig.js | 2 +- 12 files changed, 194 insertions(+), 6 deletions(-) create mode 100644 app/articles/server/lib/triggerHandler.js create mode 100644 app/articles/server/triggers.js diff --git a/app/articles/server/index.js b/app/articles/server/index.js index eb672b4731f1..b9804b9805f2 100644 --- a/app/articles/server/index.js +++ b/app/articles/server/index.js @@ -2,3 +2,5 @@ import './settings'; import './methods/admin'; import './methods/user'; import './api/api'; +import './lib/triggerHandler'; +import './triggers'; diff --git a/app/articles/server/lib/triggerHandler.js b/app/articles/server/lib/triggerHandler.js new file mode 100644 index 000000000000..6db1feeef5ad --- /dev/null +++ b/app/articles/server/lib/triggerHandler.js @@ -0,0 +1,150 @@ +import { Meteor } from 'meteor/meteor'; +import { HTTP } from 'meteor/http'; + +import { settings } from '../../../settings'; +import { API } from '../utils/url'; + +const api = new API(); + +export const triggerHandler = new class ArticlesSettingsHandler { + constructor() { + this.trigger = {}; + } + + eventNameArgumentsToObject(...args) { + const argObject = { + event: args[0], + }; + switch (argObject.event) { + case 'userEmail': + case 'userRealname': + case 'userAvatar': + case 'userName': + if (args.length >= 2) { + argObject.user = args[1]; + } + break; + case 'roomType': + case 'roomName': + if (args.length >= 2) { + argObject.room = args[1]; + } + break; + case 'siteTitle': + argObject.article = args[1]; + break; + default: + argObject.event = undefined; + break; + } + return argObject; + } + + mapEventArgsToData(data, { event, room, user, article }) { + data.event = event; + switch (event) { + case 'userEmail': + case 'userRealname': + case 'userAvatar': + case 'userName': + data.user_id = user._id; + + if (user.avatar) { + data.avatar = user.avatar; + } + + if (user.name) { + data.name = user.name; + } + + if (user.email) { + data.email = user.email; + } + + if (user.username) { + data.username = user.username; + } + break; + case 'roomType': + case 'roomName': + data.room_id = room.rid; + + if (room.name) { + data.name = room.name; + } + + if (room.type) { + data.type = room.type; + } + break; + case 'siteTitle': + if (article && article.title) { + data.title = article.title; + } + break; + default: + break; + } + } + + executeTrigger(...args) { + const argObject = this.eventNameArgumentsToObject(...args); + const { event } = argObject; + + if (!event) { + return; + } + + if (settings.get('Articles_enabled')) { + const token = settings.get('Settings_Token'); + this.trigger.api = api.rhooks(token); + this.trigger.retryCount = 5; + } + + this.executeTriggerUrl(argObject, 0); + } + + executeTriggerUrl({ event, room, user, article }, tries = 0) { + if (!this.trigger.api) { + return; + } + const url = this.trigger.api; + + const data = {}; + + this.mapEventArgsToData(data, { event, room, user, article }); + + const opts = { + params: {}, + method: 'POST', + url, + data, + auth: undefined, + npmRequestOptions: { + rejectUnauthorized: !settings.get('Allow_Invalid_SelfSigned_Certs'), + strictSSL: !settings.get('Allow_Invalid_SelfSigned_Certs'), + }, + headers: { + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36', + }, + }; + + if (!opts.url || !opts.method) { + return; + } + + HTTP.call(opts.method, opts.url, opts, (error, result) => { + // if the result contained nothing or wasn't a successful statusCode + if (!result) { + if (tries < this.trigger.retryCount) { + // 2 seconds, 4 seconds, 8 seconds + const waitTime = Math.pow(2, tries + 1) * 1000; + + Meteor.setTimeout(() => { + this.executeTriggerUrl({ event, room, user }, tries + 1); + }, waitTime); + } + } + }); + } +}(); diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 660a87efe019..1cf9323bb09b 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -19,9 +19,9 @@ function setupGhost(user, token) { const blogTitle = settings.get('Article_Site_title'); const blogToken = Random.id(17); const announceToken = `${ blogToken }/${ Random.id(24) }`; - const collabToken = `${ blogToken }/${ Random.id(24) }`; + const settingsToken = `${ blogToken }/${ Random.id(24) }`; settings.updateById('Announcement_Token', announceToken); - settings.updateById('Collaboration_Token', collabToken); + settings.updateById('Settings_Token', settingsToken); const data = { setup: [{ rc_url: rcUrl, @@ -30,7 +30,7 @@ function setupGhost(user, token) { name: user.name, email: getVerifiedEmail(user.emails), announce_token: announceToken, - collaboration_token: collabToken, + settings_token: settingsToken, blogTitle, }], }; diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 62f6e2080335..273d978f4e94 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -42,7 +42,7 @@ Meteor.startup(() => { public: true, }); - this.add('Collaboration_Token', 'collaboration_token', { + this.add('Settings_Token', 'articles_settings_token', { type: 'string', readonly: true, enableQuery: { diff --git a/app/articles/server/triggers.js b/app/articles/server/triggers.js new file mode 100644 index 000000000000..4c726b3833a0 --- /dev/null +++ b/app/articles/server/triggers.js @@ -0,0 +1,22 @@ +import { callbacks } from '../../callbacks'; +import { triggerHandler } from './lib/triggerHandler'; +import { settings } from '../../settings'; + +const callbackHandler = function _callbackHandler(eventType) { + return function _wrapperFunction(...args) { + return triggerHandler.executeTrigger(eventType, ...args); + }; +}; + +const priority = settings.get('Articles_enabled') ? callbacks.priority.HIGH : callbacks.priority.LOW; + +callbacks.add('afterUserEmailChange', callbackHandler('userEmail'), priority); +callbacks.add('afterUserRealNameChange', callbackHandler('userRealname'), priority); +callbacks.add('afterUserAvatarChange', callbackHandler('userAvatar'), priority); +callbacks.add('afterUsernameChange', callbackHandler('userName'), priority); +callbacks.add('afterRoomTypeChange', callbackHandler('roomType'), priority); +callbacks.add('afterRoomNameChange', callbackHandler('roomName'), priority); + +settings.get('Article_Site_title', (key, value) => { + triggerHandler.executeTrigger('siteTitle', { title: value }); +}); diff --git a/app/articles/server/utils/url.js b/app/articles/server/utils/url.js index ba2be4c72c0c..0eaef9d02cba 100644 --- a/app/articles/server/utils/url.js +++ b/app/articles/server/utils/url.js @@ -24,6 +24,10 @@ export class API { return this.buildAPIUrl('session'); } + rhooks(token) { + return this.buildAPIUrl('rhooks', token); + } + invite() { return this.buildAPIUrl('invitesetting'); } diff --git a/app/channel-settings/server/functions/saveRoomType.js b/app/channel-settings/server/functions/saveRoomType.js index 9bf6cb4503ba..6831e239e9d8 100644 --- a/app/channel-settings/server/functions/saveRoomType.js +++ b/app/channel-settings/server/functions/saveRoomType.js @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { TAPi18n } from 'meteor/tap:i18n'; +import { callbacks } from '../../../callbacks'; import { Rooms, Subscriptions, Messages } from '../../../models'; import { settings } from '../../../settings'; @@ -43,5 +44,6 @@ export const saveRoomType = function(rid, roomType, user, sendMessage = true) { } Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser('room_changed_privacy', rid, message, user); } + callbacks.run('afterRoomTypeChange', { rid, type: roomType }); return result; }; diff --git a/app/lib/server/functions/setEmail.js b/app/lib/server/functions/setEmail.js index 982194ae78e5..4a06a5622d3b 100644 --- a/app/lib/server/functions/setEmail.js +++ b/app/lib/server/functions/setEmail.js @@ -4,6 +4,7 @@ import s from 'underscore.string'; import { Users } from '../../../models'; import { hasPermission } from '../../../authorization'; import { RateLimiter, validateEmailDomain } from '../lib'; +import { callbacks } from '../../../callbacks'; import { checkEmailAvailability } from '.'; @@ -21,7 +22,7 @@ const _setEmail = function(userId, email, shouldSendVerificationEmail = true) { const user = Users.findOneById(userId); - // User already has desired username, return + // User already has desired email, return if (user.emails && user.emails[0] && user.emails[0].address === email) { return user; } @@ -37,6 +38,7 @@ const _setEmail = function(userId, email, shouldSendVerificationEmail = true) { if (shouldSendVerificationEmail === true) { Meteor.call('sendConfirmationEmail', user.email); } + callbacks.run('afterUserEmailChange', { _id: user._id, email }); return user; }; diff --git a/app/lib/server/functions/setRealName.js b/app/lib/server/functions/setRealName.js index 40262fd612bf..23efbc52f085 100644 --- a/app/lib/server/functions/setRealName.js +++ b/app/lib/server/functions/setRealName.js @@ -6,6 +6,7 @@ import { settings } from '../../../settings'; import { Notifications } from '../../../notifications'; import { hasPermission } from '../../../authorization'; import { RateLimiter } from '../lib'; +import { callbacks } from '../../../callbacks'; export const _setRealName = function(userId, name) { name = s.trim(name); @@ -41,6 +42,7 @@ export const _setRealName = function(userId, name) { username: user.username, }); } + callbacks.run('afterUserRealNameChange', { _id: user._id, name }); return user; }; diff --git a/app/lib/server/functions/setUserAvatar.js b/app/lib/server/functions/setUserAvatar.js index 4e7ec6201c9b..82e1daaba497 100644 --- a/app/lib/server/functions/setUserAvatar.js +++ b/app/lib/server/functions/setUserAvatar.js @@ -5,6 +5,7 @@ import { RocketChatFile } from '../../../file'; import { FileUpload } from '../../../file-upload'; import { Users } from '../../../models'; import { Notifications } from '../../../notifications'; +import { callbacks } from '../../../callbacks'; export const setUserAvatar = function(user, dataURI, contentType, service) { let encoding; @@ -63,4 +64,5 @@ export const setUserAvatar = function(user, dataURI, contentType, service) { Notifications.notifyLogged('updateAvatar', { username: user.username }); }, 500); }); + callbacks.run('afterUserAvatarChange', { _id: user._id, avatar: image }); }; diff --git a/app/lib/server/functions/setUsername.js b/app/lib/server/functions/setUsername.js index baed79351cf8..cf2e0a2a1be4 100644 --- a/app/lib/server/functions/setUsername.js +++ b/app/lib/server/functions/setUsername.js @@ -8,6 +8,7 @@ import { Users, Messages, Subscriptions, Rooms, LivechatDepartmentAgents } from import { hasPermission } from '../../../authorization'; import { RateLimiter } from '../lib'; import { Notifications } from '../../../notifications/server'; +import { callbacks } from '../../../callbacks'; import { checkUsernameAvailability, setUserAvatar, getAvatarSuggestionForUser } from '.'; @@ -92,6 +93,7 @@ export const _setUsername = function(userId, u) { name: user.name, username: user.username, }); + callbacks.run('afterUsernameChange', { _id: user._id, username }); return user; }; diff --git a/app/utils/lib/RoomTypeConfig.js b/app/utils/lib/RoomTypeConfig.js index ac87d16863cd..02638f39e1ce 100644 --- a/app/utils/lib/RoomTypeConfig.js +++ b/app/utils/lib/RoomTypeConfig.js @@ -258,7 +258,7 @@ export class RoomTypeConfig { const title = `#${ this.roomName(room) }`; - const text = `${ settings.get('UI_Use_Real_Name') ? user.name : user.username }: ${ notificationMessage }`; + const text = `${ settings && settings.get('UI_Use_Real_Name') ? user.name : user.username }: ${ notificationMessage }`; return { title, text }; } From 1febcae155ba6d4d3ff99815adf5c548036d7577 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Mon, 1 Jul 2019 23:47:10 +0530 Subject: [PATCH 13/18] Allow userdata fetch(including emails) using token --- app/articles/server/api/api.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/app/articles/server/api/api.js b/app/articles/server/api/api.js index 634378c80a75..933c510dc05e 100644 --- a/app/articles/server/api/api.js +++ b/app/articles/server/api/api.js @@ -45,9 +45,7 @@ const Api = new Restivus({ }; } - const user = Models.Users.findOne({ - _id: this.bodyParams.userId, - }); + const user = this.bodyParams.userId ? Models.Users.findOne({ _id: this.bodyParams.userId }) : Models.Users.findOne({ username: this.bodyParams.username }); return { user }; }, @@ -69,8 +67,6 @@ function executeAnnouncementRest() { return API.v1.success(); } - // this.bodyParams.bot = { i: this.integration._id }; - try { const message = processWebhookMessage(this.bodyParams, this.user, defaultValues); if (_.isEmpty(message)) { @@ -83,7 +79,26 @@ function executeAnnouncementRest() { } } +function executefetchUserRest() { + try { + const { _id, name, username, emails } = this.user; + const user = { _id, name, username, emails }; + + return API.v1.success({ user }); + } catch ({ error, message }) { + return API.v1.failure(error || message); + } +} + Api.addRoute(':blogId/:token', { authRequired: true }, { post: executeAnnouncementRest, get: executeAnnouncementRest, }); + +// If a user is editor/admin in Ghost but is not an admin in RC, +// then the e-mail will not be provided to that user +// This method will allow user to fetch user with email. +Api.addRoute(':blogId/:token/getUser', { authRequired: true }, { + post: executefetchUserRest, + get: executefetchUserRest, +}); From ff9eea8eea5e22691ffe40aeadf70c1afb503084 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Wed, 17 Jul 2019 12:53:13 +0530 Subject: [PATCH 14/18] add article in user info and openRoom msg action --- app/articles/server/methods/admin.js | 9 ---- app/articles/server/methods/user.js | 44 +++++++++++++++++--- app/articles/server/utils/url.js | 5 +++ app/lib/server/functions/insertMessage.js | 2 + app/lib/server/functions/sendMessage.js | 2 + app/message-action/client/messageAction.html | 10 +++++ app/ui-flextab/client/tabs/userActions.js | 18 ++++++++ app/ui/client/views/app/room.js | 8 ++++ 8 files changed, 83 insertions(+), 15 deletions(-) diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 1cf9323bb09b..394536e3fc1e 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,6 +1,5 @@ import { Meteor } from 'meteor/meteor'; import { HTTP } from 'meteor/http'; -import _ from 'underscore'; import { Random } from 'meteor/random'; import { API } from '../utils/url'; @@ -8,12 +7,6 @@ import { settings } from '../../../settings'; const api = new API(); -// Try to get a verified email, if available. -function getVerifiedEmail(emails) { - const email = _.find(emails, (e) => e.verified); - return email || emails[0].address; -} - function setupGhost(user, token) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const blogTitle = settings.get('Article_Site_title'); @@ -27,8 +20,6 @@ function setupGhost(user, token) { rc_url: rcUrl, rc_id: user._id, rc_token: token, - name: user.name, - email: getVerifiedEmail(user.emails), announce_token: announceToken, settings_token: settingsToken, blogTitle, diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index 1a4709595fb3..c5d424f29977 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -18,15 +18,14 @@ function addUser(user, accessToken) { return HTTP.call('POST', api.createAccount(), { data, headers: { 'Content-Type': 'application/json' } }); } -function userExist(user, accessToken) { +function userExist(id) { const data = { user: [{ - rc_uid: user._id, - rc_token: accessToken, + rc_uid: id, }], }; const response = HTTP.call('GET', api.userExist(), { data, headers: { 'Content-Type': 'application/json' } }); - return response.data && response.data.users[0] && response.data.users[0].exist; + return response.data; } function inviteSetting() { @@ -47,6 +46,13 @@ function redirectGhost() { }; } +function redirectUser(slug) { + return { + link: api.authorUrl(slug), + message: 'Redirecting.', + }; +} + Meteor.methods({ redirectUserToArticles(accessToken) { const enabled = settings.get('Articles_enabled'); @@ -61,11 +67,16 @@ Meteor.methods({ const response = HTTP.call('GET', api.setup()); if (response.data.setup[0].status) { // Ghost site is already setup - // user exist in ghost - if (userExist(user, accessToken)) { + const u = userExist(user._id).users[0]; + + if (u.exist && u.status === 'active') { return redirectGhost(); } + if (u.exist) { // user exist but suspended + throw new Meteor.Error('You are suspended from Ghost'); + } + const inviteOnly = inviteSetting(); // create user account in ghost @@ -82,4 +93,25 @@ Meteor.methods({ throw new Meteor.Error(e.error || 'Unable to connect to Ghost.'); } }, + + redirectToUsersArticles(_id) { + const enabled = settings.get('Articles_enabled'); + + if (!enabled) { + throw new Meteor.Error('Articles are disabled'); + } + const errMsg = 'User is not a member of Ghost'; + + try { + const u = userExist(_id).users[0]; + + if (u.exist) { + return redirectUser(u.slug); + } + + throw new Meteor.Error(errMsg); + } catch (e) { + throw new Meteor.Error(e.error || errMsg); + } + }, }); diff --git a/app/articles/server/utils/url.js b/app/articles/server/utils/url.js index 0eaef9d02cba..757feb2634bb 100644 --- a/app/articles/server/utils/url.js +++ b/app/articles/server/utils/url.js @@ -16,6 +16,11 @@ export class API { return `${ base }/ghost`; } + authorUrl(slug) { + const base = settings.get('Article_Site_Url').replace(/\/$/, ''); + return `${ base }/author/${ slug }`; + } + setup() { return this.buildAPIUrl('authentication', 'setup'); } diff --git a/app/lib/server/functions/insertMessage.js b/app/lib/server/functions/insertMessage.js index 35c7ccec1501..c673c130ee8c 100644 --- a/app/lib/server/functions/insertMessage.js +++ b/app/lib/server/functions/insertMessage.js @@ -40,6 +40,8 @@ const validateAttachmentsActions = (attachmentActions) => { webview_height_ratio: String, msg: String, msg_in_chat_window: Boolean, + open_room_by_id: Boolean, + rid: String, })); }; diff --git a/app/lib/server/functions/sendMessage.js b/app/lib/server/functions/sendMessage.js index 290218f14e3d..0335dbac0943 100644 --- a/app/lib/server/functions/sendMessage.js +++ b/app/lib/server/functions/sendMessage.js @@ -63,6 +63,8 @@ const validateAttachmentsActions = (attachmentActions) => { webview_height_ratio: String, msg: String, msg_in_chat_window: Boolean, + open_room_by_id: Boolean, + rid: String, })); }; diff --git a/app/message-action/client/messageAction.html b/app/message-action/client/messageAction.html index 8d6c73566772..b212c51b062c 100644 --- a/app/message-action/client/messageAction.html +++ b/app/message-action/client/messageAction.html @@ -13,6 +13,11 @@ {{/if}} + {{#if open_room_by_id}} + + {{/if}} {{/if}} {{#if text}} {{#if url}} @@ -25,6 +30,11 @@ {{text}} {{/if}} + {{#if open_room_by_id}} + + {{/if}} {{/if}} {{/if}}
diff --git a/app/ui-flextab/client/tabs/userActions.js b/app/ui-flextab/client/tabs/userActions.js index 2e5657cd0809..ab7fc9886c9d 100644 --- a/app/ui-flextab/client/tabs/userActions.js +++ b/app/ui-flextab/client/tabs/userActions.js @@ -111,6 +111,24 @@ export const getActions = ({ user, directActions, hideAdminControls }) => { }, }, + { + icon: 'articles', + name: t('Articles'), + action: prevent(getUser, ({ _id }) => + Meteor.call('redirectToUsersArticles', _id, (error, result) => { + if (error) { + return handleError(error); + } + const redirectWindow = window.open(result.link, '_blank'); + toastr.success(result.message, 'Success'); + redirectWindow.location; + }) + ), + condition() { + return settings.get('Articles_enabled'); + }, + }, + function() { if (isSelf(this.username) || !directActions) { return; diff --git a/app/ui/client/views/app/room.js b/app/ui/client/views/app/room.js index 95113da33759..d25dd6fe6319 100644 --- a/app/ui/client/views/app/room.js +++ b/app/ui/client/views/app/room.js @@ -944,6 +944,14 @@ Template.room.events({ await call('sendMessage', msgObject); }, + 'click .js-actionButton-openRoom'(event) { + const rid = event.currentTarget.value; + if (!rid) { + return; + } + + FlowRouter.goToRoomById(rid); + }, 'click .js-actionButton-respondWithMessage'(event, instance) { const rid = instance.data._id; const msg = event.currentTarget.value; From d0d5c367bb2ceb92a8cdf359582e45595c0416a7 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Thu, 25 Jul 2019 17:26:34 +0530 Subject: [PATCH 15/18] fix some bugs and improve code structure --- app/articles/client/index.js | 0 app/articles/index.js | 0 app/articles/server/api/api.js | 7 +- app/articles/server/lib/triggerHandler.js | 70 +-------- app/articles/server/logoutCleanUp.js | 12 +- app/articles/server/methods/admin.js | 65 +++----- app/articles/server/methods/user.js | 96 ++++-------- app/articles/server/settings.js | 26 ++-- app/articles/server/triggers.js | 7 +- app/articles/server/utils/ghostAPI.js | 139 ++++++++++++++++++ app/articles/server/utils/url.js | 47 ------ app/authorization/server/startup.js | 1 + .../client/lib/fileUploadHandler.js | 9 +- app/lib/server/functions/deleteUser.js | 2 + app/lib/server/functions/setUserAvatar.js | 2 - app/ui-admin/client/admin.js | 2 - app/ui-flextab/client/tabs/userActions.js | 3 +- app/ui-sidenav/client/sidebarHeader.js | 4 +- client/importPackages.js | 1 - packages/rocketchat-i18n/i18n/en.i18n.json | 10 ++ 20 files changed, 243 insertions(+), 260 deletions(-) delete mode 100644 app/articles/client/index.js delete mode 100644 app/articles/index.js create mode 100644 app/articles/server/utils/ghostAPI.js delete mode 100644 app/articles/server/utils/url.js diff --git a/app/articles/client/index.js b/app/articles/client/index.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/app/articles/index.js b/app/articles/index.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/app/articles/server/api/api.js b/app/articles/server/api/api.js index 933c510dc05e..9f6de329926b 100644 --- a/app/articles/server/api/api.js +++ b/app/articles/server/api/api.js @@ -30,10 +30,9 @@ const Api = new Restivus({ } this.announceToken = settings.get('Announcement_Token'); - const { blogId } = this.request.params; const token = decodeURIComponent(this.request.params.token); - if (this.announceToken !== `${ blogId }/${ token }`) { + if (this.announceToken !== token) { return { error: { statusCode: 404, @@ -90,7 +89,7 @@ function executefetchUserRest() { } } -Api.addRoute(':blogId/:token', { authRequired: true }, { +Api.addRoute(':token', { authRequired: true }, { post: executeAnnouncementRest, get: executeAnnouncementRest, }); @@ -98,7 +97,7 @@ Api.addRoute(':blogId/:token', { authRequired: true }, { // If a user is editor/admin in Ghost but is not an admin in RC, // then the e-mail will not be provided to that user // This method will allow user to fetch user with email. -Api.addRoute(':blogId/:token/getUser', { authRequired: true }, { +Api.addRoute(':token/getUser', { authRequired: true }, { post: executefetchUserRest, get: executefetchUserRest, }); diff --git a/app/articles/server/lib/triggerHandler.js b/app/articles/server/lib/triggerHandler.js index 6db1feeef5ad..3a198f4312ee 100644 --- a/app/articles/server/lib/triggerHandler.js +++ b/app/articles/server/lib/triggerHandler.js @@ -1,16 +1,6 @@ -import { Meteor } from 'meteor/meteor'; -import { HTTP } from 'meteor/http'; - -import { settings } from '../../../settings'; -import { API } from '../utils/url'; - -const api = new API(); +import { ghostAPI } from '../utils/ghostAPI'; export const triggerHandler = new class ArticlesSettingsHandler { - constructor() { - this.trigger = {}; - } - eventNameArgumentsToObject(...args) { const argObject = { event: args[0], @@ -18,8 +8,8 @@ export const triggerHandler = new class ArticlesSettingsHandler { switch (argObject.event) { case 'userEmail': case 'userRealname': - case 'userAvatar': case 'userName': + case 'deleteUser': if (args.length >= 2) { argObject.user = args[1]; } @@ -45,14 +35,10 @@ export const triggerHandler = new class ArticlesSettingsHandler { switch (event) { case 'userEmail': case 'userRealname': - case 'userAvatar': case 'userName': + case 'deleteUser': data.user_id = user._id; - if (user.avatar) { - data.avatar = user.avatar; - } - if (user.name) { data.name = user.name; } @@ -95,56 +81,10 @@ export const triggerHandler = new class ArticlesSettingsHandler { return; } - if (settings.get('Articles_enabled')) { - const token = settings.get('Settings_Token'); - this.trigger.api = api.rhooks(token); - this.trigger.retryCount = 5; - } - - this.executeTriggerUrl(argObject, 0); - } - - executeTriggerUrl({ event, room, user, article }, tries = 0) { - if (!this.trigger.api) { - return; - } - const url = this.trigger.api; - const data = {}; - this.mapEventArgsToData(data, { event, room, user, article }); - - const opts = { - params: {}, - method: 'POST', - url, - data, - auth: undefined, - npmRequestOptions: { - rejectUnauthorized: !settings.get('Allow_Invalid_SelfSigned_Certs'), - strictSSL: !settings.get('Allow_Invalid_SelfSigned_Certs'), - }, - headers: { - 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36', - }, - }; - - if (!opts.url || !opts.method) { - return; - } + this.mapEventArgsToData(data, argObject); - HTTP.call(opts.method, opts.url, opts, (error, result) => { - // if the result contained nothing or wasn't a successful statusCode - if (!result) { - if (tries < this.trigger.retryCount) { - // 2 seconds, 4 seconds, 8 seconds - const waitTime = Math.pow(2, tries + 1) * 1000; - - Meteor.setTimeout(() => { - this.executeTriggerUrl({ event, room, user }, tries + 1); - }, waitTime); - } - } - }); + ghostAPI.executeTriggerUrl(data, 0); } }(); diff --git a/app/articles/server/logoutCleanUp.js b/app/articles/server/logoutCleanUp.js index 9c527585ac91..688e80c205f9 100644 --- a/app/articles/server/logoutCleanUp.js +++ b/app/articles/server/logoutCleanUp.js @@ -1,16 +1,10 @@ -import { Meteor } from 'meteor/meteor'; -import { HTTP } from 'meteor/http'; - import { settings } from '../../settings'; -import { API } from './utils/url'; - -const api = new API(); +import { ghostAPI } from './utils/ghostAPI'; export function ghostCleanUp(cookie) { - const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); try { - if (settings.get('Articles_enabled')) { - HTTP.call('DELETE', api.session(), { headers: { cookie, referer: rcUrl } }); + if (settings.get('Articles_Enabled')) { + ghostAPI.deleteSesseion(cookie); } } catch (e) { // Do nothing if failed to logout from Ghost. diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index 394536e3fc1e..dee3a8785e21 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -1,63 +1,46 @@ import { Meteor } from 'meteor/meteor'; -import { HTTP } from 'meteor/http'; -import { Random } from 'meteor/random'; -import { API } from '../utils/url'; +import { hasPermission } from '../../../authorization'; +import { ghostAPI } from '../utils/ghostAPI'; import { settings } from '../../../settings'; -const api = new API(); - -function setupGhost(user, token) { - const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); - const blogTitle = settings.get('Article_Site_title'); - const blogToken = Random.id(17); - const announceToken = `${ blogToken }/${ Random.id(24) }`; - const settingsToken = `${ blogToken }/${ Random.id(24) }`; - settings.updateById('Announcement_Token', announceToken); - settings.updateById('Settings_Token', settingsToken); - const data = { - setup: [{ - rc_url: rcUrl, - rc_id: user._id, - rc_token: token, - announce_token: announceToken, - settings_token: settingsToken, - blogTitle, - }], - }; - return HTTP.call('POST', api.setup(), { data, headers: { 'Content-Type': 'application/json' } }); -} - -function redirectGhost() { - return { - link: api.siteUrl(), - message: 'Ghost is Set up. Redirecting.', - }; -} - Meteor.methods({ - Articles_admin_panel(token) { - const enabled = settings.get('Articles_enabled'); + articlesAdminPanel(loginToken) { + if (!Meteor.userId()) { + throw new Meteor.Error('error-invalid-user', 'Invalid user', { + method: 'articlesAdminPanel', + }); + } + + const enabled = settings.get('Articles_Enabled'); if (!enabled) { - throw new Meteor.Error('Articles are disabled'); + throw new Meteor.Error('error-articles-disabled', 'Articles are disabled', { + method: 'articlesAdminPanel', + }); } - const user = Meteor.users.findOne(Meteor.userId()); let errMsg = 'Unable to connect to Ghost. Make sure Ghost is running'; try { - let response = HTTP.call('GET', api.setup()); + let response = ghostAPI.isSetup(); if (response.data.setup[0].status) { // Ghost site is already setup - return redirectGhost(); + return ghostAPI.redirectToGhostLink; + } + + if (!hasPermission(Meteor.userId(), 'setup-ghost')) { + throw new Meteor.Error('error-action-not-allowed', 'Setting up Ghost is not allowed', { + method: 'articlesAdminPanel', + }); } // Setup Ghost Site and set title - response = setupGhost(user, token); + response = ghostAPI.setupGhost(loginToken); + errMsg = 'Unable to setup. Make sure Ghost is running'; if (response.statusCode === 201 && response.content) { - return redirectGhost(); + return ghostAPI.redirectToGhostLink; } throw new Meteor.Error(errMsg); diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index c5d424f29977..092fa4280c8e 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -1,87 +1,47 @@ import { Meteor } from 'meteor/meteor'; -import { HTTP } from 'meteor/http'; -import { API } from '../utils/url'; +import { ghostAPI } from '../utils/ghostAPI'; import { settings } from '../../../settings'; -const api = new API(); - -function addUser(user, accessToken) { - const data = { - user: [{ - rc_username: user.username, - role: 'Author', // User can add itself only as Author, even if he/she is admin in RC - rc_uid: user._id, - rc_token: accessToken, - }], - }; - return HTTP.call('POST', api.createAccount(), { data, headers: { 'Content-Type': 'application/json' } }); -} - -function userExist(id) { - const data = { - user: [{ - rc_uid: id, - }], - }; - const response = HTTP.call('GET', api.userExist(), { data, headers: { 'Content-Type': 'application/json' } }); - return response.data; -} - -function inviteSetting() { - const response = HTTP.call('GET', api.invite()); - const { settings } = response.data; - - if (settings && settings[0] && settings[0].key === 'invite_only') { - return settings[0].value; - } - // default value in Ghost - return false; -} - -function redirectGhost() { - return { - link: api.siteUrl(), - message: 'Ghost is Set up. Redirecting.', - }; -} - -function redirectUser(slug) { - return { - link: api.authorUrl(slug), - message: 'Redirecting.', - }; -} - Meteor.methods({ - redirectUserToArticles(accessToken) { - const enabled = settings.get('Articles_enabled'); + redirectUserToArticles(loginToken) { + if (!Meteor.userId()) { + throw new Meteor.Error('error-invalid-user', 'Invalid user', { + method: 'redirectUserToArticles', + }); + } + + const enabled = settings.get('Articles_Enabled'); if (!enabled) { - throw new Meteor.Error('Articles are disabled'); + throw new Meteor.Error('error-articles-disabled', 'Articles are disabled', { + method: 'redirectUserToArticles', + }); } - const user = Meteor.users.findOne(Meteor.userId()); + let errMsg = 'Ghost is not set up. Setup can be done from Admin Panel'; try { - const response = HTTP.call('GET', api.setup()); + const response = ghostAPI.isSetup(); if (response.data.setup[0].status) { // Ghost site is already setup - const u = userExist(user._id).users[0]; + const u = ghostAPI.userExistInGhost(Meteor.userId()).users[0]; if (u.exist && u.status === 'active') { - return redirectGhost(); + return ghostAPI.redirectToGhostLink; } if (u.exist) { // user exist but suspended - throw new Meteor.Error('You are suspended from Ghost'); + throw new Meteor.Error('error-articles-user-suspended', 'You are suspended from Ghost', { + method: 'redirectUserToArticles', + }); } - const inviteOnly = inviteSetting(); + const inviteOnly = ghostAPI.inviteSettingInGhost(); // create user account in ghost - if (!inviteOnly && addUser(user, accessToken).statusCode === 200) { - return redirectGhost(); + if (!inviteOnly && ghostAPI.createUserAccount(loginToken).statusCode === 200) { + return ghostAPI.redirectToGhostLink; } errMsg = inviteOnly ? 'You are not a member of Ghost. Ask admin to add' : 'Unable to setup your account'; @@ -95,18 +55,20 @@ Meteor.methods({ }, redirectToUsersArticles(_id) { - const enabled = settings.get('Articles_enabled'); + const enabled = settings.get('Articles_Enabled'); if (!enabled) { - throw new Meteor.Error('Articles are disabled'); + throw new Meteor.Error('error-articles-disabled', 'Articles are disabled', { + method: 'redirectToUsersArticles', + }); } const errMsg = 'User is not a member of Ghost'; try { - const u = userExist(_id).users[0]; + const response = ghostAPI.userExistInGhost(_id).users[0]; - if (u.exist) { - return redirectUser(u.slug); + if (response.exist) { + return ghostAPI.redirectToPublicLink(response.slug); } throw new Meteor.Error(errMsg); diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 273d978f4e94..cfa9c7d8a794 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -2,33 +2,31 @@ import { Meteor } from 'meteor/meteor'; import { settings } from '../../settings'; -const defaults = { - enable: false, -}; - Meteor.startup(() => { settings.addGroup('Articles', function() { - this.add('Articles_enabled', defaults.enable, { + this.add('Articles_Enabled', false, { type: 'boolean', i18nLabel: 'Enable', public: true, }); - this.add('Article_Site_title', 'Rocket.Chat', { + this.add('Article_Site_Title', 'Rocket.Chat', { type: 'string', enableQuery: { - _id: 'Articles_enabled', + _id: 'Articles_Enabled', value: true, }, + i18nLabel: 'Article_Site_Title', public: true, }); this.add('Article_Site_Url', 'http://localhost:2368', { type: 'string', enableQuery: { - _id: 'Articles_enabled', + _id: 'Articles_Enabled', value: true, }, + i18nLabel: 'Article_Site_Url', public: true, }); @@ -36,9 +34,10 @@ Meteor.startup(() => { type: 'string', readonly: true, enableQuery: { - _id: 'Articles_enabled', + _id: 'Articles_Enabled', value: true, }, + i18nLabel: 'Announcement_Token', public: true, }); @@ -46,19 +45,22 @@ Meteor.startup(() => { type: 'string', readonly: true, enableQuery: { - _id: 'Articles_enabled', + _id: 'Articles_Enabled', value: true, }, + i18nLabel: 'Settings_Token', public: true, }); - this.add('Articles_admin_panel', 'Articles_admin_panel', { + this.add('Articles_Admin_Panel', 'articlesAdminPanel', { type: 'link', enableQuery: { - _id: 'Articles_enabled', + _id: 'Articles_Enabled', value: true, }, linkText: 'Article_Admin_Panel', + i18nLabel: 'Article_Admin_Panel', + i18nDescription: 'Article_Admin_Panel_Description', }); }); }); diff --git a/app/articles/server/triggers.js b/app/articles/server/triggers.js index 4c726b3833a0..045c1c292f25 100644 --- a/app/articles/server/triggers.js +++ b/app/articles/server/triggers.js @@ -8,15 +8,16 @@ const callbackHandler = function _callbackHandler(eventType) { }; }; -const priority = settings.get('Articles_enabled') ? callbacks.priority.HIGH : callbacks.priority.LOW; +const priority = settings.get('Articles_Enabled') ? callbacks.priority.HIGH : callbacks.priority.LOW; callbacks.add('afterUserEmailChange', callbackHandler('userEmail'), priority); callbacks.add('afterUserRealNameChange', callbackHandler('userRealname'), priority); -callbacks.add('afterUserAvatarChange', callbackHandler('userAvatar'), priority); callbacks.add('afterUsernameChange', callbackHandler('userName'), priority); callbacks.add('afterRoomTypeChange', callbackHandler('roomType'), priority); +callbacks.add('afterDeleteUser', callbackHandler('deleteUser'), priority); +// TODO: find why roomName have no arg passed even with High priority. callbacks.add('afterRoomNameChange', callbackHandler('roomName'), priority); -settings.get('Article_Site_title', (key, value) => { +settings.get('Article_Site_Title', (key, value) => { triggerHandler.executeTrigger('siteTitle', { title: value }); }); diff --git a/app/articles/server/utils/ghostAPI.js b/app/articles/server/utils/ghostAPI.js new file mode 100644 index 000000000000..561341bb9a29 --- /dev/null +++ b/app/articles/server/utils/ghostAPI.js @@ -0,0 +1,139 @@ +import { Meteor } from 'meteor/meteor'; +import { HTTP } from 'meteor/http'; +import { Random } from 'meteor/random'; + +import { settings } from '../../../settings'; + +export const ghostAPI = new class { + constructor() { + this._getBaseUrl = settings.get('Article_Site_Url').replace(/\/$/, ''); + this.adminApi = '/ghost/api/v2/admin'; + this.rhooks = this.buildAPIUrl('rhooks', settings.get('Settings_Token')); + this.setupUrl = this.buildAPIUrl('authentication', 'setup'); + this.sessionUrl = this.buildAPIUrl('session'); + this.inviteUrl = this.buildAPIUrl('invitesetting'); + this.createUserAccountUrl = this.buildAPIUrl('authentication', 'adduser'); + this.userExistUrl = this.buildAPIUrl('userexist'); + this.siteUrl = `${ this._getBaseUrl }/ghost`; + this.redirectToGhostLink = { link: this.siteUrl }; + } + + buildAPIUrl(type, subtype = '') { + const dir = `/${ type }/${ subtype }`; + return this._getBaseUrl + this.adminApi + dir; + } + + authorUrl(slug) { + return `${ this._getBaseUrl }/author/${ slug }`; + } + + isSetup() { + return HTTP.call('GET', this.setupUrl); + } + + redirectToPublicLink(slug) { + return { + link: this.authorUrl(slug), + }; + } + + setupGhost(loginToken) { + const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); + const blogTitle = settings.get('Article_Site_Title'); + const announceToken = Random.secret(30); + const settingsToken = Random.secret(30); + settings.updateById('Announcement_Token', announceToken); + settings.updateById('Settings_Token', settingsToken); + const data = { + setup: [{ + rc_url: rcUrl, + rc_id: Meteor.userId(), + rc_token: loginToken, + announce_token: announceToken, + settings_token: settingsToken, + blogTitle, + }], + }; + return HTTP.call('POST', this.setupUrl, { data, headers: { 'Content-Type': 'application/json' } }); + } + + createUserAccount(loginToken) { + const { username } = Meteor.user(); + const data = { + user: [{ + rc_username: username, + role: 'Author', // User can add itself only as Author, even if he/she is admin in RC + rc_uid: Meteor.userId(), + rc_token: loginToken, + }], + }; + return HTTP.call('POST', this.createUserAccountUrl, { data, headers: { 'Content-Type': 'application/json' } }); + } + + userExistInGhost(_id) { + const data = { + user: [{ + rc_uid: _id, + }], + }; + const response = HTTP.call('GET', this.userExistUrl, { data, headers: { 'Content-Type': 'application/json' } }); + return response.data; + } + + inviteSettingInGhost() { + const response = HTTP.call('GET', this.inviteUrl); + const { settings } = response.data; + + if (settings && settings[0] && settings[0].key === 'invite_only') { + return settings[0].value; + } + // default value in Ghost + return false; + } + + executeTriggerUrl(data, tries = 0) { + if (!settings.get('Articles_Enabled')) { + return; + } + + const retryCount = 5; + + const opts = { + params: {}, + method: 'POST', + url: this.rhooks, + data, + auth: undefined, + npmRequestOptions: { + rejectUnauthorized: !settings.get('Allow_Invalid_SelfSigned_Certs'), + strictSSL: !settings.get('Allow_Invalid_SelfSigned_Certs'), + }, + headers: { + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36', + }, + }; + + if (!opts.url || !opts.method) { + return; + } + + HTTP.call(opts.method, opts.url, opts, (error, result) => { + // if the result contained nothing or wasn't a successful statusCode + if (!result) { + if (tries < retryCount) { + // 2 seconds, 4 seconds, 8 seconds + const waitTime = Math.pow(2, tries + 1) * 1000; + + Meteor.setTimeout(() => { + this.executeTriggerUrl(data, tries + 1); + }, waitTime); + } + } + }); + } + + deleteSesseion(cookie) { + const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); + HTTP.call('DELETE', this.sessionUrl, { headers: { cookie, referer: rcUrl } }); + } +}(); diff --git a/app/articles/server/utils/url.js b/app/articles/server/utils/url.js deleted file mode 100644 index 757feb2634bb..000000000000 --- a/app/articles/server/utils/url.js +++ /dev/null @@ -1,47 +0,0 @@ -import { settings } from '../../../settings'; - -export class API { - constructor() { - this.adminApi = '/ghost/api/v2/admin'; - } - - buildAPIUrl(type, subtype = '') { - const base = settings.get('Article_Site_Url').replace(/\/$/, ''); - const dir = `/${ type }/${ subtype }`; - return base + this.adminApi + dir; - } - - siteUrl() { - const base = settings.get('Article_Site_Url').replace(/\/$/, ''); - return `${ base }/ghost`; - } - - authorUrl(slug) { - const base = settings.get('Article_Site_Url').replace(/\/$/, ''); - return `${ base }/author/${ slug }`; - } - - setup() { - return this.buildAPIUrl('authentication', 'setup'); - } - - session() { - return this.buildAPIUrl('session'); - } - - rhooks(token) { - return this.buildAPIUrl('rhooks', token); - } - - invite() { - return this.buildAPIUrl('invitesetting'); - } - - createAccount() { - return this.buildAPIUrl('authentication', 'adduser'); - } - - userExist() { - return this.buildAPIUrl('userexist'); - } -} diff --git a/app/authorization/server/startup.js b/app/authorization/server/startup.js index 8d57052b66db..dfe7442ef4ef 100644 --- a/app/authorization/server/startup.js +++ b/app/authorization/server/startup.js @@ -60,6 +60,7 @@ Meteor.startup(function() { { _id: 'set-owner', roles: ['admin', 'owner'] }, { _id: 'send-many-messages', roles: ['admin', 'bot'] }, { _id: 'set-leader', roles: ['admin', 'owner'] }, + { _id: 'setup-ghost', roles: ['admin', 'owner'] }, { _id: 'unarchive-room', roles: ['admin'] }, { _id: 'view-c-room', roles: ['admin', 'user', 'bot', 'anonymous'] }, { _id: 'user-generate-access-token', roles: ['admin'] }, diff --git a/app/file-upload/client/lib/fileUploadHandler.js b/app/file-upload/client/lib/fileUploadHandler.js index fe13fdcbb965..b584a98da269 100644 --- a/app/file-upload/client/lib/fileUploadHandler.js +++ b/app/file-upload/client/lib/fileUploadHandler.js @@ -27,7 +27,12 @@ export const fileUploadHandler = (directive, meta, file) => { Tracker.autorun(function() { if (Meteor.userId()) { - document.cookie = `rc_uid=${ escape(Meteor.userId()) }; path=/`; - document.cookie = `rc_token=${ escape(Accounts._storedLoginToken()) }; path=/`; + let domain = Meteor.absoluteUrl().replace(/.*\/\//, ''); + domain = domain.replace(/:.*$/, ''); + domain = domain.replace(/\/$/, ''); + domain = `.${ domain }`; + + document.cookie = `rc_uid=${ escape(Meteor.userId()) }; domain=${ domain }; path=/`; + document.cookie = `rc_token=${ escape(Accounts._storedLoginToken()) }; domain=${ domain }; path=/`; } }); diff --git a/app/lib/server/functions/deleteUser.js b/app/lib/server/functions/deleteUser.js index 537732d1617f..9bf5b96922be 100644 --- a/app/lib/server/functions/deleteUser.js +++ b/app/lib/server/functions/deleteUser.js @@ -6,6 +6,7 @@ import { Users, Subscriptions, Messages, Rooms, Integrations, FederationPeers } import { hasRole, getUsersInRole } from '../../../authorization'; import { settings } from '../../../settings'; import { Notifications } from '../../../notifications'; +import { callbacks } from '../../../callbacks'; export const deleteUser = function(userId) { const user = Users.findOneById(userId, { @@ -97,6 +98,7 @@ export const deleteUser = function(userId) { } Users.removeById(userId); // Remove user from users database + callbacks.run('afterDeleteUser', { _id: userId }); // Refresh the peers list FederationPeers.refreshPeers(); diff --git a/app/lib/server/functions/setUserAvatar.js b/app/lib/server/functions/setUserAvatar.js index 82e1daaba497..4e7ec6201c9b 100644 --- a/app/lib/server/functions/setUserAvatar.js +++ b/app/lib/server/functions/setUserAvatar.js @@ -5,7 +5,6 @@ import { RocketChatFile } from '../../../file'; import { FileUpload } from '../../../file-upload'; import { Users } from '../../../models'; import { Notifications } from '../../../notifications'; -import { callbacks } from '../../../callbacks'; export const setUserAvatar = function(user, dataURI, contentType, service) { let encoding; @@ -64,5 +63,4 @@ export const setUserAvatar = function(user, dataURI, contentType, service) { Notifications.notifyLogged('updateAvatar', { username: user.username }); }, 500); }); - callbacks.run('afterUserAvatarChange', { _id: user._id, avatar: image }); }; diff --git a/app/ui-admin/client/admin.js b/app/ui-admin/client/admin.js index d65e6fc4cb12..2cec0620b5bc 100644 --- a/app/ui-admin/client/admin.js +++ b/app/ui-admin/client/admin.js @@ -588,8 +588,6 @@ Template.admin.events({ const redirectWindow = window.open(data.link, '_blank'); redirectWindow.location; } - const args = [data.message].concat(data.params); - toastr.success(TAPi18n.__.apply(TAPi18n, args), TAPi18n.__('Success')); }); }, 'click .button-fullscreen'() { diff --git a/app/ui-flextab/client/tabs/userActions.js b/app/ui-flextab/client/tabs/userActions.js index ab7fc9886c9d..1a4164d7ca8f 100644 --- a/app/ui-flextab/client/tabs/userActions.js +++ b/app/ui-flextab/client/tabs/userActions.js @@ -120,12 +120,11 @@ export const getActions = ({ user, directActions, hideAdminControls }) => { return handleError(error); } const redirectWindow = window.open(result.link, '_blank'); - toastr.success(result.message, 'Success'); redirectWindow.location; }) ), condition() { - return settings.get('Articles_enabled'); + return settings.get('Articles_Enabled'); }, }, diff --git a/app/ui-sidenav/client/sidebarHeader.js b/app/ui-sidenav/client/sidebarHeader.js index b0cb6fcec865..6adb187f3cbc 100644 --- a/app/ui-sidenav/client/sidebarHeader.js +++ b/app/ui-sidenav/client/sidebarHeader.js @@ -2,7 +2,6 @@ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; -import toastr from 'toastr'; import { popover, AccountBox, menu, SideNav, modal } from '../../ui-utils'; import { t, getUserPreference, handleError } from '../../utils'; @@ -221,7 +220,7 @@ const toolbarButtons = (user) => [{ { name: t('Articles'), icon: 'articles', - condition: () => settings.get('Articles_enabled'), + condition: () => settings.get('Articles_Enabled'), action: () => { const loginToken = localStorage.getItem('Meteor.loginToken'); @@ -230,7 +229,6 @@ const toolbarButtons = (user) => [{ return handleError(error); } const redirectWindow = window.open(result.link, '_blank'); - toastr.success(result.message, 'Success'); redirectWindow.location; }); }, diff --git a/client/importPackages.js b/client/importPackages.js index f9044032e831..32e492e5d21d 100644 --- a/client/importPackages.js +++ b/client/importPackages.js @@ -108,4 +108,3 @@ import '../app/ui-cached-collection'; import '../app/action-links'; import '../app/reactions/client'; import '../app/livechat/client'; -import '../app/articles/client'; diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 64bf88bd3887..4c4a374de98c 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -268,6 +268,7 @@ "And_more": "And __length__ more", "Animals_and_Nature": "Animals & Nature", "Announcement": "Announcement", + "Announcement_Token": "Announcement Token", "API": "API", "API_Add_Personal_Access_Token": "Add new Personal Access Token", "API_Allow_Infinite_Count": "Allow Getting Everything", @@ -368,6 +369,11 @@ "Are_you_sure": "Are you sure?", "Are_you_sure_you_want_to_delete_your_account": "Are you sure you want to delete your account?", "Are_you_sure_you_want_to_disable_Facebook_integration": "Are you sure you want to disable Facebook integration?", + "Articles": "Articles", + "Article_Admin_Panel": "Article Admin Panel", + "Article_Admin_Panel_Description": "Will setup and redirect to Ghost Admin Panel", + "Article_Site_Title": "Article Site Title", + "Article_Site_Url": "Article Site Url", "Assets": "Assets", "assign-admin-role": "Assign Admin Role", "assign-admin-role_description": "Permission to assign the admin role to other users", @@ -1188,8 +1194,10 @@ "Entertainment": "Entertainment", "Error": "Error", "error-action-not-allowed": "__action__ is not allowed", + "error-articles-user-suspended": "You are suspended from Ghost", "error-application-not-found": "Application not found", "error-archived-duplicate-name": "There's an archived channel with name '__room_name__'", + "error-articles-disabled": "Articles are disabled", "error-avatar-invalid-url": "Invalid avatar URL: __url__", "error-avatar-url-handling": "Error while handling avatar setting from a URL (__url__) for __username__", "error-cant-invite-for-direct-room": "Can't invite user to direct rooms", @@ -2647,6 +2655,7 @@ "Set_as_owner": "Set as owner", "Settings": "Settings", "Settings_updated": "Settings updated", + "setup-ghost": "Setup Ghost", "Setup_Wizard": "Setup Wizard", "Setup_Wizard_Info": "We'll guide you through setting up your first admin user, configuring your organisation and registering your server to receive free push notifications and more.", "Share_Location_Title": "Share Location?", @@ -2780,6 +2789,7 @@ "Stream_Cast_Address": "Stream Cast Address", "Stream_Cast_Address_Description": "IP or Host of your Rocket.Chat central Stream Cast. E.g. `192.168.1.1:3000` or `localhost:4000`", "strike": "strike", + "Settings_Token": "Settings Token", "Style": "Style", "Subject": "Subject", "Submit": "Submit", From b813060c815f7dbd15850170ac71d27632b33d95 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Fri, 26 Jul 2019 16:54:54 +0530 Subject: [PATCH 16/18] fix undefined issue in ghostAPI --- app/articles/server/methods/admin.js | 4 +-- app/articles/server/methods/user.js | 4 +-- app/articles/server/settings.js | 2 -- app/articles/server/utils/ghostAPI.js | 49 ++++++++++++++------------- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/app/articles/server/methods/admin.js b/app/articles/server/methods/admin.js index dee3a8785e21..5bcbda485497 100644 --- a/app/articles/server/methods/admin.js +++ b/app/articles/server/methods/admin.js @@ -25,7 +25,7 @@ Meteor.methods({ let response = ghostAPI.isSetup(); if (response.data.setup[0].status) { // Ghost site is already setup - return ghostAPI.redirectToGhostLink; + return ghostAPI.redirectToGhostLink(); } if (!hasPermission(Meteor.userId(), 'setup-ghost')) { @@ -40,7 +40,7 @@ Meteor.methods({ errMsg = 'Unable to setup. Make sure Ghost is running'; if (response.statusCode === 201 && response.content) { - return ghostAPI.redirectToGhostLink; + return ghostAPI.redirectToGhostLink(); } throw new Meteor.Error(errMsg); diff --git a/app/articles/server/methods/user.js b/app/articles/server/methods/user.js index 092fa4280c8e..01486b694aa2 100644 --- a/app/articles/server/methods/user.js +++ b/app/articles/server/methods/user.js @@ -28,7 +28,7 @@ Meteor.methods({ const u = ghostAPI.userExistInGhost(Meteor.userId()).users[0]; if (u.exist && u.status === 'active') { - return ghostAPI.redirectToGhostLink; + return ghostAPI.redirectToGhostLink(); } if (u.exist) { // user exist but suspended @@ -41,7 +41,7 @@ Meteor.methods({ // create user account in ghost if (!inviteOnly && ghostAPI.createUserAccount(loginToken).statusCode === 200) { - return ghostAPI.redirectToGhostLink; + return ghostAPI.redirectToGhostLink(); } errMsg = inviteOnly ? 'You are not a member of Ghost. Ask admin to add' : 'Unable to setup your account'; diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index cfa9c7d8a794..672bbe3716cb 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -32,7 +32,6 @@ Meteor.startup(() => { this.add('Announcement_Token', 'announcement_token', { type: 'string', - readonly: true, enableQuery: { _id: 'Articles_Enabled', value: true, @@ -43,7 +42,6 @@ Meteor.startup(() => { this.add('Settings_Token', 'articles_settings_token', { type: 'string', - readonly: true, enableQuery: { _id: 'Articles_Enabled', value: true, diff --git a/app/articles/server/utils/ghostAPI.js b/app/articles/server/utils/ghostAPI.js index 561341bb9a29..cd6ec5609c27 100644 --- a/app/articles/server/utils/ghostAPI.js +++ b/app/articles/server/utils/ghostAPI.js @@ -4,31 +4,28 @@ import { Random } from 'meteor/random'; import { settings } from '../../../settings'; -export const ghostAPI = new class { - constructor() { - this._getBaseUrl = settings.get('Article_Site_Url').replace(/\/$/, ''); - this.adminApi = '/ghost/api/v2/admin'; - this.rhooks = this.buildAPIUrl('rhooks', settings.get('Settings_Token')); - this.setupUrl = this.buildAPIUrl('authentication', 'setup'); - this.sessionUrl = this.buildAPIUrl('session'); - this.inviteUrl = this.buildAPIUrl('invitesetting'); - this.createUserAccountUrl = this.buildAPIUrl('authentication', 'adduser'); - this.userExistUrl = this.buildAPIUrl('userexist'); - this.siteUrl = `${ this._getBaseUrl }/ghost`; - this.redirectToGhostLink = { link: this.siteUrl }; - } +const ADMIN_API = '/ghost/api/v2/admin'; - buildAPIUrl(type, subtype = '') { - const dir = `/${ type }/${ subtype }`; - return this._getBaseUrl + this.adminApi + dir; +const _baseUrl = function() { + let url = settings.get('Article_Site_Url'); + if (url) { + url = url.replace(/\/$/, ''); } + return url; +}; + +const buildUrl = function(type, subtype = '') { + const dir = `/${ type }/${ subtype }`; + return _baseUrl() + ADMIN_API + dir; +}; +export const ghostAPI = new class { authorUrl(slug) { - return `${ this._getBaseUrl }/author/${ slug }`; + return `${ _baseUrl() }/author/${ slug }`; } isSetup() { - return HTTP.call('GET', this.setupUrl); + return HTTP.call('GET', buildUrl('authentication', 'setup')); } redirectToPublicLink(slug) { @@ -37,6 +34,10 @@ export const ghostAPI = new class { }; } + redirectToGhostLink() { + return { link: `${ _baseUrl() }/ghost` }; + } + setupGhost(loginToken) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); const blogTitle = settings.get('Article_Site_Title'); @@ -54,7 +55,7 @@ export const ghostAPI = new class { blogTitle, }], }; - return HTTP.call('POST', this.setupUrl, { data, headers: { 'Content-Type': 'application/json' } }); + return HTTP.call('POST', buildUrl('authentication', 'setup'), { data, headers: { 'Content-Type': 'application/json' } }); } createUserAccount(loginToken) { @@ -67,7 +68,7 @@ export const ghostAPI = new class { rc_token: loginToken, }], }; - return HTTP.call('POST', this.createUserAccountUrl, { data, headers: { 'Content-Type': 'application/json' } }); + return HTTP.call('POST', buildUrl('authentication', 'adduser'), { data, headers: { 'Content-Type': 'application/json' } }); } userExistInGhost(_id) { @@ -76,12 +77,12 @@ export const ghostAPI = new class { rc_uid: _id, }], }; - const response = HTTP.call('GET', this.userExistUrl, { data, headers: { 'Content-Type': 'application/json' } }); + const response = HTTP.call('GET', buildUrl('userexist'), { data, headers: { 'Content-Type': 'application/json' } }); return response.data; } inviteSettingInGhost() { - const response = HTTP.call('GET', this.inviteUrl); + const response = HTTP.call('GET', buildUrl('invitesetting')); const { settings } = response.data; if (settings && settings[0] && settings[0].key === 'invite_only') { @@ -101,7 +102,7 @@ export const ghostAPI = new class { const opts = { params: {}, method: 'POST', - url: this.rhooks, + url: buildUrl('rhooks', settings.get('Settings_Token')), data, auth: undefined, npmRequestOptions: { @@ -134,6 +135,6 @@ export const ghostAPI = new class { deleteSesseion(cookie) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); - HTTP.call('DELETE', this.sessionUrl, { headers: { cookie, referer: rcUrl } }); + HTTP.call('DELETE', buildUrl('session'), { headers: { cookie, referer: rcUrl } }); } }(); From 6b442d665994d6f7682275575ae9d8eb38979ef8 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Sat, 3 Aug 2019 16:05:27 +0530 Subject: [PATCH 17/18] remove callbacks not required after mongo integration in ghost --- app/articles/server/lib/triggerHandler.js | 46 +------------------ app/articles/server/settings.js | 10 ---- app/articles/server/triggers.js | 10 ---- app/articles/server/utils/ghostAPI.js | 2 - .../server/functions/saveRoomType.js | 2 - app/lib/server/functions/setEmail.js | 4 +- app/lib/server/functions/setRealName.js | 2 - app/lib/server/functions/setUsername.js | 2 - packages/rocketchat-i18n/i18n/en.i18n.json | 1 - 9 files changed, 2 insertions(+), 77 deletions(-) diff --git a/app/articles/server/lib/triggerHandler.js b/app/articles/server/lib/triggerHandler.js index 3a198f4312ee..0e5724e23fd2 100644 --- a/app/articles/server/lib/triggerHandler.js +++ b/app/articles/server/lib/triggerHandler.js @@ -6,23 +6,11 @@ export const triggerHandler = new class ArticlesSettingsHandler { event: args[0], }; switch (argObject.event) { - case 'userEmail': - case 'userRealname': - case 'userName': case 'deleteUser': if (args.length >= 2) { argObject.user = args[1]; } break; - case 'roomType': - case 'roomName': - if (args.length >= 2) { - argObject.room = args[1]; - } - break; - case 'siteTitle': - argObject.article = args[1]; - break; default: argObject.event = undefined; break; @@ -30,43 +18,11 @@ export const triggerHandler = new class ArticlesSettingsHandler { return argObject; } - mapEventArgsToData(data, { event, room, user, article }) { + mapEventArgsToData(data, { event, user }) { data.event = event; switch (event) { - case 'userEmail': - case 'userRealname': - case 'userName': case 'deleteUser': data.user_id = user._id; - - if (user.name) { - data.name = user.name; - } - - if (user.email) { - data.email = user.email; - } - - if (user.username) { - data.username = user.username; - } - break; - case 'roomType': - case 'roomName': - data.room_id = room.rid; - - if (room.name) { - data.name = room.name; - } - - if (room.type) { - data.type = room.type; - } - break; - case 'siteTitle': - if (article && article.title) { - data.title = article.title; - } break; default: break; diff --git a/app/articles/server/settings.js b/app/articles/server/settings.js index 672bbe3716cb..be7329f6e700 100644 --- a/app/articles/server/settings.js +++ b/app/articles/server/settings.js @@ -10,16 +10,6 @@ Meteor.startup(() => { public: true, }); - this.add('Article_Site_Title', 'Rocket.Chat', { - type: 'string', - enableQuery: { - _id: 'Articles_Enabled', - value: true, - }, - i18nLabel: 'Article_Site_Title', - public: true, - }); - this.add('Article_Site_Url', 'http://localhost:2368', { type: 'string', enableQuery: { diff --git a/app/articles/server/triggers.js b/app/articles/server/triggers.js index 045c1c292f25..d4f3fc283ebb 100644 --- a/app/articles/server/triggers.js +++ b/app/articles/server/triggers.js @@ -10,14 +10,4 @@ const callbackHandler = function _callbackHandler(eventType) { const priority = settings.get('Articles_Enabled') ? callbacks.priority.HIGH : callbacks.priority.LOW; -callbacks.add('afterUserEmailChange', callbackHandler('userEmail'), priority); -callbacks.add('afterUserRealNameChange', callbackHandler('userRealname'), priority); -callbacks.add('afterUsernameChange', callbackHandler('userName'), priority); -callbacks.add('afterRoomTypeChange', callbackHandler('roomType'), priority); callbacks.add('afterDeleteUser', callbackHandler('deleteUser'), priority); -// TODO: find why roomName have no arg passed even with High priority. -callbacks.add('afterRoomNameChange', callbackHandler('roomName'), priority); - -settings.get('Article_Site_Title', (key, value) => { - triggerHandler.executeTrigger('siteTitle', { title: value }); -}); diff --git a/app/articles/server/utils/ghostAPI.js b/app/articles/server/utils/ghostAPI.js index cd6ec5609c27..9287e0bc53af 100644 --- a/app/articles/server/utils/ghostAPI.js +++ b/app/articles/server/utils/ghostAPI.js @@ -40,7 +40,6 @@ export const ghostAPI = new class { setupGhost(loginToken) { const rcUrl = Meteor.absoluteUrl().replace(/\/$/, ''); - const blogTitle = settings.get('Article_Site_Title'); const announceToken = Random.secret(30); const settingsToken = Random.secret(30); settings.updateById('Announcement_Token', announceToken); @@ -52,7 +51,6 @@ export const ghostAPI = new class { rc_token: loginToken, announce_token: announceToken, settings_token: settingsToken, - blogTitle, }], }; return HTTP.call('POST', buildUrl('authentication', 'setup'), { data, headers: { 'Content-Type': 'application/json' } }); diff --git a/app/channel-settings/server/functions/saveRoomType.js b/app/channel-settings/server/functions/saveRoomType.js index 6831e239e9d8..9bf6cb4503ba 100644 --- a/app/channel-settings/server/functions/saveRoomType.js +++ b/app/channel-settings/server/functions/saveRoomType.js @@ -2,7 +2,6 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { TAPi18n } from 'meteor/tap:i18n'; -import { callbacks } from '../../../callbacks'; import { Rooms, Subscriptions, Messages } from '../../../models'; import { settings } from '../../../settings'; @@ -44,6 +43,5 @@ export const saveRoomType = function(rid, roomType, user, sendMessage = true) { } Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser('room_changed_privacy', rid, message, user); } - callbacks.run('afterRoomTypeChange', { rid, type: roomType }); return result; }; diff --git a/app/lib/server/functions/setEmail.js b/app/lib/server/functions/setEmail.js index 4a06a5622d3b..982194ae78e5 100644 --- a/app/lib/server/functions/setEmail.js +++ b/app/lib/server/functions/setEmail.js @@ -4,7 +4,6 @@ import s from 'underscore.string'; import { Users } from '../../../models'; import { hasPermission } from '../../../authorization'; import { RateLimiter, validateEmailDomain } from '../lib'; -import { callbacks } from '../../../callbacks'; import { checkEmailAvailability } from '.'; @@ -22,7 +21,7 @@ const _setEmail = function(userId, email, shouldSendVerificationEmail = true) { const user = Users.findOneById(userId); - // User already has desired email, return + // User already has desired username, return if (user.emails && user.emails[0] && user.emails[0].address === email) { return user; } @@ -38,7 +37,6 @@ const _setEmail = function(userId, email, shouldSendVerificationEmail = true) { if (shouldSendVerificationEmail === true) { Meteor.call('sendConfirmationEmail', user.email); } - callbacks.run('afterUserEmailChange', { _id: user._id, email }); return user; }; diff --git a/app/lib/server/functions/setRealName.js b/app/lib/server/functions/setRealName.js index 23efbc52f085..40262fd612bf 100644 --- a/app/lib/server/functions/setRealName.js +++ b/app/lib/server/functions/setRealName.js @@ -6,7 +6,6 @@ import { settings } from '../../../settings'; import { Notifications } from '../../../notifications'; import { hasPermission } from '../../../authorization'; import { RateLimiter } from '../lib'; -import { callbacks } from '../../../callbacks'; export const _setRealName = function(userId, name) { name = s.trim(name); @@ -42,7 +41,6 @@ export const _setRealName = function(userId, name) { username: user.username, }); } - callbacks.run('afterUserRealNameChange', { _id: user._id, name }); return user; }; diff --git a/app/lib/server/functions/setUsername.js b/app/lib/server/functions/setUsername.js index cf2e0a2a1be4..baed79351cf8 100644 --- a/app/lib/server/functions/setUsername.js +++ b/app/lib/server/functions/setUsername.js @@ -8,7 +8,6 @@ import { Users, Messages, Subscriptions, Rooms, LivechatDepartmentAgents } from import { hasPermission } from '../../../authorization'; import { RateLimiter } from '../lib'; import { Notifications } from '../../../notifications/server'; -import { callbacks } from '../../../callbacks'; import { checkUsernameAvailability, setUserAvatar, getAvatarSuggestionForUser } from '.'; @@ -93,7 +92,6 @@ export const _setUsername = function(userId, u) { name: user.name, username: user.username, }); - callbacks.run('afterUsernameChange', { _id: user._id, username }); return user; }; diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 4c4a374de98c..8117d0d3c002 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -372,7 +372,6 @@ "Articles": "Articles", "Article_Admin_Panel": "Article Admin Panel", "Article_Admin_Panel_Description": "Will setup and redirect to Ghost Admin Panel", - "Article_Site_Title": "Article Site Title", "Article_Site_Url": "Article Site Url", "Assets": "Assets", "assign-admin-role": "Assign Admin Role", From 54f9d45c5100fe35c126027505e719e66a666697 Mon Sep 17 00:00:00 2001 From: shubhsherl Date: Sat, 24 Aug 2019 19:25:20 +0530 Subject: [PATCH 18/18] remove getUser over token endpoint --- app/articles/server/api/api.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/app/articles/server/api/api.js b/app/articles/server/api/api.js index 9f6de329926b..c6edba5640bd 100644 --- a/app/articles/server/api/api.js +++ b/app/articles/server/api/api.js @@ -44,7 +44,7 @@ const Api = new Restivus({ }; } - const user = this.bodyParams.userId ? Models.Users.findOne({ _id: this.bodyParams.userId }) : Models.Users.findOne({ username: this.bodyParams.username }); + const user = Models.Users.findOne({ _id: this.bodyParams.userId }); return { user }; }, @@ -78,26 +78,7 @@ function executeAnnouncementRest() { } } -function executefetchUserRest() { - try { - const { _id, name, username, emails } = this.user; - const user = { _id, name, username, emails }; - - return API.v1.success({ user }); - } catch ({ error, message }) { - return API.v1.failure(error || message); - } -} - Api.addRoute(':token', { authRequired: true }, { post: executeAnnouncementRest, get: executeAnnouncementRest, }); - -// If a user is editor/admin in Ghost but is not an admin in RC, -// then the e-mail will not be provided to that user -// This method will allow user to fetch user with email. -Api.addRoute(':token/getUser', { authRequired: true }, { - post: executefetchUserRest, - get: executefetchUserRest, -});