mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
disabling ota
This commit is contained in:
@@ -16,9 +16,15 @@ class FileLocation(Enum):
|
||||
pasteboard = "/var/Managed Preferences/mobile/com.apple.Pasteboard.plist"
|
||||
notes = "/var/Managed Preferences/mobile/com.apple.mobilenotes.plist"
|
||||
|
||||
# Risky Options
|
||||
ota = "/var/Managed Preferences/mobile/com.apple.MobileAsset.plist"
|
||||
|
||||
# support for older versions of python that cannot enumerate over enums
|
||||
FileLocationsList: list[FileLocation] = [
|
||||
FileLocation.resolution,
|
||||
FileLocation.springboard, FileLocation.footnote,
|
||||
FileLocation.globalPreferences, FileLocation.appStore, FileLocation.backboardd, FileLocation.coreMotion, FileLocation.pasteboard, FileLocation.notes
|
||||
]
|
||||
RiskyFileLocationsList: list[FileLocation] = [
|
||||
FileLocation.ota
|
||||
]
|
||||
@@ -49,13 +49,15 @@ class BasicPlistTweak(Tweak):
|
||||
value: any = True,
|
||||
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
|
||||
min_version: Version = Version("1.0"),
|
||||
is_risky: bool = False,
|
||||
divider_below: bool = False
|
||||
):
|
||||
super().__init__(label=label, key=key, subkey=None, value=value, edit_type=edit_type, min_version=min_version, divider_below=divider_below)
|
||||
self.file_location = file_location
|
||||
self.is_risky = is_risky
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict) -> dict:
|
||||
if not self.enabled:
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled or (self.is_risky and not risky_allowed):
|
||||
return other_tweaks
|
||||
if self.file_location in other_tweaks:
|
||||
other_tweaks[self.file_location][self.key] = self.value
|
||||
@@ -63,6 +65,27 @@ class BasicPlistTweak(Tweak):
|
||||
other_tweaks[self.file_location] = {self.key: self.value}
|
||||
return other_tweaks
|
||||
|
||||
class AdvancedPlistTweak(BasicPlistTweak):
|
||||
def __init__(
|
||||
self, label: str,
|
||||
file_location: FileLocation,
|
||||
keyValues: dict,
|
||||
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
|
||||
min_version: Version = Version("1.0"),
|
||||
is_risky: bool = False,
|
||||
divider_below: bool = False
|
||||
):
|
||||
super().__init__(label=label, file_location=file_location, key=None, value=keyValues, edit_type=edit_type, min_version=min_version, is_risky=is_risky, divider_below=divider_below)
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled or (self.is_risky and not risky_allowed):
|
||||
return other_tweaks
|
||||
plist = {}
|
||||
for key in self.value:
|
||||
plist[key] = self.value[key]
|
||||
other_tweaks[self.file_location] = plist
|
||||
return other_tweaks
|
||||
|
||||
|
||||
class RdarFixTweak(BasicPlistTweak):
|
||||
def __init__(self, divider_below: bool = False):
|
||||
@@ -97,7 +120,7 @@ class RdarFixTweak(BasicPlistTweak):
|
||||
def set_di_type(self, type: int):
|
||||
self.di_type = type
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict) -> dict:
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled:
|
||||
return other_tweaks
|
||||
if self.di_type == -1:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from devicemanagement.constants import Version
|
||||
from .tweak_classes import MobileGestaltTweak, MobileGestaltMultiTweak, MobileGestaltPickerTweak, FeatureFlagTweak, TweakModifyType, BasicPlistTweak, RdarFixTweak
|
||||
from .tweak_classes import MobileGestaltTweak, MobileGestaltMultiTweak, MobileGestaltPickerTweak, FeatureFlagTweak, TweakModifyType, BasicPlistTweak, AdvancedPlistTweak, RdarFixTweak
|
||||
from .eligibility_tweak import EligibilityTweak, AITweak
|
||||
from .basic_plist_locations import FileLocation
|
||||
|
||||
@@ -267,5 +267,20 @@ tweaks = {
|
||||
"Show Notifications for System Pastes",
|
||||
FileLocation.pasteboard,
|
||||
"AnnounceAllPastes"
|
||||
),
|
||||
|
||||
## Risky Options
|
||||
"DisableOTA": AdvancedPlistTweak(
|
||||
"Disable OTA Updates",
|
||||
FileLocation.ota,
|
||||
{
|
||||
"MobileAssetServerURL-com.apple.MobileAsset.MobileSoftwareUpdate.UpdateBrain": "https://mesu.apple.com/assets/tvOS16DeveloperSeed",
|
||||
"MobileAssetSUAllowOSVersionChange": False,
|
||||
"MobileAssetSUAllowSameVersionFullReplacement": False,
|
||||
"MobileAssetServerURL-com.apple.MobileAsset.RecoveryOSUpdate": "https://mesu.apple.com/assets/tvOS16DeveloperSeed",
|
||||
"MobileAssetServerURL-com.apple.MobileAsset.RecoveryOSUpdateBrain": "https://mesu.apple.com/assets/tvOS16DeveloperSeed",
|
||||
"MobileAssetServerURL-com.apple.MobileAsset.SoftwareUpdate": "https://mesu.apple.com/assets/tvOS16DeveloperSeed",
|
||||
"MobileAssetAssetAudience": "65254ac3-f331-4c19-8559-cbe22f5bc1a6"
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user