ghost 4.27.1 → 4.30.0
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/content/themes/casper/assets/built/screen.css +1 -1
- package/content/themes/casper/assets/built/screen.css.map +1 -1
- package/content/themes/casper/assets/css/screen.css +1 -17
- package/content/themes/casper/package.json +1 -1
- package/content/themes/casper/partials/post-card.hbs +1 -1
- package/core/boot.js +3 -5
- package/core/built/assets/{ghost-dark-ae67fe157509b6e82c607ba560fc52e9.css → ghost-dark-1594d07a0716e0253a78234c8e42d765.css} +1 -1
- package/core/built/assets/{ghost.min-2d534cce15c43c646814b26f4beefb78.js → ghost.min-884660873d56fcc3d2a3b9fe94c9f022.js} +79 -79
- package/core/built/assets/{ghost.min-b1e58e098721e467388682a85a7c187d.css → ghost.min-c21fea11c3f431994a8ee7c47a8ed145.css} +1 -1
- package/core/built/assets/icons/audio-file.svg +5 -0
- package/core/built/assets/icons/file-download.svg +1 -0
- package/core/built/assets/icons/file-upload.svg +1 -0
- package/core/built/assets/icons/film-camera.svg +4 -0
- package/core/built/assets/icons/mute.svg +3 -0
- package/core/built/assets/icons/pause.svg +4 -0
- package/core/built/assets/icons/play.svg +3 -0
- package/core/built/assets/icons/unmute.svg +3 -0
- package/core/built/assets/{vendor.min-e433aa7d5620e7837f30e170cd43f84e.js → vendor.min-a2fd1e62ce6da8911fee8e812d8c6ceb.js} +240 -128
- package/core/frontend/apps/amp/lib/views/amp.hbs +94 -2
- package/core/frontend/services/theme-engine/i18n/i18n.js +11 -12
- package/core/frontend/services/theme-engine/i18n/index.js +1 -2
- package/core/frontend/services/theme-engine/i18n/theme-i18n.js +5 -4
- package/core/frontend/src/cards/css/audio.css +95 -30
- package/core/frontend/src/cards/css/before-after.css +47 -0
- package/core/frontend/src/cards/css/bookmark.css +6 -5
- package/core/frontend/src/cards/css/button.css +8 -7
- package/core/frontend/src/cards/css/callout.css +4 -4
- package/core/frontend/src/cards/css/file.css +126 -0
- package/core/frontend/src/cards/css/nft.css +9 -13
- package/core/frontend/src/cards/css/product.css +81 -52
- package/core/frontend/src/cards/css/toggle.css +31 -22
- package/core/frontend/src/cards/css/video.css +340 -0
- package/core/frontend/src/cards/js/audio.js +127 -128
- package/core/frontend/src/cards/js/before-after.js +41 -0
- package/core/frontend/src/cards/js/gallery.js +10 -8
- package/core/frontend/src/cards/js/toggle.js +16 -14
- package/core/frontend/src/cards/js/video.js +232 -0
- package/core/frontend/web/middleware/error-handler.js +2 -2
- package/core/frontend/web/site.js +2 -1
- package/core/server/api/canary/oembed.js +1 -2
- package/core/server/data/db/state-manager.js +5 -8
- package/core/server/lib/image/cached-image-size-from-url.js +3 -4
- package/core/server/lib/image/image-utils.js +2 -2
- package/core/server/lib/image/index.js +1 -2
- package/core/server/run-update-check.js +1 -13
- package/core/server/services/email-analytics/index.js +2 -4
- package/core/server/services/email-analytics/jobs/fetch-latest.js +2 -21
- package/core/server/services/integrations/integrations-service.js +2 -2
- package/core/server/services/invites/index.js +0 -2
- package/core/server/services/invites/invites.js +3 -3
- package/core/server/services/jobs/job-service.js +1 -1
- package/core/server/services/mega/post-email-serializer.js +3 -1
- package/core/server/services/mega/template.js +15 -11
- package/core/server/services/members/api.js +0 -1
- package/core/server/services/members/config.js +4 -7
- package/core/server/services/members/service.js +1 -4
- package/core/server/services/notifications/index.js +0 -2
- package/core/server/services/notifications/notifications.js +4 -5
- package/core/server/services/stripe/index.js +0 -2
- package/core/server/services/twitter-embed.js +2 -1
- package/core/server/web/admin/app.js +4 -2
- package/core/server/web/admin/views/default-prod.html +4 -4
- package/core/server/web/admin/views/default.html +4 -4
- package/core/server/web/api/app.js +3 -2
- package/core/server/web/api/canary/admin/app.js +4 -2
- package/core/server/web/api/canary/content/app.js +4 -2
- package/core/server/web/api/v2/admin/app.js +4 -2
- package/core/server/web/api/v2/content/app.js +4 -2
- package/core/server/web/api/v3/admin/app.js +4 -2
- package/core/server/web/api/v3/content/app.js +4 -2
- package/core/server/web/members/app.js +6 -4
- package/core/server/web/shared/middleware/index.js +0 -4
- package/core/shared/labs.js +9 -8
- package/package.json +28 -23
- package/yarn.lock +2589 -1988
- package/core/server/web/shared/middleware/error-handler.js +0 -224
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
const _ = require('lodash');
|
|
2
|
-
const debug = require('@tryghost/debug')('error-handler');
|
|
3
|
-
const errors = require('@tryghost/errors');
|
|
4
|
-
const tpl = require('@tryghost/tpl');
|
|
5
|
-
const sentry = require('../../../../shared/sentry');
|
|
6
|
-
|
|
7
|
-
const messages = {
|
|
8
|
-
pageNotFound: 'Page not found',
|
|
9
|
-
resourceNotFound: 'Resource not found',
|
|
10
|
-
actions: {
|
|
11
|
-
images: {
|
|
12
|
-
upload: 'upload image'
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
userMessages: {
|
|
16
|
-
BookshelfRelationsError: 'Database error, cannot {action}.',
|
|
17
|
-
InternalServerError: 'Internal server error, cannot {action}.',
|
|
18
|
-
IncorrectUsageError: 'Incorrect usage error, cannot {action}.',
|
|
19
|
-
NotFoundError: 'Resource not found error, cannot {action}.',
|
|
20
|
-
BadRequestError: 'Request not understood error, cannot {action}.',
|
|
21
|
-
UnauthorizedError: 'Authorisation error, cannot {action}.',
|
|
22
|
-
NoPermissionError: 'Permission error, cannot {action}.',
|
|
23
|
-
ValidationError: 'Validation error, cannot {action}.',
|
|
24
|
-
UnsupportedMediaTypeError: 'Unsupported media error, cannot {action}.',
|
|
25
|
-
TooManyRequestsError: 'Too many requests error, cannot {action}.',
|
|
26
|
-
MaintenanceError: 'Server down for maintenance, cannot {action}.',
|
|
27
|
-
MethodNotAllowedError: 'Method not allowed, cannot {action}.',
|
|
28
|
-
RequestEntityTooLargeError: 'Request too large, cannot {action}.',
|
|
29
|
-
TokenRevocationError: 'Token is not available, cannot {action}.',
|
|
30
|
-
VersionMismatchError: 'Version mismatch error, cannot {action}.',
|
|
31
|
-
DataExportError: 'Error exporting content.',
|
|
32
|
-
DataImportError: 'Duplicated entry, cannot save {action}.',
|
|
33
|
-
DatabaseVersionError: 'Database version compatibility error, cannot {action}.',
|
|
34
|
-
EmailError: 'Error sending email!',
|
|
35
|
-
ThemeValidationError: 'Theme validation error, cannot {action}.',
|
|
36
|
-
HostLimitError: 'Host Limit error, cannot {action}.',
|
|
37
|
-
DisabledFeatureError: 'Theme validation error, the {{{helperName}}} helper is not available. Cannot {action}.',
|
|
38
|
-
UpdateCollisionError: 'Saving failed! Someone else is editing this post.'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const updateStack = (err) => {
|
|
43
|
-
let stackbits = err.stack.split(/\n/g);
|
|
44
|
-
|
|
45
|
-
// We build this up backwards, so we always insert at position 1
|
|
46
|
-
|
|
47
|
-
if (process.env.NODE_ENV === 'production' || err.statusCode === 404) {
|
|
48
|
-
// In production mode, remove the stack trace
|
|
49
|
-
stackbits.splice(1, stackbits.length - 1);
|
|
50
|
-
} else {
|
|
51
|
-
// In dev mode, clearly mark the strack trace
|
|
52
|
-
stackbits.splice(1, 0, `Stack Trace:`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Add in our custom cotext and help methods
|
|
56
|
-
|
|
57
|
-
if (err.help) {
|
|
58
|
-
stackbits.splice(1, 0, `${err.help}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (err.context) {
|
|
62
|
-
stackbits.splice(1, 0, `${err.context}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return stackbits.join('\n');
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Get an error ready to be shown the the user
|
|
70
|
-
*/
|
|
71
|
-
module.exports.prepareError = (err, req, res, next) => {
|
|
72
|
-
debug(err);
|
|
73
|
-
|
|
74
|
-
if (Array.isArray(err)) {
|
|
75
|
-
err = err[0];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!errors.utils.isGhostError(err)) {
|
|
79
|
-
// We need a special case for 404 errors
|
|
80
|
-
if (err.statusCode && err.statusCode === 404) {
|
|
81
|
-
err = new errors.NotFoundError({
|
|
82
|
-
err: err
|
|
83
|
-
});
|
|
84
|
-
} else if (err.stack.match(/node_modules\/handlebars\//)) {
|
|
85
|
-
// Temporary handling of theme errors from handlebars
|
|
86
|
-
// @TODO remove this when #10496 is solved properly
|
|
87
|
-
err = new errors.IncorrectUsageError({
|
|
88
|
-
err: err,
|
|
89
|
-
message: err.message,
|
|
90
|
-
statusCode: err.statusCode
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
err = new errors.InternalServerError({
|
|
94
|
-
err: err,
|
|
95
|
-
message: err.message,
|
|
96
|
-
statusCode: err.statusCode
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// used for express logging middleware see core/server/app.js
|
|
102
|
-
req.err = err;
|
|
103
|
-
|
|
104
|
-
// alternative for res.status();
|
|
105
|
-
res.statusCode = err.statusCode;
|
|
106
|
-
|
|
107
|
-
err.stack = updateStack(err);
|
|
108
|
-
|
|
109
|
-
// never cache errors
|
|
110
|
-
res.set({
|
|
111
|
-
'Cache-Control': 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
next(err);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const jsonErrorRenderer = (err, req, res, next) => { // eslint-disable-line no-unused-vars
|
|
118
|
-
res.json({
|
|
119
|
-
errors: [{
|
|
120
|
-
message: err.message,
|
|
121
|
-
context: err.context,
|
|
122
|
-
help: err.help,
|
|
123
|
-
errorType: err.errorType,
|
|
124
|
-
errorDetails: err.errorDetails,
|
|
125
|
-
ghostErrorCode: err.ghostErrorCode
|
|
126
|
-
}]
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const jsonErrorRendererV2 = (err, req, res, next) => { // eslint-disable-line no-unused-vars
|
|
131
|
-
const userError = prepareUserMessage(err, req);
|
|
132
|
-
|
|
133
|
-
res.json({
|
|
134
|
-
errors: [{
|
|
135
|
-
message: userError.message || null,
|
|
136
|
-
context: userError.context || null,
|
|
137
|
-
type: err.errorType || null,
|
|
138
|
-
details: err.errorDetails || null,
|
|
139
|
-
property: err.property || null,
|
|
140
|
-
help: err.help || null,
|
|
141
|
-
code: err.code || null,
|
|
142
|
-
id: err.id || null
|
|
143
|
-
}]
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const prepareUserMessage = (err, res) => {
|
|
148
|
-
const userError = {
|
|
149
|
-
message: err.message,
|
|
150
|
-
context: err.context
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const docName = _.get(res, 'frameOptions.docName');
|
|
154
|
-
const method = _.get(res, 'frameOptions.method');
|
|
155
|
-
|
|
156
|
-
if (docName && method) {
|
|
157
|
-
let action;
|
|
158
|
-
|
|
159
|
-
const actionMap = {
|
|
160
|
-
browse: 'list',
|
|
161
|
-
read: 'read',
|
|
162
|
-
add: 'save',
|
|
163
|
-
edit: 'edit',
|
|
164
|
-
destroy: 'delete'
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
if (_.get(messages.actions, [docName, method])) {
|
|
168
|
-
action = tpl(messages.actions[docName][method]);
|
|
169
|
-
} else if (Object.keys(actionMap).includes(method)) {
|
|
170
|
-
let resource = docName;
|
|
171
|
-
|
|
172
|
-
if (method !== 'browse') {
|
|
173
|
-
resource = resource.replace(/s$/, '');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
action = `${actionMap[method]} ${resource}`;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (action) {
|
|
180
|
-
if (err.context) {
|
|
181
|
-
userError.context = `${err.message} ${err.context}`;
|
|
182
|
-
} else {
|
|
183
|
-
userError.context = err.message;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
userError.message = tpl(messages.userMessages[err.name], {action: action});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return userError;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
module.exports.resourceNotFound = (req, res, next) => {
|
|
194
|
-
next(new errors.NotFoundError({message: tpl(messages.resourceNotFound)}));
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
module.exports.pageNotFound = (req, res, next) => {
|
|
198
|
-
next(new errors.NotFoundError({message: tpl(messages.pageNotFound)}));
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
module.exports.handleJSONResponse = [
|
|
202
|
-
// Make sure the error can be served
|
|
203
|
-
module.exports.prepareError,
|
|
204
|
-
// Handle the error in Sentry
|
|
205
|
-
sentry.errorHandler,
|
|
206
|
-
// Render the error using JSON format
|
|
207
|
-
jsonErrorRenderer
|
|
208
|
-
];
|
|
209
|
-
|
|
210
|
-
module.exports.handleJSONResponseV2 = [
|
|
211
|
-
// Make sure the error can be served
|
|
212
|
-
module.exports.prepareError,
|
|
213
|
-
// Handle the error in Sentry
|
|
214
|
-
sentry.errorHandler,
|
|
215
|
-
// Render the error using JSON format
|
|
216
|
-
jsonErrorRendererV2
|
|
217
|
-
];
|
|
218
|
-
|
|
219
|
-
module.exports.handleHTMLResponse = [
|
|
220
|
-
// Make sure the error can be served
|
|
221
|
-
module.exports.prepareError,
|
|
222
|
-
// Handle the error in Sentry
|
|
223
|
-
sentry.errorHandler
|
|
224
|
-
];
|