Continuing work on updater info

This commit is contained in:
Jaap Marsman 2022-11-06 19:57:49 +08:00
parent e4a4304ea0
commit e6ede26223
3 changed files with 18 additions and 5 deletions

View File

@ -7,6 +7,8 @@ var check_time_var : int
var ddmmyyyy : String
var date
var csv_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/version_info.csv"
var update_text_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/updater/update_text.md"
var update_text : String
onready var date_time_display = $"%CurrentTime"
onready var global_ints = $"/root/GlobalInts"
@ -19,6 +21,7 @@ func check_for_updates():
if os_check == "X11" and "Windows" and "OSX":
print("We're on desktop. So let's check for updates!")
$"%HTTPRequest".request(csv_url)
$"%HTTPRequest2".request(update_text_url)
func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
var json = JSON.parse(body.get_string_from_utf8())
@ -26,9 +29,14 @@ func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
if global_ints.web_release_version > global_ints.release_version:
print("There's an update!")
$"%UpdatePanel".visible = true
# elif global_ints.web_release_version == global_ints.release_version:
# print("There is no update!")
$"%UpdateText".text = str(update_text)
func _on_HTTPRequest2_request_completed(_result, _response_code, _headers, body):
var json = JSON.parse(body.get_string_from_utf8())
update_text = str(json.result)
func refresh_descriptors():
$"%1Acronym".text = global_ints.one_acronym

View File

@ -69,6 +69,9 @@ __meta__ = {
[node name="HTTPRequest" type="HTTPRequest" parent="."]
unique_name_in_owner = true
[node name="HTTPRequest2" type="HTTPRequest" parent="."]
unique_name_in_owner = true
[node name="ClassroomPhoto" type="Sprite" parent="."]
position = Vector2( 639.9, 201.694 )
scale = Vector2( 0.665729, 0.665729 )
@ -638,6 +641,7 @@ text = "You are currently using version XX. The latest version available is XX.
autowrap = true
[node name="UpdateText" type="Label" parent="StartScreen/UpdatePanel"]
unique_name_in_owner = true
margin_left = 33.0
margin_top = 146.0
margin_right = 1249.0
@ -1269,6 +1273,7 @@ custom_fonts/font = SubResource( 12 )
text = "Item5"
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
[connection signal="request_completed" from="HTTPRequest2" to="." method="_on_HTTPRequest2_request_completed"]
[connection signal="button_down" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_button_down"]
[connection signal="pressed" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_pressed"]
[connection signal="pressed" from="StartScreen/InstructionPanel/MinuteBox/MinutePlus" to="." method="_on_MinutePlus_pressed"]

View File

@ -1,5 +1,5 @@
This text is just a placeholder.
"This text is just a placeholder.
- But I want to test if it works.
- Like this.
- Or this.
- Or this."