summaryrefslogtreecommitdiff
path: root/editor/export_template_manager.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-11-05 11:49:02 +0100
committerGitHub <noreply@github.com>2017-11-05 11:49:02 +0100
commit3149ef084b9aaae33d74cfb28592ed95726fb88d (patch)
tree5c3acac4fa142f1739f005ef9c474933298b1340 /editor/export_template_manager.cpp
parente5c3e3bf132622b86b554162652d074e8a4d6dde (diff)
parent40acb850c08354163a612c1f816e59c4bd524822 (diff)
Merge pull request #12639 from bojidar-bg/x-add-rest-template-listing
Change URL of the mirror list
Diffstat (limited to 'editor/export_template_manager.cpp')
-rw-r--r--editor/export_template_manager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 164d02c580..8641fc7667 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -127,7 +127,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
template_list_state->set_text(TTR("Retrieving mirrors, please wait.."));
template_download_progress->set_max(100);
template_download_progress->set_value(0);
- request_mirror->request("https://www.godotengine.org/download_mirrors.php?version=" + p_version);
+ request_mirror->request("https://godotengine.org/mirrorlist/" + p_version + ".json");
template_list_state->show();
template_download_progress->show();
}
@@ -319,8 +319,16 @@ void ExportTemplateManager::ok_pressed() {
void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
- print_line("mirror complete");
- String mirror_str = "{ \"mirrors\":[{\"name\":\"Official\",\"url\":\"http://op.godotengine.org:81/downloads/2.1.4/Godot_v2.1.4-stable_linux_server.64.zip\"}] }";
+ if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) {
+ EditorNode::get_singleton()->show_warning("Error getting the list of mirrors.");
+ return;
+ }
+
+ String mirror_str;
+ {
+ PoolByteArray::Read r = p_data.read();
+ mirror_str.parse_utf8((const char *)r.ptr(), p_data.size());
+ }
template_list_state->hide();
template_download_progress->hide();
@@ -330,7 +338,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
int errline;
Error err = JSON::parse(mirror_str, r, errs, errline);
if (err != OK) {
- EditorNode::get_singleton()->show_warning("Error parsing JSON with mirror list. Please report this issue!");
+ EditorNode::get_singleton()->show_warning("Error parsing JSON of mirror list. Please report this issue!");
return;
}