[js-embedded-discovery] 02/02: EDS-97 Support multiple JSON feeds

Rod Widdowson rdw at steadingsoftware.com
Mon Jun 9 18:40:06 UTC 2025


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository js-embedded-discovery.

View the commit online:
http://git.shibboleth.net/view/?p=js-embedded-discovery.git;a=commit;h=571a72f5083955999b2b6573396f5a6820a53197

commit 571a72f5083955999b2b6573396f5a6820a53197
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jun 9 19:32:25 2025 +0100

    EDS-97 Support multiple JSON feeds
    
    https://shibboleth.atlassian.net/browse/EDS-97
---
 src/javascript/idpselect.js        | 31 +++++++++++++++++++++++--------
 src/javascript/idpselect_config.js |  2 +-
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/javascript/idpselect.js b/src/javascript/idpselect.js
index 80e9071..728522e 100644
--- a/src/javascript/idpselect.js
+++ b/src/javascript/idpselect.js
@@ -120,8 +120,23 @@ function IdPSelectUI() {
             }
         }
 
-        if (!load(parms.dataSource)) {
+        if (parms.dataSource != null) {
+            idpData = load(parms.dataSource);
+            if (idpData == null) {
+                return;
+            }
+        } else if (parms.dataSources == null || !Array.isArray(parms.dataSources)) {
+            fatal(getLocalizedMessage('fatal.loadFailed') + parms.dataSources);
             return;
+        } else {
+            idpData = [];
+            for (i = 0; i < parms.dataSources.length; i++) {
+                next = load(parms.dataSources[i]);
+                if (next == null) {
+                    return;
+                }
+                idpData = idpData.concat(next);
+            }
         }
         deDupe();
         stripHidden(parms.hiddenIdPs);
@@ -567,7 +582,7 @@ function IdPSelectUI() {
         }
         if (null == xhr) {
             fatal(getLocalizedMessage('fatal.noXMLHttpRequest'));
-            return false;
+            return null;
         }
 
         if (isIE()) {
@@ -594,20 +609,20 @@ function IdPSelectUI() {
             var jsonData = xhr.responseText;
             if(jsonData === null){
                 fatal(getLocalizedMessage('fatal.noData'));
-                return false;
+                return null;
             }
 
             //
             // Parse it
             //
 
-            idpData = JSON.parse(jsonData);
+            return JSON.parse(jsonData);
 
         }else{
             fatal(getLocalizedMessage('fatal.loadFailed') + dataSource);
-            return false;
+            return null;
         }
-        return true;
+
     };
 
     /**
@@ -1139,13 +1154,13 @@ function IdPSelectUI() {
     */
 
     var buildHelpText = function(containerDiv) {
-	if (helpURL != null) {
+        if (helpURL != null) {
             var aval = document.createElement('a');
             aval.href = helpURL;
             aval.appendChild(document.createTextNode(getLocalizedMessage('helpText')));
             setClass(aval, 'HelpButton');
             containerDiv.appendChild(aval);
-	}
+        }
     } ;
     
     /**
diff --git a/src/javascript/idpselect_config.js b/src/javascript/idpselect_config.js
index e69ee7c..09fecfd 100644
--- a/src/javascript/idpselect_config.js
+++ b/src/javascript/idpselect_config.js
@@ -4,7 +4,7 @@ function IdPSelectUIParms(){
     // Adjust the following to fit into your local configuration
     //
     this.alwaysShow = true;          // If true, this will show results as soon as you start typing
-    this.dataSource = '/Shibboleth.sso/DiscoFeed';   // Where to get the data from
+    this.dataSources = ['/Shibboleth.sso/DiscoFeed'];   // Where to get the data from (in an array)
     this.defaultLanguage = 'en';     // Language to use if the browser local doesnt have a bundle
     this.selectedLanguage = null;    // Set this to override the browser default (for instance if you can
                                      // detect this from the URL.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list