diff --git a/bower.json b/bower.json index e26b467..5d769c1 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "webfinger.js", - "version": "2.2.0", + "version": "2.2.1", "homepage": "https://github.com/silverbucket/webfinger.js", "authors": [ "Nick Jennings " diff --git a/package.json b/package.json index c07961e..716a6f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webfinger.js", - "version": "2.2.0", + "version": "2.2.1", "description": "a simple webfinger record lookup library", "license": "LGPL", "private": false, diff --git a/src/webfinger.js b/src/webfinger.js index c2db7b5..09bfe6a 100644 --- a/src/webfinger.js +++ b/src/webfinger.js @@ -1,6 +1,6 @@ /*! * webfinger.js - * version 2.2.0 + * version 2.2.1 * http://github.com/silverbucket/webfinger.js * * Developed and Maintained by: diff --git a/src/webfinger.min.js b/src/webfinger.min.js index acd3349..67749a9 100644 --- a/src/webfinger.min.js +++ b/src/webfinger.min.js @@ -1,2 +1,2 @@ -/* webfinger.js v2.1.4 | (c) 2012-2014 Nick Jennings | License: AGPL | https://github.com/silverbucket/webfinger.js */ -"undefined"==typeof XMLHttpRequest&&(XMLHttpRequest=require("xmlhttprequest").XMLHttpRequest),function(e){function t(e){return e.toString=function(){return this.message},e}function r(e){"object"!=typeof e&&(e={}),this.config={tls_only:"undefined"!=typeof e.tls_only?e.tls_only:!0,webfist_fallback:"undefined"!=typeof e.webfist_fallback?e.webfist_fallback:!1,uri_fallback:"undefined"!=typeof e.uri_fallback?e.uri_fallback:!1,request_timeout:"undefined"!=typeof e.request_timeout?e.request_timeout:1e4}}var o={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},s={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},n=["webfinger","host-meta","host-meta.json"];if(r.prototype._fetchJRD=function(e,r){var o=this,s=new XMLHttpRequest;s.onreadystatechange=function(){4===s.readyState&&(200===s.status?o._isValidJSON(s.responseText)?r(null,s.responseText):r(t({message:"invalid json",url:e,status:s.status})):r(404===s.status?t({message:"endpoint unreachable",url:e,status:s.status}):t({message:"error during request",url:e,status:s.status})))},s.open("GET",e,!0),s.setRequestHeader("Accept","application/jrd+json, application/json"),s.send()},r.prototype._isValidJSON=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},r.prototype._isLocalhost=function(e){var t=/^localhost(\.localdomain)?(\:[0-9]+)?$/;return t.test(e)},r.prototype._processJRD=function(r,n){var i=JSON.parse(r);if("object"!=typeof i||"object"!=typeof i.links)return n(t("undefined"!=typeof i.error?{message:i.error}:{message:"unknown response from server"})),!1;var a=i.links,f={object:i,json:r,idx:{}};f.idx.properties={name:e},f.idx.links=JSON.parse(JSON.stringify(s)),a.map(function(e,t){if(o.hasOwnProperty(e.rel)&&f.idx.links[o[e.rel]]){var r={};Object.keys(e).map(function(t,o){r[t]=e[t]}),f.idx.links[o[e.rel]].push(r)}});var l=JSON.parse(r).properties;for(var p in l)l.hasOwnProperty(p)&&"http://packetizer.com/ns/name"===p&&(f.idx.properties.name=l[p]);n(null,f)},r.prototype.lookup=function(e,r){function o(){return u+"://"+l+"/.well-known/"+n[p]+"?resource=acct:"+e}function s(e){if(a.config.uri_fallback&&"webfist.org"!==l&&p!==n.length-1)p+=1,i();else if(a.config.tls_only||"https"!==u){if(!a.config.webfist_fallback||"webfist.org"===l)return r(e),!1;p=0,u="http",l="webfist.org",a._fetchJRD(o(),function(e,t){return e?(r(e),!1):void a._processJRD(t,function(e,t){"object"==typeof t.idx.links.webfist&&"string"==typeof t.idx.links.webfist[0].href&&a._fetchJRD(t.idx.links.webfist[0].href,function(e,t){e?r(e):a._processJRD(t,r)})})})}else p=0,u="http",i()}function i(){a._fetchJRD(o(),function(e,t){e?s(e):a._processJRD(t,r)})}if("string"!=typeof e)throw new Error("first parameter must be a user address");if("function"!=typeof r)throw new Error("second parameter must be a callback");var a=this,f=e.replace(/ /g,"").split("@"),l=f[1],p=0,u="https";return 2!==f.length?(r(t({message:"invalid user address "+e+" ( expected format: user@host.com )"})),!1):(a._isLocalhost(l)&&(u="http"),void setTimeout(i,0))},r.prototype.lookupLink=function(e,t,r){s.hasOwnProperty(t)?this.lookup(e,function(e,o){var s=o.idx.links[t];e?r(e):0===s.length?r('no links found with rel="'+t+'"'):r(null,s[0])}):r("unsupported rel "+t)},"object"==typeof window)window.WebFinger=r;else if("function"==typeof define&&define.amd)define([],function(){return r});else try{module.exports=r}catch(i){}}(); \ No newline at end of file +/* webfinger.js v2.2.1 | (c) 2012-2014 Nick Jennings | License: AGPL | https://github.com/silverbucket/webfinger.js */ +"undefined"==typeof XMLHttpRequest&&(XMLHttpRequest=require("xmlhttprequest").XMLHttpRequest),function(e){function t(e){return e.toString=function(){return this.message},e}function r(e){"object"!=typeof e&&(e={}),this.config={tls_only:"undefined"!=typeof e.tls_only?e.tls_only:!0,webfist_fallback:"undefined"!=typeof e.webfist_fallback?e.webfist_fallback:!1,uri_fallback:"undefined"!=typeof e.uri_fallback?e.uri_fallback:!1,request_timeout:"undefined"!=typeof e.request_timeout?e.request_timeout:1e4}}var o={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},s={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},n=["webfinger","host-meta","host-meta.json"];if(r.prototype._fetchJRD=function(e,r){var o=this,s=new XMLHttpRequest;s.onreadystatechange=function(){4===s.readyState&&(200===s.status?o._isValidJSON(s.responseText)?r(null,s.responseText):r(t({message:"invalid json",url:e,status:s.status})):r(404===s.status?t({message:"endpoint unreachable",url:e,status:s.status}):t({message:"error during request",url:e,status:s.status})))},s.open("GET",e,!0),s.setRequestHeader("Accept","application/jrd+json, application/json"),s.send()},r.prototype._isValidJSON=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},r.prototype._isLocalhost=function(e){var t=/^localhost(\.localdomain)?(\:[0-9]+)?$/;return t.test(e)},r.prototype._processJRD=function(r,n){var i=JSON.parse(r);if("object"!=typeof i||"object"!=typeof i.links)return n(t("undefined"!=typeof i.error?{message:i.error}:{message:"unknown response from server"})),!1;var a=i.links,f={object:i,json:r,idx:{}};f.idx.properties={name:e},f.idx.links=JSON.parse(JSON.stringify(s)),a.map(function(e,t){if(o.hasOwnProperty(e.rel)&&f.idx.links[o[e.rel]]){var r={};Object.keys(e).map(function(t,o){r[t]=e[t]}),f.idx.links[o[e.rel]].push(r)}});var l=JSON.parse(r).properties;for(var p in l)l.hasOwnProperty(p)&&"http://packetizer.com/ns/name"===p&&(f.idx.properties.name=l[p]);n(null,f)},r.prototype.lookup=function(e,r){function o(){return u+"://"+l+"/.well-known/"+n[p]+"?resource=acct:"+e}function s(e){if(a.config.uri_fallback&&"webfist.org"!==l&&p!==n.length-1)p+=1,i();else if(a.config.tls_only||"https"!==u){if(!a.config.webfist_fallback||"webfist.org"===l)return r(e),!1;p=0,u="http",l="webfist.org",a._fetchJRD(o(),function(e,t){return e?(r(e),!1):void a._processJRD(t,function(e,t){"object"==typeof t.idx.links.webfist&&"string"==typeof t.idx.links.webfist[0].href&&a._fetchJRD(t.idx.links.webfist[0].href,function(e,t){e?r(e):a._processJRD(t,r)})})})}else p=0,u="http",i()}function i(){a._fetchJRD(o(),function(e,t){e?s(e):a._processJRD(t,r)})}if("string"!=typeof e)throw new Error("first parameter must be a user address");if("function"!=typeof r)throw new Error("second parameter must be a callback");var a=this,f=e.replace(/ /g,"").split("@"),l=f[1],p=0,u="https";return 2!==f.length?(r(t({message:"invalid user address "+e+" ( expected format: user@host.com )"})),!1):(a._isLocalhost(l)&&(u="http"),void setTimeout(i,0))},r.prototype.lookupLink=function(e,t,r){s.hasOwnProperty(t)?this.lookup(e,function(e,o){var s=o.idx.links[t];e?r(e):0===s.length?r('no links found with rel="'+t+'"'):r(null,s[0])}):r("unsupported rel "+t)},"object"==typeof window)window.WebFinger=r;else if("function"==typeof define&&define.amd)define([],function(){return r});else try{module.exports=r}catch(i){}}(); \ No newline at end of file