[KiRi] Added check for local file system fail

We then explain why is failing
This commit is contained in:
Salvador E. Tropea 2024-01-30 13:48:42 -03:00
parent cdad14bd36
commit 0a121cf5a1
3 changed files with 20 additions and 2 deletions

View File

@ -16,6 +16,10 @@
<span>Server is offline, waiting ...</span>
</div>
<div id="no_file_access" style="display: none; ">
<span>The browser can't read local files. Enable it to continue. I.e. use <i>--allow-file-access-from-files</i> on Chrome</span>
</div>
<!-- User Interface -->
<div id="main_ui" class="container fill no-gutters ui-style">
<div class="row fill align-items-start no-gutters ui-row-style">

View File

@ -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;

View File

@ -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)