From fffdde0c593106f9d5c383e6103fc68b48e3c75d Mon Sep 17 00:00:00 2001 From: Stephan Jauernick Date: Sat, 31 May 2014 00:43:31 +0200 Subject: [PATCH] Implemented the the new API method getPadID for reversing the Readonly ID. Based on: https://github.com/disy-mk/etherpad-lite/commit/ff88c19fc12887a49fdb752adb15ee3145f521f0 --- src/node/db/API.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/node/db/API.js b/src/node/db/API.js index c1050464..f9e4695d 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -640,6 +640,32 @@ exports.getReadOnlyID = function(padID, callback) }); } +/** +getPadID(roID) returns the padID of a pad based on the readonlyID(roID) + +Example returns: + +{code: 0, message:"ok", data: null} +{code: 1, message:"padID does not exist", data: null} +*/ +exports.getPadID = function(roID, callback) +{ + //get the PadId + readOnlyManager.getPadId(roID, function(err, padID) + { + if(ERR(err, callback)) return; + + if(padID == null) + { + callback(new customError("padID does not exist","apierror")); + } + else + { + callback(null, {PadID: padID}); + } + }); +} + /** setPublicStatus(padID, publicStatus) sets a boolean for the public status of a pad