From 0daeca0455bacbcb07a913bd072030f419d193c7 Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Tue, 5 Jan 2016 12:35:51 -0500 Subject: [PATCH] version bump --- package.json | 2 +- src/webfinger.js | 2 +- src/webfinger.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 79361e8..379d98e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webfinger.js", - "version": "2.3.0", + "version": "2.3.1", "description": "a simple webfinger record lookup library", "license": "LGPL", "private": false, diff --git a/src/webfinger.js b/src/webfinger.js index af419cf..56c706c 100644 --- a/src/webfinger.js +++ b/src/webfinger.js @@ -1,7 +1,7 @@ /* global define */ /*! * webfinger.js - * version 2.3.0 + * version 2.3.1 * http://github.com/silverbucket/webfinger.js * * Developed and Maintained by: diff --git a/src/webfinger.min.js b/src/webfinger.min.js index e54b96b..93c17bc 100644 --- a/src/webfinger.min.js +++ b/src/webfinger.min.js @@ -1,2 +1,2 @@ -/* webfinger.js v2.3.0 | (c) 2012-2014 Nick Jennings | License: AGPL | https://github.com/silverbucket/webfinger.js */ +/* webfinger.js v2.3.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){if("string"!=typeof e)return!1;var t=e.split("://");return"https"===t[0]?!0:!1}function o(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 s={"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"},n={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},i=["webfinger","host-meta","host-meta.json"];if(o.prototype.__fetchJRD=function(e,o,s){function n(e){var a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState){if(200===a.status)return i.__isValidJSON(a.responseText)?s(a.responseText):o(t({message:"invalid json",url:e,status:a.status}));if(404===a.status)return o(t({message:"endpoint unreachable",url:e,status:a.status}));if(a.status>=301&&a.status<=302){var u=a.getResponseHeader("Location");return r(u)?n(u):o(t({message:"no redirect URL found",url:e,status:a.status}))}return o(t({message:"error during request",url:e,status:a.status}))}},a.open("GET",e,!0),a.setRequestHeader("Accept","application/jrd+json, application/json"),a.send()}var i=this;return n(e)},o.prototype.__isValidJSON=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},o.prototype.__isLocalhost=function(e){var t=/^localhost(\.localdomain)?(\:[0-9]+)?$/;return t.test(e)},o.prototype.__processJRD=function(r,o,i){var a=JSON.parse(r);if("object"!=typeof a||"object"!=typeof a.links)return o("undefined"!=typeof a.error?t({message:a.error}):t({message:"unknown response from server"}));var u=a.links,f={object:a,json:r,idx:{}};f.idx.properties={name:e},f.idx.links=JSON.parse(JSON.stringify(n)),u.map(function(e){if(s.hasOwnProperty(e.rel)&&f.idx.links[s[e.rel]]){var t={};Object.keys(e).map(function(r){t[r]=e[r]}),f.idx.links[s[e.rel]].push(t)}});var p=JSON.parse(r).properties;for(var l in p)p.hasOwnProperty(l)&&"http://packetizer.com/ns/name"===l&&(f.idx.properties.name=p[l]);return i(f)},o.prototype.lookup=function(e,r){function o(){return l+"://"+f+"/.well-known/"+i[p]+"?resource=acct:"+e}function s(e){return a.config.uri_fallback&&"webfist.org"!==f&&p!==i.length-1?(p+=1,n()):a.config.tls_only||"https"!==l?a.config.webfist_fallback&&"webfist.org"!==f?(p=0,l="http",f="webfist.org",a.__fetchJRD(o(),r,function(e){a.__processJRD(e,r,function(e){"object"==typeof e.idx.links.webfist&&"string"==typeof e.idx.links.webfist[0].href&&a.__fetchJRD(e.idx.links.webfist[0].href,r,function(e){a.__processJRD(e,r,function(){return r(null,r)})})})}),void 0):r(e):(p=0,l="http",n())}function n(){a.__fetchJRD(o(),s,function(e){a.__processJRD(e,r,function(e){r(null,e)})})}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,u=e.replace(/ /g,"").split("@"),f=u[1],p=0,l="https";return 2!==u.length?r(t({message:"invalid user address "+e+" ( expected format: user@host.com )"})):(a.__isLocalhost(f)&&(l="http"),setTimeout(n,0))},o.prototype.lookupLink=function(e,t,r){return n.hasOwnProperty(t)?void this.lookup(e,function(e,o){var s=o.idx.links[t];return 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=o;else if("function"==typeof define&&define.amd)define([],function(){return o});else try{module.exports=o}catch(a){}}(); \ No newline at end of file