From 42b48496dedf20d7dd43756efac4408e0a9c639f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 25 May 2022 14:19:01 +0200 Subject: [PATCH 1/2] HTML5: Always disable Asset Library GitHub doesn't allow CORS so we can't download assets from it. There'd also be more work needed for the Asset Library plugin to be usable in the Web editor even if that was supported. --- editor/editor_node.cpp | 4 ++++ editor/project_manager.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4998cc82e8a..c59c7de603c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -7025,11 +7025,15 @@ EditorNode::EditorNode() { ScriptTextEditor::register_editor(); // Register one for text scripts. TextEditor::register_editor(); + // Asset Library can't work on Web editor for now as most assets are sourced + // directly from GitHub which does not set CORS. +#ifndef JAVASCRIPT_ENABLED if (StreamPeerSSL::is_available()) { add_editor_plugin(memnew(AssetLibraryEditorPlugin)); } else { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } +#endif // Add interface before adding plugins. diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 3a6c47aa224..a56b6ec9d46 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2773,6 +2773,9 @@ ProjectManager::ProjectManager() { center_box->add_child(settings_hb); } + // Asset Library can't work on Web editor for now as most assets are sourced + // directly from GitHub which does not set CORS. +#ifndef JAVASCRIPT_ENABLED if (StreamPeerSSL::is_available()) { asset_library = memnew(EditorAssetLibrary(true)); asset_library->set_name(TTR("Asset Library Projects")); @@ -2781,6 +2784,7 @@ ProjectManager::ProjectManager() { } else { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } +#endif { // Dialogs From 3ff6d794c0aac0365f236cd078b5e5aeea0d996e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 25 May 2022 14:19:49 +0200 Subject: [PATCH 2/2] HTML5: Enable mbedTLS module for Crypto object Increases the size of the wasm by around 3% (~300-350 KiB). This enables using the Crypto object for hashing, signing and encryption, and therefore reduces the gap between the features of the HTML5 platform and other platforms. Closes https://github.com/godotengine/godot-proposals/issues/3574. --- doc/classes/Crypto.xml | 1 - doc/classes/CryptoKey.xml | 1 - doc/classes/HMACContext.xml | 1 - doc/classes/HashingContext.xml | 1 - doc/classes/X509Certificate.xml | 1 - platform/javascript/detect.py | 5 ----- 6 files changed, 10 deletions(-) diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index c0a76dc80e6..4936fc1d857 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -68,7 +68,6 @@ } [/csharp] [/codeblocks] - [b]Note:[/b] Not available in HTML5 exports. diff --git a/doc/classes/CryptoKey.xml b/doc/classes/CryptoKey.xml index b0abdf60c8f..8496c6dec15 100644 --- a/doc/classes/CryptoKey.xml +++ b/doc/classes/CryptoKey.xml @@ -6,7 +6,6 @@ The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other [Resource]. They can be used to generate a self-signed [X509Certificate] via [method Crypto.generate_self_signed_certificate] and as private key in [method StreamPeerSSL.accept_stream] along with the appropriate certificate. - [b]Note:[/b] Not available in HTML5 exports. diff --git a/doc/classes/HMACContext.xml b/doc/classes/HMACContext.xml index fa60a7eb584..f2b946cab7e 100644 --- a/doc/classes/HMACContext.xml +++ b/doc/classes/HMACContext.xml @@ -50,7 +50,6 @@ [/csharp] [/codeblocks] - [b]Note:[/b] Not available in HTML5 exports. diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index 9ecf2872f30..c126efcfbb9 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -57,7 +57,6 @@ } [/csharp] [/codeblocks] - [b]Note:[/b] Not available in HTML5 exports. diff --git a/doc/classes/X509Certificate.xml b/doc/classes/X509Certificate.xml index e5d8b45db69..581aba05e42 100644 --- a/doc/classes/X509Certificate.xml +++ b/doc/classes/X509Certificate.xml @@ -6,7 +6,6 @@ The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other [Resource]. They can be used as the server certificate in [method StreamPeerSSL.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to an SSL server via [method StreamPeerSSL.connect_to_stream]. - [b]Note:[/b] Not available in HTML5 exports. diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 709104c5eeb..4a9652fc1cf 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -48,11 +48,6 @@ def get_flags(): return [ ("tools", False), ("builtin_pcre2_with_jit", False), - # Disabling the mbedtls module reduces file size. - # The module has little use due to the limited networking functionality - # in this platform. For the available networking methods, the browser - # manages TLS. - ("module_mbedtls_enabled", False), ("vulkan", False), ]