]> code.citadel.org Git - citadel.git/commitdiff
Display an alert if we cannot connect to Citadel Server, instead of leaving the user...
authorArt Cancro <ajc@citadel.org>
Thu, 9 Dec 2021 23:20:36 +0000 (18:20 -0500)
committerArt Cancro <ajc@citadel.org>
Thu, 9 Dec 2021 23:20:36 +0000 (18:20 -0500)
webcit-ng/static/js/main.js

index 9fb998a3df9e50f4619466bd905492fac3c0ae97..10e953a60e8a36b64a59ef750e06fe759c0750e6 100644 (file)
@@ -87,11 +87,11 @@ function escapeJS(text) {
 //
 ctdl_startup = async() => {
        response = await fetch("/ctdl/c/info");
-       serv_info = await(response.json());
 
        if (response.ok) {
+               serv_info = await(response.json());
                if (serv_info.serv_rev_level < 905) {
-                       alert("Citadel server is too old, some functions may not work");
+                       alert(_("Citadel server is too old, some functions may not work"));
                }
 
                update_banner();
@@ -100,6 +100,12 @@ ctdl_startup = async() => {
                gotoroom("_BASEROOM_");
                display_room_list();
        }
+       else {
+               document.getElementById("ctdl-main").innerHTML =
+                       "<div class=\"w3-panel w3-red\"><p>"
+                       + _("This program was unable to connect or stay connected to the Citadel server.  Please report this problem to your system administrator.")
+                       + "</div>";
+       }
 }