From f2b354caa90b2dc4f0e5d8cd172ff8e49744652f Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 31 May 2018 00:15:52 -0400 Subject: [PATCH] Fix update failing when IPv6 available Use a new subdomain ipv4.cosinegaming.com, which contains the same IP but only IPv4, so that godot will not try to use IPv6, which it cannot do (it fails Error #2). See https://github.com/godotengine/godot/issues/18275 for details on that godot bug. --- scenes/update.tscn | 1 + scripts/update.gd | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scenes/update.tscn b/scenes/update.tscn index 1e887f4..cf9159b 100644 --- a/scenes/update.tscn +++ b/scenes/update.tscn @@ -30,6 +30,7 @@ use_threads = false body_size_limit = -1 max_redirects = 8 script = ExtResource( 1 ) +domain = "http://ipv4.cosinegaming.com" [node name="ProgressBar" type="ProgressBar" parent="." index="1"] diff --git a/scripts/update.gd b/scripts/update.gd index 32dc729..ae839f3 100644 --- a/scripts/update.gd +++ b/scripts/update.gd @@ -3,11 +3,12 @@ extends HTTPRequest var is_update_payload = false var save_to var time = 0 +export var domain = "http://ipv4.cosinegaming.com" func _ready(): connect("request_completed", self, "_request_completed") # Check if we need an update - request("https://www.cosinegaming.com/static/vanagloria/version.json", [], false) + request(domain + "/static/vanagloria/version.json", [], false) set_process(true) func _request_completed(result, response_code, headers, body): @@ -27,7 +28,7 @@ func _request_completed(result, response_code, headers, body): save_to = server.save_location use_threads = true print("Need to update! Downloading " + server.download_path) - request(server.download_path) + request(domain + server.download_path) else: print("Update recieved. Saving to " + save_to) var file = File.new() @@ -39,7 +40,9 @@ func _request_completed(result, response_code, headers, body): func _process(delta): time += delta var fake_progress = 1 - (0.8 / time) - get_node("../ProgressBar").value = 100*fake_progress + # var progress = get_downloaded_bytes() / get_body_size() + var progress = fake_progress + get_node("../ProgressBar").value = 100*progress func restart(): # Pass on args to new instance, then quit