From b6bf0ab9363367de2651d317cf44f22938af77d1 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 3 Dec 2012 18:15:39 +0000 Subject: [PATCH 1/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b0fff543e..51ea9763e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,8 @@ # Developer Guidelines (Please talk to people on the mailing list before you change this page, see our section on [how to get in touch](https://github.com/ether/etherpad-lite#get-in-touch)) +## Important note for pull requests +Pull requests should issued against the develop branch. We never pull directly into master. **Our goal is to iterate in small steps. Release often, release early. Evolution instead of a revolution** ## General goals of Etherpad Lite From 019d2e01be21153d1c97eeeed6b4f21ab43029b0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 3 Dec 2012 18:15:55 +0000 Subject: [PATCH 2/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51ea9763e..d3f05b677 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,7 @@ ## Important note for pull requests Pull requests should issued against the develop branch. We never pull directly into master. + **Our goal is to iterate in small steps. Release often, release early. Evolution instead of a revolution** ## General goals of Etherpad Lite From 7427f9ba15aa0f8dde82cc6bb4db0d215e54cf32 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 3 Dec 2012 18:16:19 +0000 Subject: [PATCH 3/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d3f05b677..4a69a3b65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ (Please talk to people on the mailing list before you change this page, see our section on [how to get in touch](https://github.com/ether/etherpad-lite#get-in-touch)) ## Important note for pull requests -Pull requests should issued against the develop branch. We never pull directly into master. +**Pull requests should issued against the develop branch**. We never pull directly into master. **Our goal is to iterate in small steps. Release often, release early. Evolution instead of a revolution** From 8686da87e8f838a5ffbc1cdb1b6ca68174062186 Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Thu, 6 Dec 2012 21:03:15 +0100 Subject: [PATCH 4/8] Update src/node/db/API.js Added a checkToken method for checking if the API token is valid. --- src/node/db/API.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/node/db/API.js b/src/node/db/API.js index 4979e8c65..18ed1d0c5 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -548,6 +548,18 @@ exports.sendClientsMessage = function (padID, msg, callback) { } ); } +/** +checkToken() returns ok when api token is valid + +Example returns: + +{code: 0, message:"ok"} +*/ +exports.checkToken = function(padID, callback) +{ + callback() +} + /******************************/ /** INTERNAL HELPER FUNCTIONS */ From 2163c8be5c8988f45bad7f380e2c0e8691e86798 Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Thu, 6 Dec 2012 21:06:09 +0100 Subject: [PATCH 5/8] Update src/node/handler/APIHandler.js Added the checkToken function to the function array. --- src/node/handler/APIHandler.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index f99762cea..198ec97b3 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -68,6 +68,7 @@ var version = , "isPasswordProtected" : ["padID"] , "listAuthorsOfPad" : ["padID"] , "padUsersCount" : ["padID"] + , "checkToken" : [] } , "1.1": { "createGroup" : [] @@ -102,6 +103,7 @@ var version = , "padUsers" : ["padID"] , "sendClientsMessage" : ["padID", "msg"] , "listAllGroups" : [] + , "checkToken" : [] } }; From 26ece95905f679917a6f8d3aa7bf7fae658bd6ac Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Thu, 6 Dec 2012 21:24:44 +0100 Subject: [PATCH 6/8] Update src/node/db/API.js Added a missing symicolon and removed the padID argument which is not passed(and thus leads to an errors because the callback lands in there). --- src/node/db/API.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 18ed1d0c5..783cf97f2 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -555,9 +555,9 @@ Example returns: {code: 0, message:"ok"} */ -exports.checkToken = function(padID, callback) +exports.checkToken = function(callback) { - callback() + callback(); } From 4318d210cef88ffecf956cf3b22ffd3c0a478572 Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Thu, 6 Dec 2012 21:26:51 +0100 Subject: [PATCH 7/8] Update src/node/db/API.js Corrected function documentation. --- src/node/db/API.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 783cf97f2..ea58d8599 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -553,7 +553,8 @@ checkToken() returns ok when api token is valid Example returns: -{code: 0, message:"ok"} +{"code":0,"message":"ok","data":null} +{"code":4,"message":"no or wrong API Key","data":null} */ exports.checkToken = function(callback) { From c2cc29232448f1e7c6d388824b506bfd1b9a5f27 Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Thu, 6 Dec 2012 21:33:22 +0100 Subject: [PATCH 8/8] Update doc/api/http_api.md Added docs for the checkToken function --- doc/api/http_api.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/api/http_api.md b/doc/api/http_api.md index 7ace1b0b7..e73109b01 100644 --- a/doc/api/http_api.md +++ b/doc/api/http_api.md @@ -407,3 +407,12 @@ sends a custom message of type `msg` to the pad *Example returns:* * `{code: 0, message:"ok", data: {}}` * `{code: 1, message:"padID does not exist", data: null}` + +#### checkToken() + * API >= 1 + +returns ok when api token is valid + +*Example returns:* + * `{"code":0,"message":"ok","data":null}` + * `{"code":4,"message":"no or wrong API Key","data":null}`