From 618d36c3947a67253753f353fdb93944b7bf4483 Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Fri, 23 Oct 2015 11:03:38 +0200 Subject: [PATCH] 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 --- ghost/admin/app/controllers/feature.js | 4 ++++ ghost/admin/app/controllers/settings/labs.js | 11 +++++++++++ ghost/admin/app/templates/settings/labs.hbs | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/ghost/admin/app/controllers/feature.js b/ghost/admin/app/controllers/feature.js index b584296653..5aa36375eb 100644 --- a/ghost/admin/app/controllers/feature.js +++ b/ghost/admin/app/controllers/feature.js @@ -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'); }) }); diff --git a/ghost/admin/app/controllers/settings/labs.js b/ghost/admin/app/controllers/settings/labs.js index 42b29a2238..2a70142721 100644 --- a/ghost/admin/app/controllers/settings/labs.js +++ b/ghost/admin/app/controllers/settings/labs.js @@ -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, diff --git a/ghost/admin/app/templates/settings/labs.hbs b/ghost/admin/app/templates/settings/labs.hbs index 8494c7c8b7..96baf4df1e 100644 --- a/ghost/admin/app/templates/settings/labs.hbs +++ b/ghost/admin/app/templates/settings/labs.hbs @@ -42,5 +42,19 @@ +
+
+
+
+ + +

Allow access to the publicly available Ghost API using JavaScript.

+
+
+