diff --git a/README.md b/README.md index 39e58be..7ae486a 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,18 @@ __Example:__ `meteor --settings file.json` or `meteor deploy homework --settings The application will automatically adapt and show login buttons as needed. +#### RESTful API + +To enable the __RESTful API__ on your server, just add this to your `.json` settings file (as explained in the section above): + +```json +"public": { + "enableAPI": true +} +``` + +Your users will now be able to set API keys and use them, also enabling the use of the [Homework Command Line Client](http://github.com/fazo96/homework-cli). + ### License The MIT License (MIT) diff --git a/client/client.coffee b/client/client.coffee index 9e65945..b25b0be 100644 --- a/client/client.coffee +++ b/client/client.coffee @@ -25,6 +25,7 @@ amIValid = -> UI.registerHelper "version", -> version UI.registerHelper "status", -> Meteor.status() UI.registerHelper "loading", -> Meteor.loggingIn() or !Meteor.status().connected +UI.registerHelper "APIAvailable", -> Meteor.settings.public?.enableAPI? UI.registerHelper "facebookAvailable", -> Accounts.loginServicesConfigured() and ServiceConfiguration.configurations.find(service: "facebook").count() > 0 UI.registerHelper "twitterAvailable", -> diff --git a/client/view/templates.html b/client/view/templates.html index c6caf33..75756d2 100644 --- a/client/view/templates.html +++ b/client/view/templates.html @@ -164,6 +164,7 @@

Date Format

You can choose the format used to write and read dates in the note list

+ {{#if APIAvailable}}

API Key

If you want to be able to use our RESTful API or an application that uses it (such as our awesome @@ -172,6 +173,7 @@

you can change this key any time or remove it completely by leaving this field blank.

+ {{/if}}
diff --git a/server/api.coffee b/server/api.coffee index ea36dde..52076b3 100644 --- a/server/api.coffee +++ b/server/api.coffee @@ -1,6 +1,6 @@ notes = share.notes = new Mongo.Collection 'notes' -if !Meteor.settings.enableAPI? then return +if !Meteor.settings.public?.enableAPI? then return console.log 'RESTful HTTP API enabled'