diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-12-16 10:06:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 10:06:14 +0100 |
commit | 75ed3d74e81b26dc07dba39982429e6d2ce00628 (patch) | |
tree | b27b0260501b741067dc55e6768435025b07285f /editor | |
parent | edd3ca45016a4ee8cc5f7c1108e1c71bfa2a86ab (diff) | |
parent | 5912dd296487242b528836efc9dd045356ec3593 (diff) |
Merge pull request #55747 from timothyqiu/editor-proxy
Add proxy support for the editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/export_template_manager.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index d9613687f1..7ae7195deb 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -147,6 +147,11 @@ void ExportTemplateManager::_download_template(const String &p_url, bool p_skip_ download_templates->set_download_file(EditorPaths::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz")); download_templates->set_use_threads(true); + const String proxy_host = EDITOR_DEF("network/http_proxy/host", ""); + const int proxy_port = EDITOR_DEF("network/http_proxy/port", -1); + download_templates->set_http_proxy(proxy_host, proxy_port); + download_templates->set_https_proxy(proxy_host, proxy_port); + Error err = download_templates->request(p_url); if (err != OK) { _set_current_progress_status(TTR("Error requesting URL:") + " " + p_url, true); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 951af92467..994e89d96f 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -39,6 +39,15 @@ #include "editor/editor_settings.h" #include "editor/project_settings_editor.h" +static inline void setup_http_request(HTTPRequest *request) { + request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + + const String proxy_host = EDITOR_DEF("network/http_proxy/host", ""); + const int proxy_port = EDITOR_DEF("network/http_proxy/port", -1); + request->set_http_proxy(proxy_host, proxy_port); + request->set_https_proxy(proxy_host, proxy_port); +} + void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost) { title->set_text(p_title); asset_id = p_asset_id; @@ -534,7 +543,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { download = memnew(HTTPRequest); add_child(download); download->connect("request_completed", callable_mp(this, &EditorAssetLibraryItemDownload::_http_download_completed)); - download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + setup_http_request(download); download_error = memnew(AcceptDialog); add_child(download_error); @@ -869,7 +878,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag iq.image_index = p_image_index; iq.image_type = p_type; iq.request = memnew(HTTPRequest); - iq.request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + setup_http_request(iq.request); iq.target = p_for; iq.queue_id = ++last_queue_id; @@ -1476,7 +1485,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { request = memnew(HTTPRequest); add_child(request); - request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + setup_http_request(request); request->connect("request_completed", callable_mp(this, &EditorAssetLibrary::_http_request_completed)); last_queue_id = 0; |