From 97402f60b89549b32238505397c781dce8d79a4c Mon Sep 17 00:00:00 2001 From: Manuel Knitza Date: Mon, 11 Feb 2013 07:37:59 +0100 Subject: [PATCH 1/2] Add API endpoint to return padID for a readOnlyID --- src/node/handler/APIHandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 9f86277a0..e8138419a 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -198,6 +198,7 @@ var version = , "getRevisionsCount" : ["padID"] , "getLastEdited" : ["padID"] , "deletePad" : ["padID"] + , "getPadID" : ["roID"] , "getReadOnlyID" : ["padID"] , "setPublicStatus" : ["padID", "publicStatus"] , "getPublicStatus" : ["padID"] From ff88c19fc12887a49fdb752adb15ee3145f521f0 Mon Sep 17 00:00:00 2001 From: Manuel Knitza Date: Mon, 11 Feb 2013 07:40:03 +0100 Subject: [PATCH 2/2] Add API endpoint to return padID for a readOnlyID --- src/node/db/API.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/node/db/API.js b/src/node/db/API.js index 07141fec2..12fdabac5 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -460,6 +460,24 @@ exports.getReadOnlyID = function(padID, callback) }); } +/** +getPadID(readonlyID) returns the normal link of a pad + +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; + callback(null, {PadID: PadId}); + }); +} + /** setPublicStatus(padID, publicStatus) sets a boolean for the public status of a pad