mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-11 02:49:40 +00:00
feat: enable documents
This commit is contained in:
@@ -35,6 +35,10 @@ def main() -> None:
|
||||
"-w", "--no-watch", action="store_true",
|
||||
help="remove all watch apps"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d", "--enable-documents", action="store_true",
|
||||
help="enable documents support"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-c", "--compress", metavar="level", type=int, default=6,
|
||||
|
||||
@@ -45,6 +45,8 @@ def main(parser: ArgumentParser) -> None:
|
||||
app.plist.remove_uisd()
|
||||
if args.no_watch:
|
||||
app.remove_watch_apps()
|
||||
if args.enable_documents:
|
||||
app.plist.enable_documents()
|
||||
|
||||
# create subdirectories if necessary
|
||||
if "/" in args.o:
|
||||
|
||||
@@ -26,6 +26,14 @@ class Plist:
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
def change(self, key: str, val: Any) -> bool:
|
||||
try:
|
||||
if self[key] == val:
|
||||
return False
|
||||
except KeyError:
|
||||
self[key] = val
|
||||
return True
|
||||
|
||||
def remove_uisd(self) -> None:
|
||||
if self.remove("UISupportedDevices"):
|
||||
self.save()
|
||||
@@ -33,3 +41,12 @@ class Plist:
|
||||
else:
|
||||
print("[?] no UISupportedDevices")
|
||||
|
||||
def enable_documents(self) -> None:
|
||||
c1 = self.change("UISupportsDocumentBrowser", True)
|
||||
c2 = self.change("UIFileSharingEnabled", True)
|
||||
|
||||
if c1 or c2:
|
||||
self.save()
|
||||
print("[*] enabled documents support")
|
||||
else:
|
||||
print("[?] documents support was already enabled")
|
||||
|
||||
Reference in New Issue
Block a user