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",
|
"-w", "--no-watch", action="store_true",
|
||||||
help="remove all watch apps"
|
help="remove all watch apps"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-d", "--enable-documents", action="store_true",
|
||||||
|
help="enable documents support"
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--compress", metavar="level", type=int, default=6,
|
"-c", "--compress", metavar="level", type=int, default=6,
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ def main(parser: ArgumentParser) -> None:
|
|||||||
app.plist.remove_uisd()
|
app.plist.remove_uisd()
|
||||||
if args.no_watch:
|
if args.no_watch:
|
||||||
app.remove_watch_apps()
|
app.remove_watch_apps()
|
||||||
|
if args.enable_documents:
|
||||||
|
app.plist.enable_documents()
|
||||||
|
|
||||||
# create subdirectories if necessary
|
# create subdirectories if necessary
|
||||||
if "/" in args.o:
|
if "/" in args.o:
|
||||||
|
|||||||
@@ -26,10 +26,27 @@ class Plist:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
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:
|
def remove_uisd(self) -> None:
|
||||||
if self.remove("UISupportedDevices"):
|
if self.remove("UISupportedDevices"):
|
||||||
self.save()
|
self.save()
|
||||||
print("[*] removed UISupportedDevices")
|
print("[*] removed UISupportedDevices")
|
||||||
else:
|
else:
|
||||||
print("[?] no UISupportedDevices")
|
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