-rwxr-xr-x | src/components/xriProtocolHandler.js | 28 |
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 | |||
@@ -44,16 +44,19 @@ const XP_UNORDERED_NODE_SNAPSHOT_TYPE = 6; | |||
44 | const XP_ORDERED_NODE_SNAPSHOT_TYPE = 7; | 44 | const XP_ORDERED_NODE_SNAPSHOT_TYPE = 7; |
45 | const XP_ANY_UNORDERED_NODE_TYPE = 8; | 45 | const XP_ANY_UNORDERED_NODE_TYPE = 8; |
46 | const XP_FIRST_ORDERED_NODE_TYPE = 9; | 46 | const XP_FIRST_ORDERED_NODE_TYPE = 9; |
47 | 47 | ||
48 | 48 | ||
49 | var SERVICE_CLASSES = { | 49 | var SERVICE_CLASSES = { |
50 | 'xri://+i-service*(+contact)*($v*1.0)': 'i-contact', | 50 | 'xri://+i-service*(+contact)*($v*1.0)': 'i-contact', |
51 | 'http://openid.net/signon/1.0': 'openid', | 51 | 'http://openid.net/signon/1.0': 'openid', |
52 | 'http://openid.net/signon/1.1': 'openid', | ||
53 | 'http://specs.openid.net/auth/2.0/signon': 'openid', | ||
54 | 'http://specs.openid.net/auth/2.0/server': 'openid', | ||
52 | 'xri://$res*auth*($v*2.0)': 'res-auth', | 55 | 'xri://$res*auth*($v*2.0)': 'res-auth', |
53 | 'xri://+i-service*(+authn)*(+saml)*($v*1.0)': 'authn-saml', | 56 | 'xri://+i-service*(+authn)*(+saml)*($v*1.0)': 'authn-saml', |
54 | 'xri://+i-service*(+metadata)*(+saml)*($v*1.0)' : 'metadata-saml', | 57 | 'xri://+i-service*(+metadata)*(+saml)*($v*1.0)' : 'metadata-saml', |
55 | 'xri://+i-service*(+forwarding)*($v*1.0)': 'i-forwarding' | 58 | 'xri://+i-service*(+forwarding)*($v*1.0)': 'i-forwarding' |
56 | }; | 59 | }; |
57 | 60 | ||
58 | 61 | ||
59 | const HTML_HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\ | 62 | const HTML_HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\ |
@@ -232,20 +235,21 @@ function renderService(srv, doc, qxri) | |||
232 | 235 | ||
233 | mediaTypes.push(m.nodeValue); | 236 | mediaTypes.push(m.nodeValue); |
234 | if (m.nodeValue) { | 237 | if (m.nodeValue) { |
235 | html_mediatypes += "<strong>Media Type:</strong> " + m.nodeValue + "<br/>"; | 238 | html_mediatypes += "<strong>Media Type:</strong> " + m.nodeValue + "<br/>"; |
236 | } | 239 | } |
237 | } | 240 | } |
238 | 241 | ||
239 | 242 | ||
240 | res = runExpr(doc, srv, "xrd:URI/text()"); | 243 | res = runExpr(doc, srv, "xrd:URI"); |
241 | var u; | 244 | var uu; |
242 | while (u = res.iterateNext()) { | 245 | while (uu = res.iterateNext()) { |
243 | if (!u.nodeValue) | 246 | var u = uu.firstChild; |
247 | if (!(u.nodeValue && u.nodeType==3)) | ||
244 | continue; | 248 | continue; |
245 | 249 | ||
246 | var srvType = guessServiceTypeByURI(u.nodeValue); | 250 | var srvType = guessServiceTypeByURI(u.nodeValue); |
247 | if (!knownServiceType) { | 251 | if (!knownServiceType) { |
248 | knownServiceType = srvType; | 252 | knownServiceType = srvType; |
249 | } | 253 | } |
250 | 254 | ||
251 | html_uris += "<div class=\"" + getServiceClass(srvType) + "\">"; | 255 | html_uris += "<div class=\"" + getServiceClass(srvType) + "\">"; |
@@ -280,17 +284,24 @@ function renderService(srv, doc, qxri) | |||
280 | } | 284 | } |
281 | else if (uriParts[1] == 'aim') { | 285 | else if (uriParts[1] == 'aim') { |
282 | uriParts = uriParts[2].match('^(.*)\\?.*screenname=([^&]*)', 'i'); | 286 | uriParts = uriParts[2].match('^(.*)\\?.*screenname=([^&]*)', 'i'); |
283 | if (uriParts) { | 287 | if (uriParts) { |
284 | linkContent = "<img src=\"chrome://foxri/content/aim_logo.gif\" alt=\"Chat with " + uriParts[2] + "\"/> Chat with " + uriParts[2]; | 288 | linkContent = "<img src=\"chrome://foxri/content/aim_logo.gif\" alt=\"Chat with " + uriParts[2] + "\"/> Chat with " + uriParts[2]; |
285 | } | 289 | } |
286 | } | 290 | } |
287 | 291 | ||
288 | html_uris += "<a href=\""+u.nodeValue+"\">" | 292 | var linkhref = u.nodeValue; |
293 | var xrap = uu.getAttribute('append'); | ||
294 | if(xrap=='qxri') { | ||
295 | linkhref += qxri.replace(/^xri:\/\//,''); | ||
296 | }else if(xrap!=null){ | ||
297 | dump("Unhandled @append: "+xrap+"\n"); | ||
298 | } | ||
299 | html_uris += "<a href=\""+linkhref+"\">" | ||
289 | + linkContent + "</a>"; | 300 | + linkContent + "</a>"; |
290 | html_uris += "</div>"; | 301 | html_uris += "</div>"; |
291 | } | 302 | } |
292 | 303 | ||
293 | var html = "<div class=\"service srv_" + getServiceClass(knownServiceType) + "\">\n"; | 304 | var html = "<div class=\"service srv_" + getServiceClass(knownServiceType) + "\">\n"; |
294 | html += html_types; | 305 | html += html_types; |
295 | html += html_paths; | 306 | html += html_paths; |
296 | html += html_mediatypes; | 307 | html += html_mediatypes; |
@@ -387,17 +398,22 @@ function guessServiceTypeByMime(mimeType) | |||
387 | 398 | ||
388 | 399 | ||
389 | 400 | ||
390 | function friendlyServiceName(srvType, uri) | 401 | function friendlyServiceName(srvType, uri) |
391 | { | 402 | { |
392 | if (srvType && srvType == "xri://+i-service*(+contact)*($v*1.0)") { | 403 | if (srvType && srvType == "xri://+i-service*(+contact)*($v*1.0)") { |
393 | return "Contact Service"; | 404 | return "Contact Service"; |
394 | } | 405 | } |
395 | else if (srvType && srvType == "http://openid.net/signon/1.0") { | 406 | else if (srvType && ( |
407 | srvType == "http://openid.net/signon/1.0" | ||
408 | || srvType == "http://openid.net/signon/1.1" | ||
409 | || srvType == "http://specs.openid.net/auth/2.0/signon" | ||
410 | || srcType == "http://specs.openid.net/auth/2.0/server" | ||
411 | ) ) { | ||
396 | return "OpenID Authentication Service"; | 412 | return "OpenID Authentication Service"; |
397 | } | 413 | } |
398 | else if (srvType && srvType == "xri://$res*auth*($v*2.0)") { | 414 | else if (srvType && srvType == "xri://$res*auth*($v*2.0)") { |
399 | return "Authority Resolution Service"; | 415 | return "Authority Resolution Service"; |
400 | } | 416 | } |
401 | else { | 417 | else { |
402 | if (uri == null) { | 418 | if (uri == null) { |
403 | return "Generic Service"; | 419 | return "Generic Service"; |