Merge pull request #418 from leminlimez/v5.0.2

V5.0.2
This commit is contained in:
leminlimez
2025-03-30 00:07:40 -04:00
committed by GitHub
4 changed files with 17 additions and 16 deletions

View File

@@ -82,14 +82,14 @@ def concat_regular_file(file: FileToRestore, files_list: list[FileToRestore], la
return new_last_domain, full_path return new_last_domain, full_path
# files is a list of FileToRestore objects # files is a list of FileToRestore objects
def restore_files(files: list, reboot: bool = False, lockdown_client: LockdownClient = None): def restore_files(files: list[FileToRestore], reboot: bool = False, lockdown_client: LockdownClient = None):
# create the files to be backed up # create the files to be backed up
files_list = [ files_list = [
] ]
apps_list = [] apps_list = []
active_bundle_ids = [] active_bundle_ids = []
apps = None apps = None
sorted_files = sorted(files, key=lambda x: x.restore_path, reverse=False) sorted_files = sorted(files, key=lambda x: (x.domain, x.restore_path), reverse=False)
# add the file paths # add the file paths
last_domain = "" last_domain = ""
last_path = "" last_path = ""

View File

@@ -332,7 +332,7 @@ class DeviceManager:
tmp_pb_dir = TemporaryDirectory() tmp_pb_dir = TemporaryDirectory()
tweak.apply_tweak( tweak.apply_tweak(
files_to_restore=files_to_restore, output_dir=tmp_pb_dir.name, files_to_restore=files_to_restore, output_dir=tmp_pb_dir.name,
windows_path_fix=self.windows_path_fix version=self.get_current_device_version()
) )
if tweak.enabled: if tweak.enabled:
uses_domains = True uses_domains = True

View File

@@ -19,7 +19,7 @@ from tweaks.tweaks import tweaks
from tweaks.custom_gestalt_tweaks import CustomGestaltTweaks, ValueTypeStrings from tweaks.custom_gestalt_tweaks import CustomGestaltTweaks, ValueTypeStrings
from tweaks.daemons_tweak import Daemon from tweaks.daemons_tweak import Daemon
App_Version = "5.0.1" App_Version = "5.0.2"
App_Build = 0 App_Build = 0
class Page(Enum): class Page(Enum):
@@ -184,11 +184,9 @@ class MainWindow(QtWidgets.QMainWindow):
self.ui.allowWifiApplyingChk.toggled.connect(self.on_allowWifiApplyingChk_toggled) self.ui.allowWifiApplyingChk.toggled.connect(self.on_allowWifiApplyingChk_toggled)
self.ui.autoRebootChk.toggled.connect(self.on_autoRebootChk_toggled) self.ui.autoRebootChk.toggled.connect(self.on_autoRebootChk_toggled)
self.ui.showRiskyChk.toggled.connect(self.on_showRiskyChk_toggled) self.ui.showRiskyChk.toggled.connect(self.on_showRiskyChk_toggled)
# windows path fix toggle # windows path fix toggle (depreciated)
if os_name == "nt": # TODO: Remove this from the UI and everything
self.ui.windowsPathFixChk.toggled.connect(self.on_windowsPathFixChk_toggled) self.ui.windowsPathFixChk.hide()
else:
self.ui.windowsPathFixChk.hide()
self.ui.showAllSpoofableChk.toggled.connect(self.on_showAllSpoofableChk_toggled) self.ui.showAllSpoofableChk.toggled.connect(self.on_showAllSpoofableChk_toggled)
self.ui.revertRdarChk.toggled.connect(self.on_revertRdarChk_toggled) self.ui.revertRdarChk.toggled.connect(self.on_revertRdarChk_toggled)

View File

@@ -63,6 +63,7 @@ class PosterboardTweak(Tweak):
self.bundle_id = "com.apple.PosterBoard" self.bundle_id = "com.apple.PosterBoard"
self.resetting = False self.resetting = False
self.resetType = 0 # 0 for descriptor 1 for prb self.resetType = 0 # 0 for descriptor 1 for prb
self.structure_version = 61
def add_tendie(self, file: str): def add_tendie(self, file: str):
new_tendie = TendieFile(path=file) new_tendie = TendieFile(path=file)
@@ -144,24 +145,29 @@ class PosterboardTweak(Tweak):
self.recursive_add( self.recursive_add(
files_to_restore, files_to_restore,
os.path.join(curr_path, folder), os.path.join(curr_path, folder),
restore_path="/Library/Application Support/PRBPosterExtensionDataStore/61/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors", restore_path=f"/Library/Application Support/PRBPosterExtensionDataStore/{self.structure_version}/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors",
isAdding=True, isAdding=True,
randomizeUUID=True randomizeUUID=True
) )
else: else:
self.recursive_add(files_to_restore, os.path.join(curr_path, folder), isAdding=False) self.recursive_add(files_to_restore, os.path.join(curr_path, folder), isAdding=False)
def apply_tweak(self, files_to_restore: list[FileToRestore], output_dir: str, windows_path_fix: bool): def apply_tweak(self, files_to_restore: list[FileToRestore], output_dir: str, version: str):
# unzip the file # unzip the file
if not self.enabled: if not self.enabled:
return return
if version.startswith("16"):
# iOS 16 has a different number for the structure
self.structure_version = 59
else:
self.structure_version = 61
if self.resetting: if self.resetting:
# null out the folder # null out the folder
file_paths = [] file_paths = []
if self.resetType == 0: if self.resetType == 0:
# resetting descriptors # resetting descriptors
file_paths.append("/61/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors") file_paths.append(f"/{self.structure_version}/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors")
file_paths.append("/61/Extensions/com.apple.MercuryPoster/descriptors") file_paths.append(f"/{self.structure_version}/Extensions/com.apple.MercuryPoster/descriptors")
else: else:
file_paths.append("") file_paths.append("")
for file_path in file_paths: for file_path in file_paths:
@@ -173,9 +179,6 @@ class PosterboardTweak(Tweak):
return return
elif self.tendies == None or len(self.tendies) == 0: elif self.tendies == None or len(self.tendies) == 0:
return return
if os.name == "nt" and windows_path_fix:
# try to get past directory name limit on windows
output_dir = "\\\\?\\" + output_dir
for tendie in self.tendies: for tendie in self.tendies:
zip_output = os.path.join(output_dir, str(uuid.uuid4())) zip_output = os.path.join(output_dir, str(uuid.uuid4()))
os.makedirs(zip_output) os.makedirs(zip_output)