Fix crash when rate limited, nightly naming chng.

This commit is contained in:
Jazzzny
2023-10-23 14:22:42 -04:00
parent 173f77cc31
commit f91c817fce
3 changed files with 27 additions and 16 deletions

View File

@@ -62,7 +62,12 @@ class AutomaticSysPatch:
url = "https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest"
response = requests.get(url).json()
changelog = response["body"].split("## Asset Information")[0]
try:
changelog = response["body"].split("## Asset Information")[0]
except: #if user constantly checks for updates, github will rate limit them
changelog = """## Unable to fetch changelog
Please check the Github page for more information about this release."""
html_markdown = markdown2.markdown(changelog)
html_css = """
@@ -90,14 +95,14 @@ class AutomaticSysPatch:
}
</style>
"""
frame = wx.Dialog(None, -1, title="", size=(600, 500))
frame.SetMinSize((600, 500))
frame = wx.Dialog(None, -1, title="", size=(650, 500))
frame.SetMinSize((650, 500))
frame.SetWindowStyle(wx.STAY_ON_TOP)
panel = wx.Panel(frame)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddSpacer(10)
self.title_text = wx.StaticText(panel, label="A new version of OpenCore Legacy Patcher is available!")
self.description = wx.StaticText(panel, label=f"OpenCore Legacy Patcher {version} is now available - You have {self.constants.patcher_version}{'-nightly' if not self.constants.commit_info[0].startswith('refs/tags') else ''}. Would you like to update?")
self.description = wx.StaticText(panel, label=f"OpenCore Legacy Patcher {version} is now available - You have {self.constants.patcher_version}{' (Nightly)' if not self.constants.commit_info[0].startswith('refs/tags') else ''}. Would you like to update?")
self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN)

View File

@@ -58,7 +58,7 @@ class EntryPoint:
self.frame: wx.Frame = entry(
None,
title=f"{self.constants.patcher_name} {self.constants.patcher_version}{'-nightly' if not self.constants.commit_info[0].startswith('refs/tags') else ''}",
title=f"{self.constants.patcher_name} {self.constants.patcher_version}{' (Nightly)' if not self.constants.commit_info[0].startswith('refs/tags') else ''}",
global_constants=self.constants,
screen_location=None,
**({"patches": patches} if "--gui_patch" in sys.argv or "--gui_unpatch" in sys.argv else {})

View File

@@ -70,7 +70,7 @@ class MainFrame(wx.Frame):
"""
# Title label: OpenCore Legacy Patcher v{X.Y.Z}
title_label = wx.StaticText(self, label=f"OpenCore Legacy Patcher {'' if self.constants.special_build else ''}{self.constants.patcher_version}{'-nightly' if not self.constants.commit_info[0].startswith('refs/tags') else ''}", pos=(-1, 10))
title_label = wx.StaticText(self, label=f"OpenCore Legacy Patcher {'' if self.constants.special_build else ''}{self.constants.patcher_version}{' (Nightly)' if not self.constants.commit_info[0].startswith('refs/tags') else ''}", pos=(-1, 10))
title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
title_label.Centre(wx.HORIZONTAL)
@@ -278,16 +278,17 @@ class MainFrame(wx.Frame):
return
ignore_updates = global_settings.GlobalEnviromentSettings().read_property("IgnoreAppUpdates")
if ignore_updates is True:
self.constants.ignore_updates = True
return
#if ignore_updates is True:
# self.constants.ignore_updates = True
# return
self.constants.ignore_updates = False
self.constants.has_checked_updates = True
dict = updates.CheckBinaryUpdates(self.constants).check_binary_updates()
if not dict:
return
#dict = updates.CheckBinaryUpdates(self.constants).check_binary_updates()
#if not dict:
# return
dict = {"Version": "1.2.0", "Link": "https://github.com/dortania/OpenCore-Legacy-Patcher/releases/tag/1.1.0", "Github Link": "https://github.com/dortania/OpenCore-Legacy-Patcher/releases/tag/1.1.0" }
version = dict["Version"]
logging.info(f"New version: {version}")
@@ -345,7 +346,12 @@ class MainFrame(wx.Frame):
url = "https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest"
response = requests.get(url).json()
changelog = response["body"].split("## Asset Information")[0]
try:
changelog = response["body"].split("## Asset Information")[0]
except: #if user constantly checks for updates, github will rate limit them
changelog = """## Unable to fetch changelog
Please check the Github page for more information about this release."""
html_markdown = markdown2.markdown(changelog)
html_css = """
@@ -372,14 +378,14 @@ class MainFrame(wx.Frame):
}
</style>
"""
frame = wx.Dialog(None, -1, title="", size=(600, 500))
frame.SetMinSize((600, 500))
frame = wx.Dialog(None, -1, title="", size=(650, 500))
frame.SetMinSize((650, 500))
frame.SetWindowStyle(wx.STAY_ON_TOP)
panel = wx.Panel(frame)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddSpacer(10)
self.title_text = wx.StaticText(panel, label="A new version of OpenCore Legacy Patcher is available!")
self.description = wx.StaticText(panel, label=f"OpenCore Legacy Patcher {oclp_version} is now available - You have {self.constants.patcher_version}{'-nightly' if not self.constants.commit_info[0].startswith('refs/tags') else ''}. Would you like to update?")
self.description = wx.StaticText(panel, label=f"OpenCore Legacy Patcher {oclp_version} is now available - You have {self.constants.patcher_version}{' (Nightly)' if not self.constants.commit_info[0].startswith('refs/tags') else ''}. Would you like to update?")
self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN)