forked from NinjaCheetah/NUSGet
Fix automatic update check
Also updated copyright dates to 2024-2026!
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# "modules/config.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/core.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import requests
|
||||
from dataclasses import dataclass
|
||||
@@ -69,9 +69,11 @@ def fixup_qmenu_background(menu):
|
||||
|
||||
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.
|
||||
print("checking for updates...")
|
||||
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(app.translate("MainWindow", "\n\nCould not check for updates."))
|
||||
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nCould not check for updates."))
|
||||
print(f"update check failed, status code: {gh_api_request.status_code}")
|
||||
else:
|
||||
api_response = gh_api_request.json()
|
||||
new_version: str = api_response["tag_name"].replace('v', '')
|
||||
@@ -79,9 +81,13 @@ def check_nusget_updates(app, current_version: str, progress_callback=None) -> s
|
||||
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(-1, -1, "\n\nYou're running a development version of NUSGet.")
|
||||
print("no update available, this is a development version")
|
||||
return None
|
||||
elif new_version_split[place] > current_version_split[place]:
|
||||
progress_callback.emit(app.translate("MainWindow", "\n\nThere's a newer version of NUSGet available!"))
|
||||
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nThere's a newer version of NUSGet available!"))
|
||||
print("update available")
|
||||
return new_version
|
||||
progress_callback.emit(app.translate("MainWindow", "\n\nYou're running the latest release of NUSGet."))
|
||||
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nYou're running the latest release of NUSGet."))
|
||||
print("no update available")
|
||||
return None
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/download_batch.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import pathlib
|
||||
from typing import List
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/download_dsi.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import pathlib
|
||||
|
||||
@@ -76,11 +76,11 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
|
||||
content = libTWLPy.download_content(tid, title.tmd.content_record.content_id)
|
||||
progress_callback.emit(-1, -1, " - Done!")
|
||||
# If keep encrypted contents is on, write out the content after its downloaded.
|
||||
if keep_enc_chkbox is True:
|
||||
if keep_enc_chkbox:
|
||||
version_dir.joinpath(content_file_name).write_bytes(content)
|
||||
title.content.content = content
|
||||
# If decrypt local contents is still true, decrypt the content and write out the decrypted file.
|
||||
if decrypt_contents_enabled is True:
|
||||
if decrypt_contents_enabled:
|
||||
try:
|
||||
progress_callback.emit(-1, -1, f" - Decrypting content (Content ID: {title.tmd.content_record.content_id})...")
|
||||
dec_content = title.get_content()
|
||||
@@ -91,7 +91,7 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
|
||||
# local encrypted contents that have been altered at present.
|
||||
return -3
|
||||
# If pack TAD is still true, pack the TMD, ticket, and content into a TAD.
|
||||
if pack_tad_enabled is True:
|
||||
if pack_tad_enabled:
|
||||
# Get the TAD certificate chain, courtesy of libTWLPy.
|
||||
progress_callback.emit(-1, -1, " - Building certificate...")
|
||||
title.tad.set_cert_data(libTWLPy.download_cert())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/download_wii.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import pathlib
|
||||
|
||||
@@ -85,11 +85,11 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
|
||||
wiiu_endpoint=wiiu_nus_enabled, progress=progress_update))
|
||||
progress_callback.emit(-1, -1, " - Done!")
|
||||
# If keep encrypted contents is on, write out each content after its downloaded.
|
||||
if keep_enc_chkbox is True:
|
||||
if keep_enc_chkbox:
|
||||
version_dir.joinpath(content_file_name).write_bytes(content_list[content])
|
||||
title.content.content_list = content_list
|
||||
# If decrypt local contents is still true, decrypt each content and write out the decrypted file.
|
||||
if decrypt_contents_enabled is True:
|
||||
if decrypt_contents_enabled:
|
||||
try:
|
||||
for content in range(len(title.tmd.content_records)):
|
||||
progress_callback.emit(-1, -1, f" - Decrypting content {content + 1} of {len(title.tmd.content_records)} "
|
||||
@@ -102,7 +102,7 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
|
||||
# local encrypted contents that have been altered at present.
|
||||
return -3
|
||||
# If pack WAD is still true, pack the TMD, ticket, and contents all into a WAD.
|
||||
if pack_wad_enabled is True:
|
||||
if pack_wad_enabled:
|
||||
# If the option to pack for vWii mode instead of Wii U mode is enabled, then the Title Key needs to be
|
||||
# re-encrypted with the common key instead of the vWii key, so that the title can be installed from within
|
||||
# vWii mode. (vWii mode does not have access to the vWii key, only Wii U mode has that.)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/language.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
from modules.config import update_setting
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/theme.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# "modules/tree.py", licensed under the MIT license
|
||||
# Copyright 2024-2025 NinjaCheetah
|
||||
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||
|
||||
from modules.core import TitleData
|
||||
from PySide6.QtCore import QAbstractItemModel, QModelIndex, Qt, QSortFilterProxyModel
|
||||
|
||||
Reference in New Issue
Block a user