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

Commit

Permalink
Add v2.16.4
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickRe committed Mar 6, 2019
1 parent ff4a3fa commit 88e0571
Show file tree
Hide file tree
Showing 13 changed files with 6,010 additions and 4,848 deletions.
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ const configureGrunt = function (grunt) {
}
},
stderr: function (chunk) {
// ember-data 3.6.0-3.7.0 outputs a "Circular dependency" warning which we want to ignore
// TODO: remove after upgrading to ember-data 3.8.0 which already filters the output
if (chunk.indexOf('Circular dependency') > -1) {
return;
}

hasBuiltClient = true;
grunt.log.error(chunk);
}
Expand All @@ -215,7 +221,10 @@ const configureGrunt = function (grunt) {
var upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
grunt.log.writeln('Pulling down the latest master from ' + upstream);
return `
if ! git diff --exit-code --quiet; then
git submodule sync
git submodule update
if ! git diff --exit-code --quiet --ignore-submodules=untracked; then
echo "Working directory is not clean, do you have uncommited changes? Please commit, stash or discard changes to continue."
exit 1
fi
Expand Down
2,015 changes: 2,015 additions & 0 deletions core/built/assets/ghost.min-339e5b7eb6f333f83fd741a8ff7c689b.js

Large diffs are not rendered by default.

1,163 changes: 0 additions & 1,163 deletions core/built/assets/ghost.min-3be2063b1193271d95418abf24db291f.js

This file was deleted.

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions core/server/api/v2/utils/serializers/input/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ module.exports = {
frame.data = {settings: [{key: frame.data, value: frame.options}]};
}

// CASE: transform objects/arrays into string (we store stringified objects in the db)
frame.data.settings.forEach((setting) => {
// @TODO: This belongs into the model layer?
// CASE: transform objects/arrays into string (we store stringified objects in the db)
// @TODO: This belongs into the model layer. We should stringify before saving and parse when fetching from db.
// @TODO: Fix when dropping v0.1
if (_.isObject(setting.value)) {
setting.value = JSON.stringify(setting.value);
}

if (setting.value === '0' || setting.value === '1') {
setting.value = !!+setting.value;
}

if (setting.key === 'codeinjection_head') {
setting.key = 'ghost_head';
}
Expand Down
5 changes: 3 additions & 2 deletions core/server/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ _private.loadNconf = function loadNconf(options) {

nconf.sanitizeDatabaseProperties();
nconf.makePathsAbsolute(nconf.get('paths'), 'paths');
nconf.makePathsAbsolute(nconf.get('database:connection'), 'database:connection');

if (nconf.get('database:client') === 'sqlite3') {
nconf.makePathsAbsolute(nconf.get('database:connection'), 'database:connection');
}
/**
* Check if the URL in config has a protocol
*/
Expand Down
21 changes: 21 additions & 0 deletions core/server/models/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@ Settings = ghostBookshelf.Model.extend({
.then(function then() {
return validation.validateSettings(getDefaultSettings(), self);
});
},

parse() {
const attrs = ghostBookshelf.Model.prototype.parse.apply(this, arguments);

// transform "0" to false
// transform "false" to false
// transform "null" to null
if (attrs.value === '0' || attrs.value === '1') {
attrs.value = !!+attrs.value;
}

if (attrs.value === 'false' || attrs.value === 'true') {
attrs.value = JSON.parse(attrs.value);
}

if (attrs.value === 'null') {
attrs.value = null;
}

return attrs;
}
}, {
findOne: function (data, options) {
Expand Down
3 changes: 2 additions & 1 deletion core/server/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ User = ghostBookshelf.Model.extend({

// NOTE: We don't expose the email address for for external, app and public context.
// @TODO: Why? External+Public is actually the same context? Was also mentioned here https://github.com/TryGhost/Ghost/issues/9043
if (!options || !options.context || (!options.context.user && !options.context.internal)) {
// @TODO: move to api serialization when we drop v0.1
if (!options || !options.context || (!options.context.user && !options.context.internal && (!options.context.api_key || options.context.api_key.type === 'content'))) {
delete attrs.email;
}

Expand Down
9 changes: 0 additions & 9 deletions core/server/services/auth/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const common = require('../../lib/common');
const session = require('./session');
const apiKeyAuth = require('./api-key');
const members = require('./members');
const labs = require('../labs');

const authenticate = {
// ### Authenticate Client Middleware
Expand Down Expand Up @@ -39,14 +38,6 @@ const authenticate = {
req.body.client_secret = req.query.client_secret;
}

if (labs.isSet('publicAPI') !== true) {
return next(new common.errors.NoPermissionError({
message: common.i18n.t('errors.middleware.auth.publicAPIDisabled.error'),
context: common.i18n.t('errors.middleware.auth.publicAPIDisabled.context'),
help: common.i18n.t('errors.middleware.auth.forInformationRead', {url: 'https://docs.ghost.org/api/content/'})
}));
}

if (!req.body.client_id || !req.body.client_secret) {
return next(new common.errors.UnauthorizedError({
message: common.i18n.t('errors.middleware.auth.accessDenied'),
Expand Down
9 changes: 9 additions & 0 deletions core/server/services/auth/authorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ const authorize = {
if (req.user && req.user.id) {
return next();
} else {
// CASE: has no user access and public api is disabled
if (labs.isSet('publicAPI') !== true) {
return next(new common.errors.NoPermissionError({
message: common.i18n.t('errors.middleware.auth.publicAPIDisabled.error'),
context: common.i18n.t('errors.middleware.auth.publicAPIDisabled.context'),
help: common.i18n.t('errors.middleware.auth.forInformationRead', {url: 'https://docs.ghost.org/api/content/'})
}));
}

return next(new common.errors.NoPermissionError({
message: common.i18n.t('errors.middleware.auth.pleaseSignIn')
}));
Expand Down
6 changes: 3 additions & 3 deletions core/server/web/admin/views/default-prod.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Ghost Admin</title>


<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Atrue%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%222.16%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22emberData%22%3A%7B%22enableRecordDataRFCBuild%22%3Afalse%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Atrue%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%222.16%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />

<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
Expand Down Expand Up @@ -52,8 +52,8 @@
<div id="ember-basic-dropdown-wormhole"></div>


<script src="assets/vendor.min-04b16c19bc1a77e805febf731b5e0d54.js"></script>
<script src="assets/ghost.min-3be2063b1193271d95418abf24db291f.js"></script>
<script src="assets/vendor.min-fca5560579bca951356046a37aeb5fe6.js"></script>
<script src="assets/ghost.min-339e5b7eb6f333f83fd741a8ff7c689b.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions core/server/web/admin/views/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Ghost Admin</title>


<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Atrue%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%222.16%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22emberData%22%3A%7B%22enableRecordDataRFCBuild%22%3Afalse%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Atrue%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%222.16%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />

<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
Expand Down Expand Up @@ -52,8 +52,8 @@
<div id="ember-basic-dropdown-wormhole"></div>


<script src="assets/vendor.min-04b16c19bc1a77e805febf731b5e0d54.js"></script>
<script src="assets/ghost.min-3be2063b1193271d95418abf24db291f.js"></script>
<script src="assets/vendor.min-fca5560579bca951356046a37aeb5fe6.js"></script>
<script src="assets/ghost.min-339e5b7eb6f333f83fd741a8ff7c689b.js"></script>

</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ghost",
"version": "2.16.3",
"version": "2.16.4",
"description": "The professional publishing platform",
"author": "Ghost Foundation",
"homepage": "https://ghost.org",
Expand Down

0 comments on commit 88e0571

Please sign in to comment.