summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-17 11:33:53 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-17 11:33:53 +0200
commit51484028fd352340b02d53c3aa7c6dd5e49ddd84 (patch)
tree1d74e30300beb4f435b406cec7a5278921a45226
parent6bbde346ab1ab9235754c1bec083a9d99616e1a0 (diff)
[Web] Add missing features warning in editor and export shell.
-rw-r--r--misc/dist/html/editor.html35
-rw-r--r--misc/dist/html/full-size.html6
2 files changed, 19 insertions, 22 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index 7c44dd45a1..ac00270d50 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -259,31 +259,20 @@
>Web editor documentation</a> for usage instructions and limitations.
</p>
</div>
- <div id="welcome-modal-description-no-cross-origin-isolation" style="display: none">
+ <div id="welcome-modal-missing-description" style="display: none">
<p>
- The web server does not support cross-origin isolation,
- which is required for the Godot Web Editor to function.
- </p>
- <p>
- <strong>Reasons for cross-origin isolation being disabled:</strong>
- <ul>
- <li id="welcome-modal-reason-not-secure">
- This page is not served from a secure context (HTTPS <i>or</i> localhost).
- </li>
- <li>
- This page may not be served with cross-origin isolation headers
- (check with the developer tools' Network tab).
- </li>
+ <strong>The following features required by the Godot Web Editor are missing:</strong>
+ <ul id="welcome-modal-missing-list">
</ul>
</p>
<p>
If you are self-hosting the web editor,
refer to
<a
- href="https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html#threads"
+ href="https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html"
target="_blank"
rel="noopener"
- >Exporting for the Web - Threads</a> for more information.
+ >Exporting for the Web</a> for more information.
</p>
</div>
<div style="text-align: center">
@@ -394,16 +383,22 @@
});
}
- if (!crossOriginIsolated) {
+ const missing = Engine.getMissingFeatures();
+ if (missing.length) {
// Display error dialog as threading support is required for the editor.
setButtonEnabled('startButton', false);
document.getElementById("welcome-modal-description").style.display = "none";
- document.getElementById("welcome-modal-description-no-cross-origin-isolation").style.display = "block";
+ document.getElementById("welcome-modal-missing-description").style.display = "block";
document.getElementById("welcome-modal-dismiss").style.display = "none";
- document.getElementById("welcome-modal-reason-not-secure").style.display = window.isSecureContext ? "none" : "list-item";
+ const list = document.getElementById("welcome-modal-missing-list");
+ for (let i = 0; i < missing.length; i++) {
+ const node = document.createElement("li");
+ node.innerText = missing[i];
+ list.appendChild(node);
+ }
}
- if (!crossOriginIsolated || localStorage.getItem("welcomeModalDismissed") !== 'true') {
+ if (missing.length || localStorage.getItem("welcomeModalDismissed") !== 'true') {
document.getElementById("welcome-modal").style.display = "block";
document.getElementById("welcome-modal-dismiss").focus();
}
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html
index f385b82f1d..d5b0050cfd 100644
--- a/misc/dist/html/full-size.html
+++ b/misc/dist/html/full-size.html
@@ -215,8 +215,10 @@ $GODOT_HEAD_INCLUDE
initializing = false;
};
- if (!Engine.isWebGLAvailable()) {
- displayFailureNotice('WebGL not available');
+ const missing = Engine.getMissingFeatures();
+ if (missing.length !== 0) {
+ const missingMsg = 'Warning!\nThe following features required to run Godot projects on the Web are missing:\n';
+ displayFailureNotice(missingMsg + missing.join("\n"));
} else {
setStatusMode('indeterminate');
engine.startGame({