mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
@@ -82,14 +82,14 @@ 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 = ""
|
||||
|
||||
@@ -332,7 +332,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
|
||||
version=self.get_current_device_version()
|
||||
)
|
||||
if tweak.enabled:
|
||||
uses_domains = True
|
||||
|
||||
@@ -19,7 +19,7 @@ from tweaks.tweaks import tweaks
|
||||
from tweaks.custom_gestalt_tweaks import CustomGestaltTweaks, ValueTypeStrings
|
||||
from tweaks.daemons_tweak import Daemon
|
||||
|
||||
App_Version = "5.0.1"
|
||||
App_Version = "5.0.2"
|
||||
App_Build = 0
|
||||
|
||||
class Page(Enum):
|
||||
@@ -184,10 +184,8 @@ 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:
|
||||
# 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)
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ class PosterboardTweak(Tweak):
|
||||
self.bundle_id = "com.apple.PosterBoard"
|
||||
self.resetting = False
|
||||
self.resetType = 0 # 0 for descriptor 1 for prb
|
||||
self.structure_version = 61
|
||||
|
||||
def add_tendie(self, file: str):
|
||||
new_tendie = TendieFile(path=file)
|
||||
@@ -144,24 +145,29 @@ 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
|
||||
)
|
||||
else:
|
||||
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
|
||||
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")
|
||||
else:
|
||||
file_paths.append("")
|
||||
for file_path in file_paths:
|
||||
@@ -173,9 +179,6 @@ class PosterboardTweak(Tweak):
|
||||
return
|
||||
elif self.tendies == None or len(self.tendies) == 0:
|
||||
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:
|
||||
zip_output = os.path.join(output_dir, str(uuid.uuid4()))
|
||||
os.makedirs(zip_output)
|
||||
|
||||
Reference in New Issue
Block a user