diff --git a/Sparserestore/restore.py b/Sparserestore/restore.py index 6b1950b..71f41c0 100644 --- a/Sparserestore/restore.py +++ b/Sparserestore/restore.py @@ -4,7 +4,7 @@ from pymobiledevice3.services.installation_proxy import InstallationProxyService import os class FileToRestore: - def __init__(self, contents: str, restore_path: str, contents_path: str = None, domain: str = None, owner: int = 501, group: int = 501): + def __init__(self, contents: str, restore_path: str, contents_path: str = None, domain: str = "", owner: int = 501, group: int = 501): self.contents = contents self.contents_path = contents_path self.restore_path = restore_path @@ -82,20 +82,20 @@ def concat_regular_file(file: FileToRestore, files_list: list[FileToRestore], la return new_last_domain, full_path # 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 files_list = [ ] apps_list = [] active_bundle_ids = [] 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 last_domain = "" last_path = "" exploit_only = True for file in sorted_files: - if file.domain == None: + if file.domain == "": last_domain = concat_exploit_file(file, files_list, last_domain) else: last_domain, last_path = concat_regular_file(file, files_list, last_domain, last_path) diff --git a/devicemanagement/device_manager.py b/devicemanagement/device_manager.py index cb92ca3..80f8d72 100644 --- a/devicemanagement/device_manager.py +++ b/devicemanagement/device_manager.py @@ -247,7 +247,7 @@ class DeviceManager: # returns Domain: str?, Path: str if self.get_current_device_supported() and not path.startswith("/var/mobile/") and not owner == 0: # don't do anything on sparserestore versions - return path, None + return path, "" fully_patched = self.get_current_device_patched() # just make the Sys Containers to use the regular way (won't work for mga) sysSharedContainer = "SysSharedContainerDomain-" @@ -275,7 +275,7 @@ class DeviceManager: new_domain += parts[0] new_path = new_path.replace(parts[0] + "/", "") return new_path, new_domain - return path, None + return path, "" def concat_file(self, contents: str, path: str, files_to_restore: list[FileToRestore], owner: int = 501, group: int = 501): # TODO: try using inodes here instead @@ -333,7 +333,7 @@ class DeviceManager: tmp_pb_dir = TemporaryDirectory() tweak.apply_tweak( files_to_restore=files_to_restore, output_dir=tmp_pb_dir.name, - windows_path_fix=self.windows_path_fix, update_label=update_label + version=self.get_current_device_version(), update_label=update_label ) if tweak.enabled: uses_domains = True diff --git a/gui/main_window.py b/gui/main_window.py index 8e2b721..af523f6 100644 --- a/gui/main_window.py +++ b/gui/main_window.py @@ -21,7 +21,7 @@ from tweaks.custom_gestalt_tweaks import CustomGestaltTweaks, ValueTypeStrings from tweaks.daemons_tweak import Daemon App_Version = "5.1" -App_Build = 4 +App_Build = 5 class Page(Enum): Home = 0 @@ -197,11 +197,9 @@ class MainWindow(QtWidgets.QMainWindow): self.ui.allowWifiApplyingChk.toggled.connect(self.on_allowWifiApplyingChk_toggled) self.ui.autoRebootChk.toggled.connect(self.on_autoRebootChk_toggled) self.ui.showRiskyChk.toggled.connect(self.on_showRiskyChk_toggled) - # windows path fix toggle - if os_name == "nt": - self.ui.windowsPathFixChk.toggled.connect(self.on_windowsPathFixChk_toggled) - else: - self.ui.windowsPathFixChk.hide() + # windows path fix toggle (depreciated) + # TODO: Remove this from the UI and everything + self.ui.windowsPathFixChk.hide() self.ui.showAllSpoofableChk.toggled.connect(self.on_showAllSpoofableChk_toggled) self.ui.revertRdarChk.toggled.connect(self.on_revertRdarChk_toggled) diff --git a/tweaks/posterboard_tweak.py b/tweaks/posterboard_tweak.py index db16783..c021e6e 100644 --- a/tweaks/posterboard_tweak.py +++ b/tweaks/posterboard_tweak.py @@ -70,6 +70,7 @@ class PosterboardTweak(Tweak): self.bundle_id = "com.apple.PosterBoard" self.resetting = False self.resetType = 0 # 0 for descriptor, 1 for prb, 2 for suggested photos + self.structure_version = 61 def add_tendie(self, file: str): new_tendie = TendieFile(path=file) @@ -151,7 +152,7 @@ class PosterboardTweak(Tweak): self.recursive_add( files_to_restore, 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, randomizeUUID=True ) @@ -216,20 +217,25 @@ class PosterboardTweak(Tweak): - def apply_tweak(self, files_to_restore: list[FileToRestore], output_dir: str, windows_path_fix: bool, update_label=lambda x: None): + def apply_tweak(self, files_to_restore: list[FileToRestore], output_dir: str, version: str, update_label=lambda x: None): # unzip the file if not self.enabled: 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: # null out the folder file_paths = [] if self.resetType == 0: # resetting descriptors - file_paths.append("/61/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.WallpaperKit.CollectionsPoster/descriptors") + file_paths.append(f"/{self.structure_version}/Extensions/com.apple.MercuryPoster/descriptors") elif self.resetType == 2: # resetting suggested photos - file_paths.append("/61/Extensions/com.apple.PhotosUIPrivate.PhotosPosterProvider/descriptors") + file_paths.append(f"/{self.structure_version}/Extensions/com.apple.PhotosUIPrivate.PhotosPosterProvider/descriptors") else: file_paths.append("") for file_path in file_paths: @@ -241,9 +247,6 @@ class PosterboardTweak(Tweak): return elif (self.tendies == None or len(self.tendies) == 0) and (self.videoFile == None): return - if os.name == "nt" and windows_path_fix: - # try to get past directory name limit on windows - output_dir = "\\\\?\\" + output_dir update_label("Generating PosterBoard Video...") self.create_live_photo_files(output_dir) self.create_video_loop_files(output_dir, update_label=update_label)