mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
e70898a842
refs #5942 - refactor ghost_head to use Promise.props (settle is going away and this is easier) - add a new call to fetch the frontend client, if it exists - add meta tags for the client_id and client_secret on all pages - don't include the meta tags if the client is not enabled, or if the labs flag is not set
29 lines
673 B
JavaScript
29 lines
673 B
JavaScript
var _ = require('lodash'),
|
|
api = require('../api'),
|
|
flagIsSet;
|
|
|
|
flagIsSet = function flagIsSet(flag) {
|
|
return api.settings.read({key: 'labs', context: {internal: true}}).then(function (response) {
|
|
var labs,
|
|
labsValue;
|
|
|
|
labs = _.find(response.settings, function (setting) {
|
|
return setting.key === 'labs';
|
|
});
|
|
|
|
if (!labs || !labs.value) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
labsValue = JSON.parse(labs.value);
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
|
|
return !!labsValue[flag] && labsValue[flag] === true;
|
|
});
|
|
};
|
|
|
|
module.exports.isSet = flagIsSet;
|