ghost 4.33.0 → 4.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,7 +148,11 @@ module.exports = {
148
148
  }
149
149
  })();
150
150
 
151
- await stripeService.migrations.execute();
151
+ try {
152
+ await stripeService.migrations.execute();
153
+ } catch (err) {
154
+ logging.error(err);
155
+ }
152
156
  },
153
157
  contentGating: require('./content-gating'),
154
158
 
@@ -1,53 +1 @@
1
- const _ = require('lodash');
2
- const StripeService = require('@tryghost/members-stripe-service');
3
- const membersService = require('../members');
4
- const config = require('../../../shared/config');
5
- const settings = require('../../../shared/settings-cache');
6
- const urlUtils = require('../../../shared/url-utils');
7
- const events = require('../../lib/common/events');
8
- const models = require('../../models');
9
- const {getConfig} = require('./config');
10
-
11
- function configureApi() {
12
- const cfg = getConfig(settings, config, urlUtils);
13
- if (cfg) {
14
- module.exports.configure(cfg);
15
- return true;
16
- }
17
- return false;
18
- }
19
-
20
- const debouncedConfigureApi = _.debounce(() => {
21
- configureApi();
22
- }, 600);
23
-
24
- module.exports = new StripeService({
25
- membersService,
26
- models: _.pick(models, ['Product', 'StripePrice', 'StripeCustomerSubscription', 'StripeProduct', 'MemberStripeCustomer', 'Offer', 'Settings']),
27
- StripeWebhook: {
28
- async get() {
29
- return {
30
- webhook_id: settings.get('members_stripe_webhook_id'),
31
- secret: settings.get('members_stripe_webhook_secret')
32
- };
33
- },
34
- async save(data) {
35
- await models.Settings.edit([{
36
- key: 'members_stripe_webhook_id',
37
- value: data.webhook_id
38
- }, {
39
- key: 'members_stripe_webhook_secret',
40
- value: data.secret
41
- }]);
42
- }
43
- }
44
- });
45
-
46
- module.exports.init = async function init() {
47
- configureApi();
48
- events.on('settings.edited', function (model) {
49
- if (['stripe_publishable_key', 'stripe_secret_key', 'stripe_connect_publishable_key', 'stripe_connect_secret_key'].includes(model.get('key'))) {
50
- debouncedConfigureApi();
51
- }
52
- });
53
- };
1
+ module.exports = require('./service');
@@ -0,0 +1,58 @@
1
+ const _ = require('lodash');
2
+ const StripeService = require('@tryghost/members-stripe-service');
3
+ const logging = require('@tryghost/logging');
4
+ const membersService = require('../members');
5
+ const config = require('../../../shared/config');
6
+ const settings = require('../../../shared/settings-cache');
7
+ const urlUtils = require('../../../shared/url-utils');
8
+ const events = require('../../lib/common/events');
9
+ const models = require('../../models');
10
+ const {getConfig} = require('./config');
11
+
12
+ async function configureApi() {
13
+ const cfg = getConfig(settings, config, urlUtils);
14
+ if (cfg) {
15
+ await module.exports.configure(cfg);
16
+ return true;
17
+ }
18
+ return false;
19
+ }
20
+
21
+ const debouncedConfigureApi = _.debounce(() => {
22
+ configureApi();
23
+ }, 600);
24
+
25
+ module.exports = new StripeService({
26
+ membersService,
27
+ models: _.pick(models, ['Product', 'StripePrice', 'StripeCustomerSubscription', 'StripeProduct', 'MemberStripeCustomer', 'Offer', 'Settings']),
28
+ StripeWebhook: {
29
+ async get() {
30
+ return {
31
+ webhook_id: settings.get('members_stripe_webhook_id'),
32
+ secret: settings.get('members_stripe_webhook_secret')
33
+ };
34
+ },
35
+ async save(data) {
36
+ await models.Settings.edit([{
37
+ key: 'members_stripe_webhook_id',
38
+ value: data.webhook_id
39
+ }, {
40
+ key: 'members_stripe_webhook_secret',
41
+ value: data.secret
42
+ }]);
43
+ }
44
+ }
45
+ });
46
+
47
+ module.exports.init = async function init() {
48
+ try {
49
+ await configureApi();
50
+ } catch (err) {
51
+ logging.error(err);
52
+ }
53
+ events.on('settings.edited', function (model) {
54
+ if (['stripe_publishable_key', 'stripe_secret_key', 'stripe_connect_publishable_key', 'stripe_connect_secret_key'].includes(model.get('key'))) {
55
+ debouncedConfigureApi();
56
+ }
57
+ });
58
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghost",
3
- "version": "4.33.0",
3
+ "version": "4.33.1",
4
4
  "description": "The professional publishing platform",
5
5
  "author": "Ghost Foundation",
6
6
  "homepage": "https://ghost.org",
@@ -79,13 +79,13 @@
79
79
  "@tryghost/kg-mobiledoc-html-renderer": "5.3.2",
80
80
  "@tryghost/limit-service": "1.0.9",
81
81
  "@tryghost/logging": "2.0.1",
82
- "@tryghost/magic-link": "1.0.15",
82
+ "@tryghost/magic-link": "1.0.17",
83
83
  "@tryghost/members-api": "4.4.1",
84
84
  "@tryghost/members-csv": "1.2.3",
85
85
  "@tryghost/members-importer": "0.4.1",
86
86
  "@tryghost/members-offers": "0.10.5",
87
87
  "@tryghost/members-ssr": "1.0.18",
88
- "@tryghost/members-stripe-service": "0.6.3",
88
+ "@tryghost/members-stripe-service": "0.6.4",
89
89
  "@tryghost/metrics": "1.0.2",
90
90
  "@tryghost/minifier": "0.1.10",
91
91
  "@tryghost/mw-error-handler": "0.1.2",
package/yarn.lock CHANGED
@@ -1412,10 +1412,10 @@
1412
1412
  json-stringify-safe "^5.0.1"
1413
1413
  lodash "^4.17.21"
1414
1414
 
1415
- "@tryghost/magic-link@1.0.15":
1416
- version "1.0.15"
1417
- resolved "https://registry.yarnpkg.com/@tryghost/magic-link/-/magic-link-1.0.15.tgz#61aac2990f65decd6bc18aa4699181cb12388fce"
1418
- integrity sha512-df0owOkpR2SAx48NTVJLmfDMY9fnSpZ0c8nRaU/JIiAm++pKLveyl4Djas2l8up6PA1dkS1ND8VktIf7Ug4SVA==
1415
+ "@tryghost/magic-link@1.0.17":
1416
+ version "1.0.17"
1417
+ resolved "https://registry.yarnpkg.com/@tryghost/magic-link/-/magic-link-1.0.17.tgz#149fc93ba63a0ea89b22b90b01a3bcc28a71e636"
1418
+ integrity sha512-stsUKEyTygacONVW5f9uqjIUVYLiJi9AbTmLb9sgNj4sVKgcFw7wMokoKQe2ezsQdwjQx8cvpTZhyKL5Qo3BaQ==
1419
1419
  dependencies:
1420
1420
  bluebird "^3.5.5"
1421
1421
  jsonwebtoken "^8.5.1"
@@ -1531,7 +1531,17 @@
1531
1531
  jsonwebtoken "^8.5.1"
1532
1532
  lodash "^4.17.11"
1533
1533
 
1534
- "@tryghost/members-stripe-service@0.6.3", "@tryghost/members-stripe-service@^0.6.3":
1534
+ "@tryghost/members-stripe-service@0.6.4":
1535
+ version "0.6.4"
1536
+ resolved "https://registry.yarnpkg.com/@tryghost/members-stripe-service/-/members-stripe-service-0.6.4.tgz#8946e1eb8becaccb0c1dc3a7d26a6931802d2023"
1537
+ integrity sha512-twxt5r/yqSGFO48cV6RtMyTngd+HvBBr97/Psbjy5TnyYZo6D1AXetocHscOMqbWkpu3CSTBZgJx0VqywKLYKQ==
1538
+ dependencies:
1539
+ "@tryghost/debug" "^0.1.4"
1540
+ "@tryghost/errors" "1.2.0"
1541
+ leaky-bucket "^2.2.0"
1542
+ stripe "^8.174.0"
1543
+
1544
+ "@tryghost/members-stripe-service@^0.6.3":
1535
1545
  version "0.6.3"
1536
1546
  resolved "https://registry.yarnpkg.com/@tryghost/members-stripe-service/-/members-stripe-service-0.6.3.tgz#c6c54a8d38036ce76334d3297fcc85d72baca5f9"
1537
1547
  integrity sha512-4a8d+x8HmMVE45hhbQ6NNcMFJXUfIM+uhUrGLN1lg6K02hr7CVl2y25cqbG7dN9ZOHuiUEJy/P0hqrdZJz12lA==