summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rwxr-xr-xsrc/components/xriProtocolHandler.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/components/xriProtocolHandler.js b/src/components/xriProtocolHandler.js
index 1105874..3d27784 100755
--- a/src/components/xriProtocolHandler.js
+++ b/src/components/xriProtocolHandler.js
@@ -40,24 +40,27 @@ const XP_STRING_TYPE = 2;
const XP_BOOLEAN_TYPE = 3;
const XP_UNORDERED_NODE_ITERATOR_TYPE = 4;
const XP_ORDERED_NODE_ITERATOR_TYPE = 5;
const XP_UNORDERED_NODE_SNAPSHOT_TYPE = 6;
const XP_ORDERED_NODE_SNAPSHOT_TYPE = 7;
const XP_ANY_UNORDERED_NODE_TYPE = 8;
const XP_FIRST_ORDERED_NODE_TYPE = 9;
var SERVICE_CLASSES = {
'xri://+i-service*(+contact)*($v*1.0)': 'i-contact',
'http://openid.net/signon/1.0': 'openid',
+ 'http://openid.net/signon/1.1': 'openid',
+ 'http://specs.openid.net/auth/2.0/signon': 'openid',
+ 'http://specs.openid.net/auth/2.0/server': 'openid',
'xri://$res*auth*($v*2.0)': 'res-auth',
'xri://+i-service*(+authn)*(+saml)*($v*1.0)': 'authn-saml',
'xri://+i-service*(+metadata)*(+saml)*($v*1.0)' : 'metadata-saml',
'xri://+i-service*(+forwarding)*($v*1.0)': 'i-forwarding'
};
const HTML_HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\
<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\
<head>\n\
<title>FoXRI Explorer - #QXRI#</title>\n\
<link href=\"chrome://foxri/content/foxri_explorer.css\" rel=\"stylesheet\" type=\"text/css\" />\n\
@@ -228,28 +231,29 @@ function renderService(srv, doc, qxri)
if (!knownServiceType) {
var srvType = guessServiceTypeByMime(m.nodeValue);
knownServiceType = srvType? srvType : null;
}
mediaTypes.push(m.nodeValue);
if (m.nodeValue) {
html_mediatypes += "<strong>Media Type:</strong> " + m.nodeValue + "<br/>";
}
}
- res = runExpr(doc, srv, "xrd:URI/text()");
- var u;
- while (u = res.iterateNext()) {
- if (!u.nodeValue)
+ res = runExpr(doc, srv, "xrd:URI");
+ var uu;
+ while (uu = res.iterateNext()) {
+ var u = uu.firstChild;
+ if (!(u.nodeValue && u.nodeType==3))
continue;
var srvType = guessServiceTypeByURI(u.nodeValue);
if (!knownServiceType) {
knownServiceType = srvType;
}
html_uris += "<div class=\"" + getServiceClass(srvType) + "\">";
var linkContent = u.nodeValue;
var uriParts = u.nodeValue.match('^(.*):(.*)$');
if (!uriParts)
@@ -276,25 +280,32 @@ function renderService(srv, doc, qxri)
else if (uriParts[2] == "add") {
linkContent = "<img src=\"chrome://foxri/content/skype_add_large.png\" alt=\"Add " + uriParts[1] + " to Skype\"/>";
}
}
}
else if (uriParts[1] == 'aim') {
uriParts = uriParts[2].match('^(.*)\\?.*screenname=([^&]*)', 'i');
if (uriParts) {
linkContent = "<img src=\"chrome://foxri/content/aim_logo.gif\" alt=\"Chat with " + uriParts[2] + "\"/> Chat with " + uriParts[2];
}
}
- html_uris += "<a href=\""+u.nodeValue+"\">"
+ var linkhref = u.nodeValue;
+ var xrap = uu.getAttribute('append');
+ if(xrap=='qxri') {
+ linkhref += qxri.replace(/^xri:\/\//,'');
+ }else if(xrap!=null){
+ dump("Unhandled @append: "+xrap+"\n");
+ }
+ html_uris += "<a href=\""+linkhref+"\">"
+ linkContent + "</a>";
html_uris += "</div>";
}
var html = "<div class=\"service srv_" + getServiceClass(knownServiceType) + "\">\n";
html += html_types;
html += html_paths;
html += html_mediatypes;
if (html_uris) {
html += "<strong>URI(s):</strong><br/>\n";
html += html_uris;
}
@@ -383,25 +394,30 @@ function guessServiceTypeByMime(mimeType)
return "image";
}
return null;
}
function friendlyServiceName(srvType, uri)
{
if (srvType && srvType == "xri://+i-service*(+contact)*($v*1.0)") {
return "Contact Service";
}
- else if (srvType && srvType == "http://openid.net/signon/1.0") {
+ else if (srvType && (
+ srvType == "http://openid.net/signon/1.0"
+ || srvType == "http://openid.net/signon/1.1"
+ || srvType == "http://specs.openid.net/auth/2.0/signon"
+ || srcType == "http://specs.openid.net/auth/2.0/server"
+ ) ) {
return "OpenID Authentication Service";
}
else if (srvType && srvType == "xri://$res*auth*($v*2.0)") {
return "Authority Resolution Service";
}
else {
if (uri == null) {
return "Generic Service";
}
if (uri.match(/^https?:/i)) {
return "Web Link";
}