0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Move Public API behind labs flag

closes #5941
- added UI to labs page
- added method to determine if full authentication is required
- updated public_api tests to enable public api first
This commit is contained in:
Sebastian Gierlinger 2015-10-23 11:03:38 +02:00
parent 2c7a4f9328
commit 618d36c394
3 changed files with 29 additions and 0 deletions

View file

@ -25,5 +25,9 @@ export default Ember.Controller.extend(Ember.PromiseProxyMixin, {
}
return value;
}),
publicAPI: Ember.computed('config.publicAPI', 'labs.publicAPI', function () {
return this.get('config.publicAPI') || this.get('labs.publicAPI');
})
});

View file

@ -9,6 +9,7 @@ export default Ember.Controller.extend({
ghostPaths: Ember.inject.service('ghost-paths'),
notifications: Ember.inject.service(),
session: Ember.inject.service(),
feature: Ember.inject.controller(),
labsJSON: Ember.computed('model.labs', function () {
return JSON.parse(this.get('model.labs') || {});
@ -29,6 +30,16 @@ export default Ember.Controller.extend({
});
},
usePublicAPI: Ember.computed('feature.publicAPI', {
get: function () {
return this.get('feature.publicAPI');
},
set: function (key, value) {
this.saveLabs('publicAPI', value);
return value;
}
}),
actions: {
onUpload: function (file) {
var self = this,

View file

@ -42,5 +42,19 @@
</div>
</fieldset>
</form>
<hr>
<form>
<fieldset>
<div class="form-group for-checkbox">
<label for="labs-publicAPI">Public API</label>
<label class="checkbox" for="labs-publicAPI">
{{input id="labs-publicAPI" name="labs[publicAPI]" type="checkbox" checked=usePublicAPI}}
<span class="input-toggle-component"></span>
<p>Enable public API access.</p>
</label>
<p>Allow access to the publicly available Ghost API using JavaScript.</p>
</div>
</fieldset>
</form>
</section>
</section>