From 0a121cf5a1a5a7e66b2035448fa7646ceb66c013 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 30 Jan 2024 13:48:42 -0300 Subject: [PATCH] [KiRi] Added check for local file system fail We then explain why is failing --- kibot/resources/kiri/index.html | 4 ++++ kibot/resources/kiri/kiri.css | 4 ++-- kibot/resources/kiri/kiri.js | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/kibot/resources/kiri/index.html b/kibot/resources/kiri/index.html index 4f19aaf8..91c4e114 100644 --- a/kibot/resources/kiri/index.html +++ b/kibot/resources/kiri/index.html @@ -16,6 +16,10 @@ Server is offline, waiting ... + +
diff --git a/kibot/resources/kiri/kiri.css b/kibot/resources/kiri/kiri.css index 8581832f..524269c1 100644 --- a/kibot/resources/kiri/kiri.css +++ b/kibot/resources/kiri/kiri.css @@ -194,7 +194,7 @@ label#layers, label#pages { vertical-align:top; } -#server_offline { +#server_offline, #no_file_access { position: fixed; display: none; width: 100%; @@ -213,7 +213,7 @@ label#layers, label#pages { line-height: 100%; } -#server_offline span { +#server_offline, #no_file_access span { display: inline-block; vertical-align: middle; line-height: normal; diff --git a/kibot/resources/kiri/kiri.js b/kibot/resources/kiri/kiri.js index af9dc9cb..35257dc4 100644 --- a/kibot/resources/kiri/kiri.js +++ b/kibot/resources/kiri/kiri.js @@ -1040,6 +1040,15 @@ var old_server_status = -1; function check_server_status() { + try { + loadFile("project"); + } catch(error) { + if (window.location.protocol === "file:") { + no_file_access(); + } + throw(error); + } + var img; img = document.getElementById("server_status_img"); @@ -1081,6 +1090,11 @@ function server_is_offline() { } } +function no_file_access() { + document.getElementById("no_file_access").style.display = "block"; + console.log("Failed to load local files, enable access to them"); +} + // ================================================================== function createNewEmbed(src1, src2)