ghost 5.129.1 → 5.129.2
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.
- package/components/tryghost-i18n-5.129.2.tgz +0 -0
- package/core/boot.js +6 -5
- package/core/built/admin/assets/admin-x-activitypub/admin-x-activitypub.js +2 -2
- package/core/built/admin/assets/admin-x-activitypub/{index-CWqPqbZ6.mjs → index-B12913rO.mjs} +2 -2
- package/core/built/admin/assets/admin-x-activitypub/{index-t8sCkPyJ.mjs → index-B7EmcyVj.mjs} +1809 -1786
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-FMecMk4J.mjs → CodeEditorView-l2Ex2555.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-CqcRQSMi.mjs → index-C6P_16OJ.mjs} +512 -490
- package/core/built/admin/assets/admin-x-settings/{index-DjbkRFc2.mjs → index-DoLRADbr.mjs} +14974 -11468
- package/core/built/admin/assets/admin-x-settings/{modals-CfWblo-N.mjs → modals-CY1xx4Em.mjs} +7580 -7572
- package/core/built/admin/assets/{chunk.524.5330e1e5569947d7b7f2.js → chunk.524.c8313bccd308920abf9c.js} +7 -7
- package/core/built/admin/assets/{chunk.582.f6a6d1826e91aafd496b.js → chunk.582.e4feab981886cfc91835.js} +10 -10
- package/core/built/admin/assets/{chunk.383.09219fde42568dd42ed5.js → chunk.728.214803966b81ffdb1acd.js} +6957 -6441
- package/core/built/admin/assets/ghost-3d0ad0c58f433d5735532bf25d4fd423.css +1 -0
- package/core/built/admin/assets/ghost-dark-f19869a3fd0ef48c525149b9c87e4241.css +1 -0
- package/core/built/admin/assets/{ghost-1bce1a4ebfdfc6f6f333a827f40f69a6.js → ghost-db9fcb8c1f65776f3ee11c39f19a660b.js} +118 -122
- package/core/built/admin/assets/posts/posts.js +6655 -6647
- package/core/built/admin/assets/stats/stats.js +9454 -9446
- package/core/built/admin/index.html +5 -5
- package/core/frontend/helpers/ghost_head.js +3 -4
- package/core/frontend/meta/get-meta.js +1 -1
- package/core/frontend/meta/schema.js +26 -24
- package/core/frontend/services/proxy.js +6 -0
- package/core/server/data/tinybird/ARCHITECTURE.md +420 -0
- package/core/server/data/tinybird/README.md +84 -0
- package/core/server/data/tinybird/scripts/configure-ghost.sh +65 -0
- package/core/server/services/activitypub/ActivityPubService.js +2 -2
- package/core/server/services/activitypub/ActivityPubService.ts +2 -2
- package/core/server/services/activitypub/ActivityPubServiceWrapper.js +11 -5
- package/core/server/services/email-service/EmailRenderer.js +11 -0
- package/core/server/services/email-service/email-templates/partials/styles.hbs +19 -0
- package/core/server/services/members/members-api/repositories/MemberRepository.js +1 -4
- package/core/server/services/settings/settings-service.js +4 -0
- package/core/server/services/settings-helpers/SettingsHelpers.js +114 -7
- package/core/server/services/settings-helpers/index.js +2 -1
- package/core/server/services/stats/StatsService.js +1 -2
- package/core/shared/labs.js +0 -1
- package/core/shared/settings-cache/CacheManager.js +2 -0
- package/package.json +15 -15
- package/tsconfig.tsbuildinfo +1 -1
- package/yarn.lock +175 -149
- package/components/tryghost-i18n-5.129.1.tgz +0 -0
- package/core/built/admin/assets/ghost-415f8e3c36dbe0e09f87608628da382d.css +0 -1
- package/core/built/admin/assets/ghost-dark-2043bca95512f1fa2ff0bea2f8a632b0.css +0 -1
- package/core/server/data/tinybird/readme.md +0 -40
- /package/core/built/admin/assets/{chunk.383.09219fde42568dd42ed5.js.LICENSE.txt → chunk.728.214803966b81ffdb1acd.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# This script is used to get important values from the Tinybird Local container, and setup Ghost's config
|
|
5
|
+
## It is used in the e2e test CI workflow to configure Ghost to use the Tinybird local instance
|
|
6
|
+
## It can also be used locally to configure Ghost to use a tinybird local instance
|
|
7
|
+
|
|
8
|
+
# Store tb info output as JSON to parse multiple values
|
|
9
|
+
## This includes the workspace ID and a workspace token we can use to authenticate with the Tinybird API
|
|
10
|
+
TB_INFO=$(tb --output json info)
|
|
11
|
+
|
|
12
|
+
# Get the workspace ID from the JSON output
|
|
13
|
+
WORKSPACE_ID=$(echo "$TB_INFO" | jq -r '.local.workspace_id')
|
|
14
|
+
|
|
15
|
+
# Check if workspace ID is valid
|
|
16
|
+
if [ -z "$WORKSPACE_ID" ] || [ "$WORKSPACE_ID" = "null" ]; then
|
|
17
|
+
echo "Error: Failed to get workspace ID from Tinybird. Please ensure Tinybird is running and initialized." >&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
export TINYBIRD_WORKSPACE_ID="$WORKSPACE_ID"
|
|
22
|
+
|
|
23
|
+
WORKSPACE_TOKEN=$(echo "$TB_INFO" | jq -r '.local.token')
|
|
24
|
+
|
|
25
|
+
# Check if workspace token is valid
|
|
26
|
+
if [ -z "$WORKSPACE_TOKEN" ] || [ "$WORKSPACE_TOKEN" = "null" ]; then
|
|
27
|
+
echo "Error: Failed to get workspace token from Tinybird. Please ensure Tinybird is running and initialized." >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Get the admin token from the Tinybird API
|
|
32
|
+
## This is different from the workspace admin token
|
|
33
|
+
ADMIN_TOKEN=$(curl -s -H "Authorization: Bearer $WORKSPACE_TOKEN" http://localhost:7181/v0/tokens | jq -r '.tokens[] | select(.name == "admin token") | .token')
|
|
34
|
+
|
|
35
|
+
# Check if admin token is valid
|
|
36
|
+
if [ -z "$ADMIN_TOKEN" ] || [ "$ADMIN_TOKEN" = "null" ]; then
|
|
37
|
+
echo "Error: Failed to get admin token from Tinybird API. Please ensure Tinybird is properly configured." >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
export TINYBIRD_ADMIN_TOKEN="$ADMIN_TOKEN"
|
|
42
|
+
|
|
43
|
+
# Get the tracker token from the Tinybird API
|
|
44
|
+
TRACKER_TOKEN=$(curl -s -H "Authorization: Bearer $WORKSPACE_TOKEN" http://localhost:7181/v0/tokens | jq -r '.tokens[] | select(.name == "tracker") | .token')
|
|
45
|
+
|
|
46
|
+
# Check if tracker token is valid
|
|
47
|
+
if [ -z "$TRACKER_TOKEN" ] || [ "$TRACKER_TOKEN" = "null" ]; then
|
|
48
|
+
echo "Error: Failed to get tracker token from Tinybird API. Please ensure Tinybird is properly configured." >&2
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
export TINYBIRD_TRACKER_TOKEN="$TRACKER_TOKEN"
|
|
53
|
+
|
|
54
|
+
# Export Ghost configuration as environment variables
|
|
55
|
+
export tinybird__adminToken="$TINYBIRD_ADMIN_TOKEN"
|
|
56
|
+
export tinybird__workspaceId="$TINYBIRD_WORKSPACE_ID"
|
|
57
|
+
export tinybird__stats__endpoint="http://localhost:7181"
|
|
58
|
+
|
|
59
|
+
# If running in GitHub Actions, also export to GITHUB_ENV
|
|
60
|
+
if [ -n "$GITHUB_ENV" ]; then
|
|
61
|
+
echo "tinybird__adminToken=$TINYBIRD_ADMIN_TOKEN" >> $GITHUB_ENV
|
|
62
|
+
echo "tinybird__workspaceId=$TINYBIRD_WORKSPACE_ID" >> $GITHUB_ENV
|
|
63
|
+
echo "tinybird__stats__endpoint=http://localhost:7181" >> $GITHUB_ENV
|
|
64
|
+
echo "TINYBIRD_TRACKER_TOKEN=$TINYBIRD_TRACKER_TOKEN" >> $GITHUB_ENV
|
|
65
|
+
fi
|
|
@@ -20,7 +20,7 @@ class ActivityPubService {
|
|
|
20
20
|
getExpectedWebhooks(secret) {
|
|
21
21
|
return [{
|
|
22
22
|
event: 'post.published',
|
|
23
|
-
target_url: new URL('.ghost/activitypub/webhooks/post/published', this.siteUrl),
|
|
23
|
+
target_url: new URL('.ghost/activitypub/v1/webhooks/post/published', this.siteUrl),
|
|
24
24
|
api_version: 'v5.100.0',
|
|
25
25
|
secret
|
|
26
26
|
}];
|
|
@@ -55,7 +55,7 @@ class ActivityPubService {
|
|
|
55
55
|
.where('roles.name', 'Owner')
|
|
56
56
|
.first();
|
|
57
57
|
const token = await this.identityTokenService.getTokenForUser(ownerUser.email, 'Owner');
|
|
58
|
-
const res = await (0, node_fetch_1.default)(new URL('.ghost/activitypub/site', this.siteUrl), {
|
|
58
|
+
const res = await (0, node_fetch_1.default)(new URL('.ghost/activitypub/v1/site', this.siteUrl), {
|
|
59
59
|
headers: {
|
|
60
60
|
Authorization: `Bearer ${token}`
|
|
61
61
|
}
|
|
@@ -27,7 +27,7 @@ export class ActivityPubService {
|
|
|
27
27
|
getExpectedWebhooks(secret: string): ExpectedWebhook[] {
|
|
28
28
|
return [{
|
|
29
29
|
event: 'post.published',
|
|
30
|
-
target_url: new URL('.ghost/activitypub/webhooks/post/published', this.siteUrl),
|
|
30
|
+
target_url: new URL('.ghost/activitypub/v1/webhooks/post/published', this.siteUrl),
|
|
31
31
|
api_version: 'v5.100.0',
|
|
32
32
|
secret
|
|
33
33
|
}];
|
|
@@ -69,7 +69,7 @@ export class ActivityPubService {
|
|
|
69
69
|
.first();
|
|
70
70
|
const token = await this.identityTokenService.getTokenForUser(ownerUser.email, 'Owner');
|
|
71
71
|
|
|
72
|
-
const res = await fetch(new URL('.ghost/activitypub/site', this.siteUrl), {
|
|
72
|
+
const res = await fetch(new URL('.ghost/activitypub/v1/site', this.siteUrl), {
|
|
73
73
|
headers: {
|
|
74
74
|
Authorization: `Bearer ${token}`
|
|
75
75
|
}
|
|
@@ -32,16 +32,22 @@ module.exports = class ActivityPubServiceWrapper {
|
|
|
32
32
|
IdentityTokenServiceWrapper.instance
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const initActivityPubService = async () => {
|
|
36
36
|
await ActivityPubServiceWrapper.instance.initialiseWebhooks();
|
|
37
37
|
ActivityPubServiceWrapper.initialised = true;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (settingsCache.get('social_web_enabled')) {
|
|
41
|
+
await initActivityPubService();
|
|
38
42
|
} else {
|
|
39
|
-
|
|
43
|
+
const initActivityPubServiceLater = async () => {
|
|
40
44
|
if (settingsCache.get('social_web_enabled') && !ActivityPubServiceWrapper.initialised) {
|
|
41
|
-
await
|
|
42
|
-
ActivityPubServiceWrapper.initialised = true;
|
|
45
|
+
await initActivityPubService();
|
|
43
46
|
}
|
|
44
|
-
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
events.on('settings.labs.edited', initActivityPubServiceLater);
|
|
50
|
+
events.on('settings.social_web.edited', initActivityPubServiceLater);
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
};
|
|
@@ -1301,6 +1301,17 @@ class EmailRenderer {
|
|
|
1301
1301
|
linkStyle,
|
|
1302
1302
|
hasOutlineButtons,
|
|
1303
1303
|
|
|
1304
|
+
// useful data
|
|
1305
|
+
ctaBgColors: [
|
|
1306
|
+
'grey',
|
|
1307
|
+
'blue',
|
|
1308
|
+
'green',
|
|
1309
|
+
'yellow',
|
|
1310
|
+
'red',
|
|
1311
|
+
'pink',
|
|
1312
|
+
'purple'
|
|
1313
|
+
],
|
|
1314
|
+
|
|
1304
1315
|
classes: {
|
|
1305
1316
|
container: clsx('container', {
|
|
1306
1317
|
'title-serif': titleFont === 'serif'
|
|
@@ -381,6 +381,17 @@ h6 + .kg-paywall .kg-paywall-hr td {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
/* Exclude CTA cards with colored backgrounds from custom text color, but allow transparent ones */
|
|
384
|
+
{{#hasFeature "emailCustomization"}}
|
|
385
|
+
{{#each ctaBgColors}}
|
|
386
|
+
.post-content-row .kg-cta-bg-{{this}} .kg-cta-text p,
|
|
387
|
+
.post-content-row .kg-cta-bg-{{this}} .kg-cta-text ul,
|
|
388
|
+
.post-content-row .kg-cta-bg-{{this}} .kg-cta-text ul li,
|
|
389
|
+
.post-content-row .kg-cta-bg-{{this}} .kg-cta-text ol,
|
|
390
|
+
.post-content-row .kg-cta-bg-{{this}} .kg-cta-text ol li {
|
|
391
|
+
color: inherit !important;
|
|
392
|
+
}
|
|
393
|
+
{{/each}}
|
|
394
|
+
{{else}}
|
|
384
395
|
.post-content-row .kg-cta-bg-grey .kg-cta-text p,
|
|
385
396
|
.post-content-row .kg-cta-bg-blue .kg-cta-text p,
|
|
386
397
|
.post-content-row .kg-cta-bg-green .kg-cta-text p,
|
|
@@ -390,6 +401,7 @@ h6 + .kg-paywall .kg-paywall-hr td {
|
|
|
390
401
|
.post-content-row .kg-cta-bg-purple .kg-cta-text p {
|
|
391
402
|
color: inherit !important;
|
|
392
403
|
}
|
|
404
|
+
{{/hasFeature}}
|
|
393
405
|
|
|
394
406
|
.kg-cta-bg-none .kg-cta-sponsor-label span,
|
|
395
407
|
.kg-cta-bg-white .kg-cta-sponsor-label span {
|
|
@@ -2530,3 +2542,10 @@ table.btn-accent a {
|
|
|
2530
2542
|
{{/if}}
|
|
2531
2543
|
|
|
2532
2544
|
</style>
|
|
2545
|
+
{{#hasFeature "emailCustomization"}}
|
|
2546
|
+
<!--[if mso]>
|
|
2547
|
+
<style type="text/css">
|
|
2548
|
+
ul, ol { margin-left: 1.5em !important; } {{!-- fix bullets/numbers not appearing for lists in older Outlook versions --}}
|
|
2549
|
+
</style>
|
|
2550
|
+
<![endif]-->
|
|
2551
|
+
{{/hasFeature}}
|
|
@@ -947,10 +947,7 @@ module.exports = class MemberRepository {
|
|
|
947
947
|
ghostProduct = await this._productRepository.get({stripe_product_id: subscriptionPriceData.product}, options);
|
|
948
948
|
// Use first Ghost product as default product in case of missing link
|
|
949
949
|
if (!ghostProduct) {
|
|
950
|
-
ghostProduct = await this._productRepository.getDefaultProduct(
|
|
951
|
-
forUpdate: true,
|
|
952
|
-
...options
|
|
953
|
-
});
|
|
950
|
+
ghostProduct = await this._productRepository.getDefaultProduct(options);
|
|
954
951
|
}
|
|
955
952
|
|
|
956
953
|
// Link Stripe Product & Price to Ghost Product
|
|
@@ -109,6 +109,10 @@ module.exports = {
|
|
|
109
109
|
// Social web (ActivityPub)
|
|
110
110
|
fields.push(new CalculatedField({key: 'social_web_enabled', type: 'boolean', group: 'social_web', fn: settingsHelpers.isSocialWebEnabled.bind(settingsHelpers), dependents: ['social_web', 'labs']}));
|
|
111
111
|
|
|
112
|
+
// Web analytics
|
|
113
|
+
fields.push(new CalculatedField({key: 'web_analytics_enabled', type: 'boolean', group: 'analytics', fn: settingsHelpers.isWebAnalyticsEnabled.bind(settingsHelpers), dependents: ['web_analytics', 'labs']}));
|
|
114
|
+
fields.push(new CalculatedField({key: 'web_analytics_configured', type: 'boolean', group: 'analytics', fn: settingsHelpers.isWebAnalyticsConfigured.bind(settingsHelpers), dependents: ['web_analytics']}));
|
|
115
|
+
|
|
112
116
|
return fields;
|
|
113
117
|
},
|
|
114
118
|
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
const net = require('net');
|
|
1
2
|
const tpl = require('@tryghost/tpl');
|
|
2
3
|
const errors = require('@tryghost/errors');
|
|
3
4
|
const EmailAddressParser = require('../email-address/EmailAddressParser');
|
|
4
5
|
const logging = require('@tryghost/logging');
|
|
5
6
|
const crypto = require('crypto');
|
|
7
|
+
const debug = require('@tryghost/debug')('services:settings-helpers');
|
|
6
8
|
|
|
7
9
|
const messages = {
|
|
8
10
|
incorrectKeyType: 'type must be one of "direct" or "connect".'
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
class SettingsHelpers {
|
|
12
|
-
constructor({settingsCache, urlUtils, config, labs}) {
|
|
14
|
+
constructor({settingsCache, urlUtils, config, labs, limitService}) {
|
|
13
15
|
this.settingsCache = settingsCache;
|
|
14
16
|
this.urlUtils = urlUtils;
|
|
15
17
|
this.config = config;
|
|
16
18
|
this.labs = labs;
|
|
19
|
+
this.limitService = limitService;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
isMembersEnabled() {
|
|
@@ -220,20 +223,124 @@ class SettingsHelpers {
|
|
|
220
223
|
}
|
|
221
224
|
|
|
222
225
|
/**
|
|
223
|
-
* Social web (ActivityPub)
|
|
224
|
-
* - Social web is enabled in the settings
|
|
225
|
-
* - 'ActivityPub' flag is enabled in the labs, for compatibility with Ghost 5.x
|
|
226
|
-
* - Config allows it (TODO)
|
|
227
|
-
* - Billing allows it (TODO)
|
|
226
|
+
* Calculated setting for Social web (ActivityPub)
|
|
228
227
|
*
|
|
229
228
|
* @returns {boolean}
|
|
230
229
|
*/
|
|
231
230
|
isSocialWebEnabled() {
|
|
232
|
-
|
|
231
|
+
// UI setting
|
|
232
|
+
if (this.settingsCache.get('social_web') !== true) {
|
|
233
|
+
debug('Social web is disabled in settings');
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Labs setting
|
|
238
|
+
if (!this.labs.isSet('ActivityPub')) {
|
|
239
|
+
debug('Social web is disabled in labs');
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Ghost (Pro) limits
|
|
244
|
+
if (this.limitService.isDisabled('limitSocialWeb')) {
|
|
245
|
+
debug('Social web is not available for Ghost (Pro) sites without a custom domain, or hosted on a subdirectory');
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Social web (ActivityPub) currently does not support Ghost sites hosted on a subdirectory, e.g. https://example.com/blog/
|
|
250
|
+
const subdirectory = this.urlUtils.getSubdir();
|
|
251
|
+
if (subdirectory) {
|
|
252
|
+
debug('Social web is not available for Ghost sites hosted on a subdirectory');
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Self-hosters cannot connect to production ActivityPub servers from localhost or IPs addresses
|
|
257
|
+
const siteUrl = new URL(this.urlUtils.getSiteUrl());
|
|
258
|
+
const isLocalhost = siteUrl.hostname === 'localhost' || siteUrl.hostname === '127.0.0.1' || siteUrl.hostname === '::1';
|
|
259
|
+
const isIP = net.isIP(siteUrl.hostname);
|
|
260
|
+
if (process.env.NODE_ENV === 'production' && (isLocalhost || isIP)) {
|
|
261
|
+
debug('Social web is not available from localhost or IPs addresses in production');
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Calculated setting for Web analytics
|
|
270
|
+
*
|
|
271
|
+
* Setting > Labs Flag > Config > Limit Service
|
|
272
|
+
*
|
|
273
|
+
* @returns {boolean}
|
|
274
|
+
*/
|
|
275
|
+
isWebAnalyticsEnabled() {
|
|
276
|
+
// UI setting
|
|
277
|
+
if (this.settingsCache.get('web_analytics') !== true) {
|
|
278
|
+
debug('Web analytics is disabled in settings');
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Labs setting
|
|
283
|
+
if (!this.labs.isSet('trafficAnalytics')) {
|
|
284
|
+
debug('Web analytics is disabled in labs');
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Check if web analytics can be configured (limit service and required config)
|
|
289
|
+
if (!this.isWebAnalyticsConfigured()) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Check if web analytics can be configured (used for UI enable/disable state)
|
|
298
|
+
*
|
|
299
|
+
* @returns {boolean}
|
|
300
|
+
*/
|
|
301
|
+
isWebAnalyticsConfigured() {
|
|
302
|
+
// Correct config is required
|
|
303
|
+
if (!this._isValidTinybirdConfig()) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Ghost (Pro) limits
|
|
308
|
+
if (this.limitService.isDisabled('limitAnalytics')) {
|
|
309
|
+
debug('Web analytics configuration is not available for Ghost (Pro) sites without a custom domain, or hosted on a subdirectory');
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return true;
|
|
233
314
|
}
|
|
234
315
|
|
|
235
316
|
// PRIVATE
|
|
236
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Validates tinybird configuration for web analytics
|
|
320
|
+
* @returns {boolean} True if config is valid, false otherwise
|
|
321
|
+
* @private
|
|
322
|
+
*/
|
|
323
|
+
_isValidTinybirdConfig() {
|
|
324
|
+
const tinybirdConfig = this.config.get('tinybird');
|
|
325
|
+
|
|
326
|
+
// First requirement: tinybird:tracker:endpoint is always required
|
|
327
|
+
if (!tinybirdConfig || !tinybirdConfig.tracker?.endpoint) {
|
|
328
|
+
debug('Web analytics is not available without tinybird:tracker:endpoint');
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Second requirement: Either JWT config OR local stats config
|
|
333
|
+
const hasJwtConfig = !!(tinybirdConfig.workspaceId && tinybirdConfig.adminToken);
|
|
334
|
+
const hasLocalConfig = !!(tinybirdConfig.stats?.local?.enabled);
|
|
335
|
+
|
|
336
|
+
if (!hasJwtConfig && !hasLocalConfig) {
|
|
337
|
+
debug('Web analytics requires either (workspaceId + adminToken) or stats.local.enabled');
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
|
|
237
344
|
#managedEmailEnabled() {
|
|
238
345
|
return !!this.config.get('hostSettings:managedEmail:enabled');
|
|
239
346
|
}
|
|
@@ -3,5 +3,6 @@ const urlUtils = require('../../../shared/url-utils');
|
|
|
3
3
|
const config = require('../../../shared/config');
|
|
4
4
|
const SettingsHelpers = require('./SettingsHelpers');
|
|
5
5
|
const labs = require('../../../shared/labs');
|
|
6
|
+
const limitService = require('../limits');
|
|
6
7
|
|
|
7
|
-
module.exports = new SettingsHelpers({settingsCache, urlUtils, config, labs});
|
|
8
|
+
module.exports = new SettingsHelpers({settingsCache, urlUtils, config, labs, limitService});
|
|
@@ -245,8 +245,7 @@ class StatsService {
|
|
|
245
245
|
const request = deps.request || require('../../lib/request-external');
|
|
246
246
|
const settingsCache = deps.settingsCache || require('../../../shared/settings-cache');
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
if (config.get('tinybird') && config.get('tinybird:stats')) {
|
|
248
|
+
if (settingsCache.get('web_analytics_enabled')) {
|
|
250
249
|
// TODO: move the tinybird client to the tinybird service
|
|
251
250
|
const TinybirdServiceWrapper = require('../tinybird');
|
|
252
251
|
TinybirdServiceWrapper.init();
|
package/core/shared/labs.js
CHANGED
|
@@ -62,6 +62,8 @@ const _ = require('lodash');
|
|
|
62
62
|
* @property {string|null} editor_default_email_recipients - Default email recipients for editor
|
|
63
63
|
* @property {string|null} labs - JSON string of enabled labs features
|
|
64
64
|
* @property {boolean|null} social_web_enabled - Whether social web is enabled
|
|
65
|
+
* @property {boolean|null} web_analytics_enabled - Whether web analytics is enabled
|
|
66
|
+
* @property {boolean|null} web_analytics_configured - Whether web analytics is configured
|
|
65
67
|
* @property {never} [x] - Prevent accessing undefined properties
|
|
66
68
|
*/
|
|
67
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghost",
|
|
3
|
-
"version": "5.129.
|
|
3
|
+
"version": "5.129.2",
|
|
4
4
|
"description": "The professional publishing platform",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"homepage": "https://ghost.org",
|
|
@@ -75,20 +75,20 @@
|
|
|
75
75
|
"@tryghost/admin-api-schema": "4.5.10",
|
|
76
76
|
"@tryghost/api-framework": "1.0.2",
|
|
77
77
|
"@tryghost/bookshelf-plugins": "0.6.27",
|
|
78
|
-
"@tryghost/color-utils": "0.2.
|
|
78
|
+
"@tryghost/color-utils": "0.2.9",
|
|
79
79
|
"@tryghost/config-url-helpers": "1.0.17",
|
|
80
80
|
"@tryghost/custom-fonts": "1.0.2",
|
|
81
81
|
"@tryghost/database-info": "0.3.30",
|
|
82
82
|
"@tryghost/debug": "0.1.35",
|
|
83
|
-
"@tryghost/domain-events": "1.0.
|
|
83
|
+
"@tryghost/domain-events": "1.0.2",
|
|
84
84
|
"@tryghost/email-mock-receiver": "0.3.11",
|
|
85
85
|
"@tryghost/errors": "1.3.8",
|
|
86
86
|
"@tryghost/helpers": "1.1.97",
|
|
87
87
|
"@tryghost/html-to-plaintext": "1.0.4",
|
|
88
88
|
"@tryghost/http-cache-utils": "0.1.20",
|
|
89
|
-
"@tryghost/i18n": "file:components/tryghost-i18n-5.129.
|
|
89
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-5.129.2.tgz",
|
|
90
90
|
"@tryghost/image-transform": "1.4.6",
|
|
91
|
-
"@tryghost/job-manager": "1.0.
|
|
91
|
+
"@tryghost/job-manager": "1.0.3",
|
|
92
92
|
"@tryghost/kg-card-factory": "5.1.2",
|
|
93
93
|
"@tryghost/kg-clean-basic-html": "4.2.7",
|
|
94
94
|
"@tryghost/kg-converters": "1.1.7",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"@tryghost/kg-lexical-html-renderer": "1.3.24",
|
|
101
101
|
"@tryghost/kg-markdown-html-renderer": "7.1.3",
|
|
102
102
|
"@tryghost/kg-mobiledoc-html-renderer": "7.1.3",
|
|
103
|
-
"@tryghost/limit-service": "1.
|
|
104
|
-
"@tryghost/logging": "2.4.
|
|
103
|
+
"@tryghost/limit-service": "1.4.0",
|
|
104
|
+
"@tryghost/logging": "2.4.23",
|
|
105
105
|
"@tryghost/members-csv": "2.0.3",
|
|
106
106
|
"@tryghost/metrics": "1.0.38",
|
|
107
107
|
"@tryghost/mw-error-handler": "1.0.7",
|
|
@@ -109,13 +109,13 @@
|
|
|
109
109
|
"@tryghost/nodemailer": "0.3.48",
|
|
110
110
|
"@tryghost/nql": "0.12.7",
|
|
111
111
|
"@tryghost/pretty-cli": "1.2.47",
|
|
112
|
-
"@tryghost/prometheus-metrics": "1.0.
|
|
112
|
+
"@tryghost/prometheus-metrics": "1.0.2",
|
|
113
113
|
"@tryghost/promise": "0.3.15",
|
|
114
114
|
"@tryghost/referrer-parser": "0.1.8",
|
|
115
|
-
"@tryghost/request": "1.0.
|
|
115
|
+
"@tryghost/request": "1.0.12",
|
|
116
116
|
"@tryghost/root-utils": "0.3.33",
|
|
117
117
|
"@tryghost/security": "1.0.1",
|
|
118
|
-
"@tryghost/social-urls": "0.1.
|
|
118
|
+
"@tryghost/social-urls": "0.1.53",
|
|
119
119
|
"@tryghost/string": "0.2.17",
|
|
120
120
|
"@tryghost/tpl": "0.1.35",
|
|
121
121
|
"@tryghost/url-utils": "4.4.14",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"knex-migrator": "5.3.2",
|
|
183
183
|
"leaky-bucket": "2.2.0",
|
|
184
184
|
"lodash": "4.17.21",
|
|
185
|
-
"luxon": "3.
|
|
185
|
+
"luxon": "3.7.1",
|
|
186
186
|
"mailgun.js": "10.4.0",
|
|
187
187
|
"metascraper": "5.45.15",
|
|
188
188
|
"metascraper-author": "5.45.10",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"moment": "2.24.0",
|
|
198
198
|
"moment-timezone": "0.5.45",
|
|
199
199
|
"multer": "2.0.1",
|
|
200
|
-
"mysql2": "3.14.
|
|
200
|
+
"mysql2": "3.14.2",
|
|
201
201
|
"nconf": "0.13.0",
|
|
202
202
|
"node-fetch": "2.7.0",
|
|
203
203
|
"node-jose": "2.2.0",
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
"@types/bookshelf": "1.2.9",
|
|
234
234
|
"@types/common-tags": "1.8.4",
|
|
235
235
|
"@types/jsonwebtoken": "9.0.10",
|
|
236
|
-
"@types/node": "22.16.
|
|
236
|
+
"@types/node": "22.16.3",
|
|
237
237
|
"@types/node-jose": "1.1.13",
|
|
238
238
|
"@types/nodemailer": "6.4.17",
|
|
239
239
|
"@types/sinon": "17.0.4",
|
|
@@ -270,11 +270,11 @@
|
|
|
270
270
|
},
|
|
271
271
|
"resolutions": {
|
|
272
272
|
"@tryghost/errors": "1.3.8",
|
|
273
|
-
"@tryghost/logging": "2.4.
|
|
273
|
+
"@tryghost/logging": "2.4.23",
|
|
274
274
|
"jackspeak": "2.3.6",
|
|
275
275
|
"moment": "2.24.0",
|
|
276
276
|
"moment-timezone": "0.5.45",
|
|
277
|
-
"@tryghost/i18n": "file:components/tryghost-i18n-5.129.
|
|
277
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-5.129.2.tgz"
|
|
278
278
|
},
|
|
279
279
|
"nx": {
|
|
280
280
|
"targets": {
|