]> _ Git - fluidbook-html5.git/commitdiff
wip #7179 @4.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Nov 2024 15:35:17 +0000 (16:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Nov 2024 15:35:17 +0000 (16:35 +0100)
js/libs/fluidbook/fluidbook.loader.js

index 3d26a7c5e97d12b0fcfad5b8d089733a4e8fe7bd..61af6fce1f62c3ec5f694fc5ec4cd0375583a026 100644 (file)
@@ -36,8 +36,17 @@ FluidbookLoader.prototype = {
                 $this.fluidbook.cache.set('_loadbalancingServerURL', $this._loadbalancingServerURL);
             }, 15000);
 
-            $.ajax("https://toolbox.fluidbook.com/lb.json").done(function (data) {
-                $this.loadbalancing = data;
+            $.ajax("https://toolbox.fluidbook.com/lbw.json").done(function (data) {
+                $this.loadbalancing = [];
+                $.each(data, function (i, server) {
+                    $.ajax('https://' + server.h + '/status.txt', {dataType: 'text'}).done(function (data) {
+                        if (data == '1') {
+                            for (let i = 0; i < server.w; i++) {
+                                $this.loadbalancing.push(server.h);
+                            }
+                        }
+                    });
+                });
                 $this.loadShades(callback);
             }).fail(function () {
                 $this.loadbalancing = false;
@@ -897,7 +906,7 @@ FluidbookLoader.prototype = {
     },
 
     getURL(url) {
-        if (!this.loadbalancing || this.checkExcludedFromLoadBalancing(url)) {
+        if (!this.loadbalancing || this.loadbalancing.length === 0 || this.checkExcludedFromLoadBalancing(url)) {
             return url;
         }