diff --git a/node/db/API.js b/node/db/API.js index 6bfc4f42..8d19dab3 100644 --- a/node/db/API.js +++ b/node/db/API.js @@ -20,6 +20,7 @@ var padManager = require("./PadManager"); var padMessageHandler = require("../handler/PadMessageHandler"); +var readOnlyManager = require("./ReadOnlyManager"); var async = require("async"); /**********************/ @@ -404,9 +405,23 @@ Example returns: {code: 0, message:"ok", data: null} {code: 1, message:"padID does not exist", data: null} */ -exports.getReadOnlyLink = function(padID, callback) +exports.getReadOnlyID = function(padID, callback) { - + //we don't need the pad object, but this function does all the security stuff for us + getPadSafe(padID, function(err) + { + if(err) + { + callback(err); + return; + } + + //get the readonlyId + readOnlyManager.getReadOnlyId(padID, function(err, readOnlyId) + { + callback(err, {readOnlyID: readOnlyId}); + }); + }); } /** diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js index 8cb9e9c8..46733bfc 100644 --- a/node/handler/APIHandler.js +++ b/node/handler/APIHandler.js @@ -53,7 +53,7 @@ var functions = { "setText" : ["padID", "text"], "getRevisionsCount" : ["padID"], // "deletePad" : ["padID"], -// "getReadOnlyLink" : ["padID"], + "getReadOnlyID" : ["padID"], // "setPublicStatus" : ["padID", "publicStatus"], // "getPublicStatus" : ["padID"], // "setPassword" : ["padID", "password"],