diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js index 57eeeb73..04464b08 100644 --- a/node/handler/APIHandler.js +++ b/node/handler/APIHandler.js @@ -70,7 +70,7 @@ var functions = { exports.handle = function(functionName, fields, req, res) { //check the api key! - if(fields["apikey"] != apikey) + if(fields["apikey"] != apikey.trim()) { res.send({code: 4, message: "no or wrong API Key", data: null}); return; diff --git a/node/server.js b/node/server.js index d39fdcae..08c09ab0 100644 --- a/node/server.js +++ b/node/server.js @@ -442,19 +442,19 @@ async.waterfall([ io.set('logger', { debug: function (str) { - socketIOLogger.debug(str); + socketIOLogger.debug.apply(socketIOLogger, arguments); }, info: function (str) { - socketIOLogger.info(str); + socketIOLogger.info.apply(socketIOLogger, arguments); }, warn: function (str) { - socketIOLogger.warn(str); + socketIOLogger.warn.apply(socketIOLogger, arguments); }, error: function (str) { - socketIOLogger.error(str); + socketIOLogger.error.apply(socketIOLogger, arguments); }, }); diff --git a/static/css/pad.css b/static/css/pad.css index ec89edba..94ac1e35 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -786,11 +786,15 @@ padding: 10px; border-radius: 6px; } -#embedcode, #readonlyUrl { +#embedreadonly { +float:right; +} + +#embedcode, #readonlyUrl, #linkcode { margin-left:10px; } -#embedinput, #readonlyInput{ +#embedinput, #readonlyInput, #linkinput { width:375px; height:24px; display:inline; @@ -1146,4 +1150,4 @@ width:33px !important; #editbar ul li { padding: 4px 1px; } -} \ No newline at end of file +} diff --git a/static/js/domline.js b/static/js/domline.js index 119b8378..7732805f 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -152,6 +152,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if (href) { + if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it. + { + href = "http://"+href; + } extraOpenTags = extraOpenTags + ''; extraCloseTags = '' + extraCloseTags; } diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 76f115f4..f6cf9f35 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -237,7 +237,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag) linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/; linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')'); -linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); +linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); linestylefilter.getURLFilter = linestylefilter.getRegexpFilter( linestylefilter.REGEX_URL, 'url'); diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index ae109068..d1a60615 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -99,11 +99,10 @@ var padeditbar = (function() self.toogleDropDown("users"); } else if (cmd == 'embed') - { - var padurl = window.location.href.split("?")[0]; - $('#embedinput').val(""); - self.toogleDropDown("embed"); + { + self.setEmbedLinks(); $('#embedinput').focus().select(); + self.toogleDropDown("embed"); } else if (cmd == 'import_export') { @@ -211,6 +210,22 @@ var padeditbar = (function() { syncAnimation.done(); } + }, + setEmbedLinks: function() + { + if ($('#readonlyinput').is(':checked')) + { + var basePath = document.location.href.substring(0, document.location.href.indexOf("/p/")); + var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId; + $('#embedinput').val(""); + $('#linkinput').val(readonlyLink); + } + else + { + var padurl = window.location.href.split("?")[0]; + $('#embedinput').val(""); + $('#linkinput').val(padurl); + } } }; return self; diff --git a/static/pad.html b/static/pad.html index 980905e9..c32453a5 100644 --- a/static/pad.html +++ b/static/pad.html @@ -217,17 +217,17 @@ - -Embed code: - - - - - - -Use this link to share a read-only version of your pad: - - + + Read only + + Share: + + + Link: + + + Embed code: +