Wrote script to update ts files since the real one is broken

This commit is contained in:
2024-08-21 19:34:08 -04:00
parent bcf82a011f
commit e2decf8d6f
9 changed files with 423 additions and 116 deletions

View File

@@ -4,11 +4,11 @@
import requests
def check_nusget_updates(current_version: str, progress_callback=None) -> str | None:
def check_nusget_updates(app, current_version: str, progress_callback=None) -> str | None:
# Simple function to make a request to the GitHub API and then check if the latest available version is newer.
gh_api_request = requests.get(url="https://api.github.com/repos/NinjaCheetah/NUSGet/releases/latest", stream=True)
if gh_api_request.status_code != 200:
progress_callback.emit("\n\nCould not check for updates.")
progress_callback.emit(app.translate("MainWindow", "\n\nCould not check for updates."))
else:
api_response = gh_api_request.json()
new_version: str = api_response["tag_name"].replace('v', '')
@@ -16,7 +16,7 @@ def check_nusget_updates(current_version: str, progress_callback=None) -> str |
current_version_split = current_version.split('.')
for place in range(len(new_version_split)):
if new_version_split[place] > current_version_split[place]:
progress_callback.emit("\n\nThere's a newer version of NUSGet available!")
progress_callback.emit(app.translate("MainWindow", "\n\nThere's a newer version of NUSGet available!"))
return new_version
progress_callback.emit("\n\nYou're running the latest release of NUSGet.")
progress_callback.emit(app.translate("MainWindow", "\n\nYou're running the latest release of NUSGet."))
return None