mirror of
https://github.com/outbackdingo/OpCore-Simplify.git
synced 2026-08-25 14:53:06 +00:00
Rewrite code related to GitHub REST API request quota
This commit is contained in:
+17
-6
@@ -60,21 +60,32 @@ class Updater:
|
||||
self.utils.write_file(self.sha_version, sha_version_info)
|
||||
|
||||
def run_update(self):
|
||||
self.utils.head("Check for update")
|
||||
self.utils.head("Check for Updates")
|
||||
print("")
|
||||
current_sha_version = self.get_current_sha_version()
|
||||
|
||||
if not self.github.check_ratelimit():
|
||||
print("GitHub REST API request quota has been exhausted. Automatic update check is unavailable now.")
|
||||
print("Please check for updates manually if needed.")
|
||||
print("")
|
||||
self.utils.request_input()
|
||||
return False
|
||||
|
||||
latest_sha_version = self.get_latest_sha_version()
|
||||
print("Current script SHA version: {}".format(current_sha_version))
|
||||
print("Latest script SHA version: {}".format(latest_sha_version))
|
||||
print("")
|
||||
if latest_sha_version != current_sha_version:
|
||||
print("Updating from version {} to {}\n".format(current_sha_version, latest_sha_version))
|
||||
print("Updating from version {} to {}".format(current_sha_version, latest_sha_version))
|
||||
print("")
|
||||
self.download_update()
|
||||
self.update_files()
|
||||
self.save_latest_sha_version(latest_sha_version)
|
||||
print("\n\n{}\n".format(self.utils.message("The program needs to restart to complete the update process.", "reminder")))
|
||||
return True
|
||||
print("\n")
|
||||
print("The program needs to restart to complete the update process.")
|
||||
print("\n")
|
||||
self.utils.request_input()
|
||||
else:
|
||||
print("You are already using the latest version")
|
||||
return False
|
||||
|
||||
|
||||
return latest_sha_version != current_sha_version
|
||||
Reference in New Issue
Block a user