Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 7418317

Browse files
committed
Add v2.4.0
1 parent ad7efca commit 7418317

File tree

18 files changed

+677
-914
lines changed

18 files changed

+677
-914
lines changed

core/built/assets/ghost.min-cb9cedd474b87c1e57a494b014040dcb.js core/built/assets/ghost.min-e3bf097e9324c3108e4d726878a169e0.js

+53-53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+1-1
Loading

core/built/assets/vendor.min-b6c746e6d718a54841a93b04223a8094.js core/built/assets/vendor.min-77bca21f1e9cb03acfb0bd707f936352.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/server/api/shared/headers.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ const cacheInvalidate = (result, options = {}) => {
1111

1212
const disposition = {
1313
csv(result, options = {}) {
14+
let value = options.value;
15+
16+
if (typeof options.value === 'function') {
17+
value = options.value();
18+
}
19+
1420
return {
15-
'Content-Disposition': options.value,
21+
'Content-Disposition': value,
1622
'Content-Type': 'text/csv'
1723
};
1824
},
@@ -21,15 +27,15 @@ const disposition = {
2127
return {
2228
'Content-Disposition': options.value,
2329
'Content-Type': 'application/json',
24-
'Content-Length': JSON.stringify(result).length
30+
'Content-Length': Buffer.byteLength(JSON.stringify(result))
2531
};
2632
},
2733

2834
yaml(result, options = {}) {
2935
return {
3036
'Content-Disposition': options.value,
3137
'Content-Type': 'application/yaml',
32-
'Content-Length': JSON.stringify(result).length
38+
'Content-Length': Buffer.byteLength(JSON.stringify(result))
3339
};
3440
}
3541
};

core/server/api/v0.1/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const addHeaders = (apiMethod, req, res, result) => {
229229
res.set({
230230
'Content-Disposition': header,
231231
'Content-Type': 'application/json',
232-
'Content-Length': JSON.stringify(result).length
232+
'Content-Length': Buffer.byteLength(JSON.stringify(result))
233233
});
234234
});
235235
}
@@ -241,7 +241,7 @@ const addHeaders = (apiMethod, req, res, result) => {
241241
res.set({
242242
'Content-Disposition': header,
243243
'Content-Type': 'application/yaml',
244-
'Content-Length': JSON.stringify(result).length
244+
'Content-Length': Buffer.byteLength(JSON.stringify(result))
245245
});
246246
});
247247
}

core/server/api/v2/mail.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Promise = require('bluebird');
22
const common = require('../../lib/common');
33
const mailService = require('../../services/mail');
4-
const notificationsAPI = require('./notifications');
4+
const api = require('./');
55
let mailer;
66
let _private = {};
77

@@ -12,7 +12,7 @@ _private.sendMail = (object) => {
1212

1313
return mailer.send(object.mail[0].message).catch((err) => {
1414
if (mailer.state.usingDirect) {
15-
notificationsAPI.add(
15+
api.notifications.add(
1616
{
1717
notifications: [{
1818
type: 'warn',

core/server/api/v2/subscribers.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const subscribers = {
1212
'fields',
1313
'filter',
1414
'order',
15-
'debug'
15+
'debug',
16+
'page'
1617
],
1718
permissions: true,
1819
validation: {},
@@ -139,7 +140,11 @@ const subscribers = {
139140
exportCSV: {
140141
headers: {
141142
disposition: {
142-
type: 'csv'
143+
type: 'csv',
144+
value() {
145+
const datetime = (new Date()).toJSON().substring(0, 10);
146+
return `Attachment; filename="subscribers.${datetime}.csv"`;
147+
}
143148
}
144149
},
145150
response: {

core/server/apps/subscribers/lib/router.js

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ function _renderer(req, res) {
3232
*/
3333
function errorHandler(error, req, res, next) {
3434
req.body.email = '';
35+
req.body.subscribed_url = santizeUrl(req.body.subscribed_url);
36+
req.body.subscribed_referrer = santizeUrl(req.body.subscribed_referrer);
3537

3638
if (error.statusCode !== 404) {
3739
res.locals.error = error;

core/server/config/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ _private.loadNconf = function loadNconf(options) {
2828
* env arguments
2929
*/
3030
nconf.env({
31-
separator: '__'
31+
separator: '__',
32+
parseValues: true
3233
});
3334

3435
nconf.file('custom-env', path.join(customConfigPath, 'config.' + env + '.json'));

core/server/data/importer/importers/data/posts.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class PostsImporter extends BaseImporter {
164164

165165
// CASE 1: you are importing old editor posts
166166
// CASE 2: you are importing Koenig Beta posts
167+
// CASE 3: you are importing Koenig 2.0 posts
167168
if (model.mobiledoc || (model.mobiledoc && model.html && model.html.match(/^<div class="kg-card-markdown">/))) {
168169
let mobiledoc;
169170

@@ -179,7 +180,8 @@ class PostsImporter extends BaseImporter {
179180
}
180181

181182
mobiledoc.cards.forEach((card) => {
182-
if (card[0] === 'image') {
183+
// Koenig Beta = imageStyle, Ghost 2.0 Koenig = cardWidth
184+
if (card[0] === 'image' && card[1].imageStyle) {
183185
card[1].cardWidth = card[1].imageStyle;
184186
delete card[1].imageStyle;
185187
}

0 commit comments

Comments
 (0)