Compare commits

..

5 Commits

Author SHA1 Message Date
notdraimdev c0b1bf0efb better update checker commit 2 2024-09-30 13:47:40 +02:00
notdraimdev 35acc4725b Better update checker 2024-09-30 13:47:40 +02:00
notdraimdev 13acb8002c dsew 2024-09-30 13:47:40 +02:00
Bucket Of Chicken 0564e0bd26 Version checker
Version checker
2024-09-25 20:33:03 +02:00
notdraimdev 75061166ee Version checker 2024-09-25 20:31:17 +02:00
5 changed files with 183 additions and 5 deletions
+14
View File
@@ -0,0 +1,14 @@
extends ColorRect
@onready var StandardColor = color
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if get_parent().is_hovered():
color = StandardColor.lightened(0.3)
else:
color = StandardColor
+109 -3
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=59 format=3 uid="uid://b2sygl55s6fng"]
[gd_scene load_steps=62 format=3 uid="uid://b2sygl55s6fng"]
[ext_resource type="Script" path="res://main.gd" id="1_ubs1p"]
[ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"]
@@ -29,6 +29,9 @@
[ext_resource type="Texture2D" uid="uid://1rstn6r2wisy" path="res://X.png" id="14_mioc4"]
[ext_resource type="Script" path="res://Spinning.gd" id="14_rhw4k"]
[ext_resource type="Script" path="res://yt_tab_button.gd" id="16_2t15p"]
[ext_resource type="Script" path="res://update_checker.gd" id="30_byc5i"]
[ext_resource type="Script" path="res://patch_notes_button.gd" id="31_hjsj1"]
[ext_resource type="Script" path="res://CustomButtonColor.gd" id="32_pwgec"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ku7tv"]
shader = ExtResource("10_20857")
@@ -818,7 +821,7 @@ offset_left = -64.0
offset_top = -23.0
grow_horizontal = 0
grow_vertical = 0
text = "v1.3.2"
text = "v1.3.3"
horizontal_alignment = 2
[node name="WavDisclaimer" type="AcceptDialog" parent="."]
@@ -834,12 +837,112 @@ dialog_text = "wav files are not supported yet"
[node name="PlaylistOrSong" type="ConfirmationDialog" parent="."]
initial_position = 2
size = Vector2i(473, 106)
visible = true
ok_button_text = "Download Playlist"
dialog_text = "Do you want to download the song or the Entire playlist?"
dialog_autowrap = true
cancel_button_text = "Download Song"
[node name="UpdateChecker" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -40.0
offset_top = -40.0
grow_horizontal = 0
grow_vertical = 0
script = ExtResource("30_byc5i")
[node name="HTTPRequest" type="HTTPRequest" parent="UpdateChecker"]
timeout = 5.0
[node name="ColorRect" type="ColorRect" parent="UpdateChecker"]
layout_mode = 0
offset_left = -214.0
offset_top = -144.0
offset_right = -24.0
offset_bottom = -44.0
color = Color(0.14902, 0.14902, 0.14902, 1)
[node name="Label" type="Label" parent="UpdateChecker/ColorRect"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -68.0
offset_right = 68.0
offset_bottom = 23.0
grow_horizontal = 2
text = "Update Available!"
[node name="PatchNotesButton" type="Button" parent="UpdateChecker/ColorRect"]
z_index = 4
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -24.0
offset_bottom = 12.0
grow_horizontal = 2
grow_vertical = 2
text = "View patch notes"
flat = true
script = ExtResource("31_hjsj1")
[node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/PatchNotesButton"]
z_index = -1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0.19706, 0.279877, 0.326012, 1)
script = ExtResource("32_pwgec")
[node name="LinkButton" type="Button" parent="UpdateChecker/ColorRect"]
z_index = 1
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -38.0
grow_horizontal = 2
grow_vertical = 0
text = "Update"
flat = true
[node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/LinkButton"]
z_index = -1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0.264012, 0.463229, 0.504783, 1)
script = ExtResource("32_pwgec")
[node name="CloseBuen" type="Button" parent="UpdateChecker/ColorRect"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -72.0
offset_bottom = 72.0
grow_horizontal = 0
scale = Vector2(0.25, 0.25)
pivot_offset = Vector2(72, 0)
icon = ExtResource("14_mioc4")
flat = true
[connection signal="toggled" from="SelectPlaylist" to="SelectPlaylist" method="_on_toggled"]
[connection signal="pressed" from="PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/CreatePlaylist" to="PlaylistsPanel" method="_on_create_playlist_pressed"]
[connection signal="toggled" from="PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/PlayAll" to="PlaylistsPanel" method="_on_play_all_toggled"]
@@ -854,3 +957,6 @@ cancel_button_text = "Download Song"
[connection signal="index_pressed" from="SearchResults" to="SearchBar" method="_on_search_results_index_pressed"]
[connection signal="toggled" from="VolumeButton" to="VolumeButton" method="_on_toggled"]
[connection signal="toggled" from="YtTabButton" to="YtTabButton" method="_on_toggled"]
[connection signal="request_completed" from="UpdateChecker/HTTPRequest" to="UpdateChecker" method="_on_http_request_completed"]
[connection signal="pressed" from="UpdateChecker/ColorRect/LinkButton" to="UpdateChecker" method="_on_link_button_pressed"]
[connection signal="pressed" from="UpdateChecker/ColorRect/CloseBuen" to="UpdateChecker" method="_on_close_buen_pressed"]
+2 -2
View File
@@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
[sub_resource type="Image" id="Image_nigg1"]
[sub_resource type="Image" id="Image_x7sdv"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
"format": "RGBA8",
@@ -19,7 +19,7 @@ data = {
}
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
image = SubResource("Image_nigg1")
image = SubResource("Image_x7sdv")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
+4
View File
@@ -0,0 +1,4 @@
extends Button
func _pressed() -> void:
OS.shell_open("https://notdraimdev.github.io/SimplSite/notes.html")
+54
View File
@@ -0,0 +1,54 @@
extends Control
@onready var Parent:MainScene = get_tree().root.get_child(2)
@onready var animation_player := $AnimationPlayer as AnimationPlayer
@onready var version: Label = $"../Version"
@onready var update_button := $Update as Button
@onready var http_request := $HTTPRequest as HTTPRequest
@onready var link_button: Button = $ColorRect/LinkButton
var CheckForUpdates:bool = true
var updateLink:String
# Only update once every UPDATE_THROTTLE seconds at most
# The GitHub releases API only allows 60 unauthenticated requests per hour,
# so this value should be kept relatively high
const UPDATE_THROTTLE = 600
func _ready() -> void:
if CheckForUpdates:
check_for_updates()
func check_for_updates() -> void:
print("! INFO: Checking for updates…")
var error := http_request.request(
"https://api.github.com/repos/notdraimdev/Simplaudio/releases/latest"
)
if error != OK:
push_error("! a client error occurred")
func _on_http_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
if result != HTTPRequest.RESULT_SUCCESS:
# The request failed for any reason, abort
push_error("! Couldn't check for updates")
return
else:
print("! Update check successful")
var json = JSON.new()
var result2 = json.parse_string(str(body.get_string_from_utf8()))
print("! AHHH " + str(result2))
if result2["tag_name"] != version.text:
show()
updateLink = result2["html_url"]
func _on_close_buen_pressed() -> void:
hide()
func _on_link_button_pressed() -> void:
OS.shell_open(updateLink)