From c4d649ec583aef46c1447a8fcbca23f167601b25 Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Sun, 5 Mar 2023 13:45:10 -0800 Subject: [PATCH 01/44] Remove jkcoxson anisette servers. Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Settings.bundle/Root.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/AltStore/Settings.bundle/Root.plist b/AltStore/Settings.bundle/Root.plist index b6d57f44..457492ff 100644 --- a/AltStore/Settings.bundle/Root.plist +++ b/AltStore/Settings.bundle/Root.plist @@ -23,8 +23,6 @@ Macley (US) Macley (DE) DrPudding - jkcoxson (AltServer) - jkcoxson (Provision) Sideloadly Nick Jawshoeadan @@ -36,8 +34,6 @@ http://us1.sternserv.tech http://de1.sternserv.tech https://sign.rheaa.xyz - http://jkcoxson.com:2095 - http://jkcoxson.com:2052 https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx http://45.33.29.114 https://anisette.jawshoeadan.me From 020a1a3149649d4e17c93959cd31de75caddae47 Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Sun, 5 Mar 2023 19:27:25 -0800 Subject: [PATCH 02/44] Replace sideloady to use sidestore ani Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Info.plist b/AltStore/Info.plist index 2b4b48de..f790812d 100644 --- a/AltStore/Info.plist +++ b/AltStore/Info.plist @@ -14,7 +14,7 @@ ALTPairingFile <insert pairing file here> ALTAnisetteURL - https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx + http://ani.sidestore.io CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDocumentTypes From bcb5a90f5eea7034f73c21a4d07daf1b5eee9fda Mon Sep 17 00:00:00 2001 From: Nythepegasus Date: Mon, 6 Mar 2023 14:09:16 -0500 Subject: [PATCH 03/44] Add SSL encryption to ani.sidestore.io Signed-off-by: Nythepegasus --- AltStore/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Info.plist b/AltStore/Info.plist index f790812d..a54f4f93 100644 --- a/AltStore/Info.plist +++ b/AltStore/Info.plist @@ -14,7 +14,7 @@ ALTPairingFile <insert pairing file here> ALTAnisetteURL - http://ani.sidestore.io + https://ani.sidestore.io CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDocumentTypes From 813e2f97acf12a4676bec2fecf01388816b14f5a Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 6 Mar 2023 12:10:39 -0800 Subject: [PATCH 04/44] Change version to 0.3.2 Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- Build.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.xcconfig b/Build.xcconfig index 1abe5ee6..3c049de8 100644 --- a/Build.xcconfig +++ b/Build.xcconfig @@ -1,8 +1,8 @@ // Configuration settings file format documentation can be found at: // https://help.apple.com/xcode/#/dev745c5c974 -MARKETING_VERSION = 0.3.1 -CURRENT_PROJECT_VERSION = 3021 +MARKETING_VERSION = 0.3.2 +CURRENT_PROJECT_VERSION = 3050 // Vars to be overwritten by `CodeSigning.xcconfig` if exists DEVELOPMENT_TEAM = S32Z3HMYVQ From ae457f07c46788c7e13ecf27e468dbe98ceb8a65 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 7 Mar 2023 07:27:36 -0800 Subject: [PATCH 05/44] add https for ani.sidestore.io to Settings.bundle --- AltStore/Settings.bundle/Root.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore/Settings.bundle/Root.plist b/AltStore/Settings.bundle/Root.plist index 457492ff..cad6e004 100644 --- a/AltStore/Settings.bundle/Root.plist +++ b/AltStore/Settings.bundle/Root.plist @@ -16,7 +16,7 @@ Key customAnisetteURL DefaultValue - http://ani.sidestore.io + https://ani.sidestore.io Titles SideStore @@ -30,7 +30,7 @@ Values - http://ani.sidestore.io + https://ani.sidestore.io http://us1.sternserv.tech http://de1.sternserv.tech https://sign.rheaa.xyz From 1a1ed072bf3168a5c2154891843c6f954d1a70da Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 7 Mar 2023 07:50:31 -0800 Subject: [PATCH 06/44] attach debugging symbols to actions builds --- .github/workflows/beta.yml | 8 +++++++- .github/workflows/nightly.yml | 8 +++++++- .github/workflows/pr.yml | 8 +++++++- .github/workflows/stable.yml | 8 +++++++- .gitignore | 2 ++ Makefile | 3 ++- 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 4487366b..54c765b8 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -41,12 +41,18 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload Artifact + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore.ipa path: SideStore.ipa + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore.dSYM + path: ./*.dSYM/ + - name: Get version id: version run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2c8bc61f..9be4fa03 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -50,12 +50,18 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload Artifact + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore.ipa path: SideStore.ipa + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore.dSYM + path: ./*.dSYM/ + - name: Get version id: version run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 580b769b..89fad8fc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -39,8 +39,14 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload Artifact + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore.ipa path: SideStore.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore.dSYM + path: ./*.dSYM/ diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 5da10815..ea9c6273 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -41,12 +41,18 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload Artifact + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore.ipa path: SideStore.ipa + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore.dSYM + path: ./*.dSYM/ + - name: Get version id: version run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT diff --git a/.gitignore b/.gitignore index a6dec00c..9e0fcf89 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,8 @@ xcuserdata Payload/ SideStore.ipa +*.dSYM + Dependencies/.*-prebuilt-fetch-* Dependencies/minimuxer/* Dependencies/em_proxy/* diff --git a/Makefile b/Makefile index 0914fcd7..503859bf 100644 --- a/Makefile +++ b/Makefile @@ -165,7 +165,8 @@ build: AD_HOC_CODE_SIGNING_ALLOWED=YES \ CODE_SIGNING_ALLOWED=NO \ DEVELOPMENT_TEAM=XYZ0123456 \ - ORG_IDENTIFIER=com.SideStore + ORG_IDENTIFIER=com.SideStore \ + DWARF_DSYM_FOLDER_PATH="." fakesign: rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/ From 4e84dc4cc87dff2ce081f07375cb88aece7c5028 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 7 Mar 2023 08:24:28 -0800 Subject: [PATCH 07/44] [skip ci] rename the *.dSYM artifact so that macOS treats it as a normal folder --- .github/workflows/beta.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/stable.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 54c765b8..0dec182a 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -50,7 +50,7 @@ jobs: - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.dSYM + name: SideStore-dSYM path: ./*.dSYM/ - name: Get version diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9be4fa03..42555c0f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -59,7 +59,7 @@ jobs: - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.dSYM + name: SideStore-dSYM path: ./*.dSYM/ - name: Get version diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 89fad8fc..bd50c890 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,5 +48,5 @@ jobs: - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.dSYM + name: SideStore-dSYM path: ./*.dSYM/ diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index ea9c6273..7db5cd49 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -50,7 +50,7 @@ jobs: - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.dSYM + name: SideStore-dSYM path: ./*.dSYM/ - name: Get version From 4334e887de0c1e855606b90b3aa4fc97b60863c9 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 12 Mar 2023 16:38:59 -0700 Subject: [PATCH 08/44] [skip ci] use bundle ID from Build.xcconfig in AltStore.xcconfig --- AltStore.xcconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore.xcconfig b/AltStore.xcconfig index b2085eae..3366003e 100644 --- a/AltStore.xcconfig +++ b/AltStore.xcconfig @@ -1,3 +1,3 @@ #include "Build.xcconfig" -PRODUCT_BUNDLE_IDENTIFIER = $(ORG_PREFIX).$(PRODUCT_NAME) +PRODUCT_BUNDLE_IDENTIFIER = $(PRODUCT_BUNDLE_IDENTIFIER) From 7dcb199f68f907729d365e027c7ab41fa7e847ef Mon Sep 17 00:00:00 2001 From: Joe Mattiello Date: Sun, 19 Mar 2023 23:28:32 -0400 Subject: [PATCH 09/44] Update README.md Add repobeats svg Signed-off-by: Joe Mattiello --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2ea9d21..96e10d81 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,14 @@ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com) [![Build and Upload SideStore](https://github.com/SideStore/SideStore/actions/workflows/build.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/build.yml) +![Alt](https://repobeats.axiom.co/api/embed/3a329ce95955690b9a9366f8d5598626a847d96c.svg "Repobeats analytics image") + SideStore is an iOS application that allows you to sideload apps onto your iOS device with just your Apple ID. SideStore resigns apps with your personal development certificate, and then uses a [specially designed VPN](https://github.com/jkcoxson/Secret-Tunnel) in order to trick iOS into installing them. SideStore will periodically "refresh" your apps in the background, to keep their normal 7-day development period from expiring. SideStore's goal is to provide an untethered sideloading experience. It's a community driven fork of [AltStore](https://github.com/rileytestut/AltStore), and has already implemented some of the community's most-requested features. (Contributions are welcome! 🙂) - ## Requirements - Xcode 14 - iOS 14+ From ebb64d255baee0395345771a0b72fbc35cfe568c Mon Sep 17 00:00:00 2001 From: Joe Mattiello Date: Mon, 20 Mar 2023 00:00:56 -0400 Subject: [PATCH 10/44] Update README.md Signed-off-by: Joe Mattiello --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 96e10d81..26de6ed2 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com) [![Build and Upload SideStore](https://github.com/SideStore/SideStore/actions/workflows/build.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/build.yml) +[![Nightly SideStore build](https://github.com/SideStore/SideStore/actions/workflows/nightly.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/nightly.yml) +[![.github/workflows/beta.yml](https://github.com/SideStore/SideStore/actions/workflows/beta.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/beta.yml) ![Alt](https://repobeats.axiom.co/api/embed/3a329ce95955690b9a9366f8d5598626a847d96c.svg "Repobeats analytics image") From 337d26333e7a127994fa606e6742f3c6d34677e0 Mon Sep 17 00:00:00 2001 From: Joe Mattiello Date: Mon, 20 Mar 2023 00:02:11 -0400 Subject: [PATCH 11/44] Update README.md Signed-off-by: Joe Mattiello --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 26de6ed2..66faf98d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com) -[![Build and Upload SideStore](https://github.com/SideStore/SideStore/actions/workflows/build.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/build.yml) [![Nightly SideStore build](https://github.com/SideStore/SideStore/actions/workflows/nightly.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/nightly.yml) [![.github/workflows/beta.yml](https://github.com/SideStore/SideStore/actions/workflows/beta.yml/badge.svg)](https://github.com/SideStore/SideStore/actions/workflows/beta.yml) From ca7d8277f720e05a1243f29f25c23745f1f7a9d4 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 20 Mar 2023 18:52:16 -0500 Subject: [PATCH 12/44] =?UTF-8?q?Fixes=20=E2=80=9Cno=20provisioning=20prof?= =?UTF-8?q?ile=20with=20the=20requested=20identifier=E2=80=A6=E2=80=9D=20e?= =?UTF-8?q?rror?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of March 20, 2023, deleting an app’s auto-generated free provisioning profile is no longer supported. However, fetching the provisioning profile now re-generates is every time, so there’s no need to delete it first. As a workaround, we now simply use the first profile we fetched if we receive an error when deleting it. This approach should continue to work even if Apple later reverses this change. --- .../Operations/FetchProvisioningProfilesOperation.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index e7b0eb30..182cedec 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -478,10 +478,13 @@ extension FetchProvisioningProfilesOperation ALTAppleAPI.shared.delete(profile, for: team, session: session) { (success, error) in switch Result(success, error) { - case .failure(let error): completionHandler(.failure(error)) - case .success: + case .failure: + // As of March 20, 2023, the free provisioning profile is re-generated each fetch, and you can no longer delete it. + // So instead, we just return the fetched profile from above. + completionHandler(.success(profile)) - // Fetch new provisiong profile + case .success: + // Fetch new provisioning profile ALTAppleAPI.shared.fetchProvisioningProfile(for: appID, deviceType: .iphone, team: team, session: session) { (profile, error) in completionHandler(Result(profile, error)) } From 99cb43bbea3f6fba4a1dd3d1ff20a29cb7b03ed9 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Fri, 24 Mar 2023 08:56:30 -0700 Subject: [PATCH 13/44] [skip ci] include commit SHA in PR builds Signed-off-by: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bd50c890..b91318e5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,7 +23,7 @@ jobs: run: brew install ldid - name: Add PR suffix to version - run: sed -e '/MARKETING_VERSION = .*/s/$/-pr.${{ github.event.pull_request.number }}/' -i '' Build.xcconfig + run: sed -e "/MARKETING_VERSION = .*/s/\$/-pr.${{ github.event.pull_request.number }}+$(git rev-parse --short HEAD)/" -i '' Build.xcconfig - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 From 5e2cc6e20c002929339489764ebdb878b1902c1b Mon Sep 17 00:00:00 2001 From: Joelle Stickney Date: Tue, 28 Mar 2023 01:33:55 -0400 Subject: [PATCH 14/44] Update store check to check for AltServer or SideServer installation --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index dc983b66..66c567cc 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,9 +11,10 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier + static let altstoreBundleIDOriginal = "rileytestut.AltStore" var isAltStoreApp: Bool { - let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) + let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) return isAltStoreApp } } From 6d0f4bb3da8385b8e26ce624216b1992df03b9ea Mon Sep 17 00:00:00 2001 From: Joelle Stickney Date: Tue, 28 Mar 2023 23:48:24 -0400 Subject: [PATCH 15/44] Fixes widget refreshing and is more thorough matching store ID --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index 66c567cc..9a7ee78f 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,10 +11,12 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier - static let altstoreBundleIDOriginal = "rileytestut.AltStore" + static let altstoreBundleIDOriginal = "AltStore" + static let storeBundleID = "SideStore" + static let widgetID = "Widget" var isAltStoreApp: Bool { - let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) + let isAltStoreApp = ( self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) || self.bundleIdentifier.contains(ALTApplication.storeBundleID) ) && !self.bundleIdentifier.contains(ALTApplication.widgetID) return isAltStoreApp } } From 0c171122b28781088f0ea942d4aa6eb5700c1a30 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:02:12 -0700 Subject: [PATCH 16/44] refactor minimuxer to use swift-bridge (#321) also add team ID to the end of the bundle ID for Debug builds to mirror SideServer --- AltStore.xcodeproj/project.pbxproj | 62 +++++++--- AltStore/LaunchViewController.swift | 32 ++--- .../Operations/DeactivateAppOperation.swift | 9 +- AltStore/Operations/EnableJITOperation.swift | 16 +-- AltStore/Operations/InstallAppOperation.swift | 21 ++-- AltStore/Operations/OperationError.swift | 94 ++++++++------- AltStore/Operations/RefreshAppOperation.swift | 11 +- AltStore/Operations/RemoveAppOperation.swift | 10 +- AltStore/Operations/ResignAppOperation.swift | 1 + AltStore/Operations/SendAppOperation.swift | 23 ++-- Build.xcconfig | 9 +- Dependencies/fetch-prebuilt.sh | 26 +++- .../minimuxer.xcodeproj/project.pbxproj | 27 ++++- minimuxer/minimuxer.swift | 111 ------------------ 14 files changed, 186 insertions(+), 266 deletions(-) delete mode 100644 minimuxer/minimuxer.swift diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index f1d2c724..8a12bc50 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -11,17 +11,18 @@ 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF45872B2298D31600BD7491 /* libimobiledevice.a */; }; 19104DB52909C06D00C49C7B /* EmotionalDamage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */; }; 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */; }; - 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FAD290A5D92001A3B7C /* minimuxer.swift */; }; 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FAB290A5D92001A3B7C /* libminimuxer.a */; }; 191E5FDC290AFA5C001A3B7C /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 191E5FDB290AFA5C001A3B7C /* OpenSSL */; }; 191E607D290B2EA5001A3B7C /* jsmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FD0290A651D001A3B7C /* jsmn.c */; }; 191E607E290B2EA7001A3B7C /* jplist.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FCF290A651D001A3B7C /* jplist.c */; }; - 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */; }; 1920B04F2924AC8300744F60 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1920B04E2924AC8300744F60 /* Settings.bundle */; }; 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */; }; 4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; }; 4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; }; 99C4EF4D2979132100CB538D /* SemanticVersion in Frameworks */ = {isa = PBXBuildFile; productRef = 99C4EF4C2979132100CB538D /* SemanticVersion */; }; + 99F87D0529D8B4E200B40039 /* minimuxer-helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */; }; + 99F87D1829D8E4C900B40039 /* SwiftBridgeCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */; }; + 99F87D1929D8E4C900B40039 /* minimuxer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F87D1729D8E4C900B40039 /* minimuxer.swift */; }; B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; }; B3146ED3284F581E00BBC3FD /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B33FFBA8295F8E98002259E6 /* libfragmentzip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B343F894295F7F9B002B1159 /* libfragmentzip.a */; }; @@ -504,13 +505,14 @@ 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libEmotionalDamage.a; sourceTree = BUILT_PRODUCTS_DIR; }; 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmotionalDamage.swift; sourceTree = ""; }; 191E5FAB290A5D92001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 191E5FAD290A5D92001A3B7C /* minimuxer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = minimuxer.swift; sourceTree = ""; }; - 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libminimuxer.a; path = "Dependencies/minimuxer/target/aarch64-apple-ios/debug/libminimuxer.a"; sourceTree = ""; }; 191E5FCF290A651D001A3B7C /* jplist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jplist.c; path = Dependencies/libplist/src/jplist.c; sourceTree = SOURCE_ROOT; }; 191E5FD0290A651D001A3B7C /* jsmn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jsmn.c; path = Dependencies/libplist/src/jsmn.c; sourceTree = SOURCE_ROOT; }; 191E5FD1290A651D001A3B7C /* jsmn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jsmn.h; path = Dependencies/libplist/src/jsmn.h; sourceTree = SOURCE_ROOT; }; 1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = ""; }; + 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "minimuxer-helpers.swift"; path = "Dependencies/minimuxer/minimuxer-helpers.swift"; sourceTree = SOURCE_ROOT; }; + 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftBridgeCore.swift; path = Dependencies/minimuxer/SwiftBridgeCore.swift; sourceTree = SOURCE_ROOT; }; + 99F87D1729D8E4C900B40039 /* minimuxer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = minimuxer.swift; path = Dependencies/minimuxer/minimuxer.swift; sourceTree = SOURCE_ROOT; }; B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Roxas.xcodeproj; path = Dependencies/Roxas/Roxas.xcodeproj; sourceTree = ""; }; B33FFBA9295F8F78002259E6 /* preboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = preboard.c; path = src/preboard.c; sourceTree = ""; }; B33FFBAB295F8F98002259E6 /* companion_proxy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = companion_proxy.c; path = src/companion_proxy.c; sourceTree = ""; }; @@ -914,7 +916,6 @@ buildActionMask = 2147483647; files = ( B33FFBA8295F8E98002259E6 /* libfragmentzip.a in Frameworks */, - 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */, 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */, 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */, 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */, @@ -945,8 +946,9 @@ 191E5FAC290A5D92001A3B7C /* minimuxer */ = { isa = PBXGroup; children = ( + 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */, + 99F87D1429D8E3F100B40039 /* Generated */, B343F847295F6321002B1159 /* minimuxer.xcodeproj */, - 191E5FAD290A5D92001A3B7C /* minimuxer.swift */, ); path = minimuxer; sourceTree = ""; @@ -968,6 +970,15 @@ path = "libimobiledevice-glue/src"; sourceTree = ""; }; + 99F87D1429D8E3F100B40039 /* Generated */ = { + isa = PBXGroup; + children = ( + 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */, + 99F87D1729D8E4C900B40039 /* minimuxer.swift */, + ); + name = Generated; + sourceTree = ""; + }; B3146EC7284F580500BBC3FD /* Products */ = { isa = PBXGroup; children = ( @@ -1567,7 +1578,6 @@ isa = PBXGroup; children = ( B343F86C295F759E002B1159 /* libresolv.tbd */, - 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */, B39575F4284F29E20080B4FF /* Roxas.framework */, D533E8B62727841800A9B5DD /* libAppleArchive.tbd */, BF580497246A3D19008AE704 /* UIKit.framework */, @@ -1766,13 +1776,6 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 191E5FD4290A6EE0001A3B7C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; BF4587272298D31600BD7491 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1853,7 +1856,6 @@ isa = PBXNativeTarget; buildConfigurationList = 191E5FAF290A5D92001A3B7C /* Build configuration list for PBXNativeTarget "minimuxer" */; buildPhases = ( - 191E5FD4290A6EE0001A3B7C /* Headers */, 191E5FA7290A5D92001A3B7C /* Sources */, 191E5FA8290A5D92001A3B7C /* Frameworks */, ); @@ -1969,6 +1971,7 @@ isa = PBXNativeTarget; buildConfigurationList = BFD2477E2284B9A700981D42 /* Build configuration list for PBXNativeTarget "SideStore" */; buildPhases = ( + 99F87D0629D8B51400B40039 /* ShellScript */, BFD247662284B9A500981D42 /* Sources */, BFD247672284B9A500981D42 /* Frameworks */, BFD247682284B9A500981D42 /* Resources */, @@ -2220,6 +2223,27 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 99F87D0629D8B51400B40039 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + "./Dependencies/minimuxer/minimuxer-helpers.swift", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "bash ./Dependencies/fetch-prebuilt.sh minimuxer\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 19104DAE2909C06C00C49C7B /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -2233,7 +2257,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */, + 99F87D1929D8E4C900B40039 /* minimuxer.swift in Sources */, + 99F87D1829D8E4C900B40039 /* SwiftBridgeCore.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2484,6 +2509,7 @@ BFB39B5C252BC10E00D1BE50 /* Managed.swift in Sources */, BF770E5822BC3D0F002A40FE /* RefreshGroup.swift in Sources */, 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */, + 99F87D0529D8B4E200B40039 /* minimuxer-helpers.swift in Sources */, BF18B0F122E25DF9005C4CF5 /* ToastView.swift in Sources */, BF3D649F22E7B24C00E9056B /* CollapsingTextView.swift in Sources */, BF02419622F2199300129732 /* RefreshAttemptsViewController.swift in Sources */, @@ -2673,7 +2699,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_OBJC_BRIDGING_HEADER = "Dependencies/minimuxer/minimuxer-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -2695,7 +2721,7 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_OBJC_BRIDGING_HEADER = "Dependencies/minimuxer/minimuxer-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index 0aaf588e..cece54c2 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -14,6 +14,8 @@ import minimuxer import AltStoreCore import UniformTypeIdentifiers +let pairingFileName = "ALTPairingFile.mobiledevicepairing" + final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate { private var didFinishLaunching = false @@ -125,14 +127,11 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg } // Save to a file for next launch - let filename = "ALTPairingFile.mobiledevicepairing" - let fm = FileManager.default - let documentsPath = fm.documentsDirectory.appendingPathComponent("/\(filename)") - try pairing_string?.write(to: documentsPath, atomically: true, encoding: String.Encoding.utf8) + let pairingFile = FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)") + try pairing_string?.write(to: pairingFile, atomically: true, encoding: String.Encoding.utf8) // Start minimuxer now that we have a file start_minimuxer_threads(pairing_string!) - } catch { displayError("Unable to read pairing file") } @@ -148,22 +147,15 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg } func start_minimuxer_threads(_ pairing_file: String) { - set_usbmuxd_socket() - #if false // Retries - var res = start_minimuxer(pairing_file: pairing_file) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("start_minimuxer `res` != 0, retry #\(attempts)") - res = start_minimuxer(pairing_file: pairing_file) - attempts -= 1 + target_minimuxer_address() + let documentsDirectory = FileManager.default.documentsDirectory.absoluteString + do { + try start(pairing_file, documentsDirectory) + } catch { + try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) + displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") } - #else - let res = start_minimuxer(pairing_file: pairing_file) - #endif - if res != 0 { - displayError("minimuxer failed to start. Incorrect arguments were passed.") - } - auto_mount_dev_image() + start_auto_mounter(documentsDirectory) } } diff --git a/AltStore/Operations/DeactivateAppOperation.swift b/AltStore/Operations/DeactivateAppOperation.swift index e96d1fee..5742ec87 100644 --- a/AltStore/Operations/DeactivateAppOperation.swift +++ b/AltStore/Operations/DeactivateAppOperation.swift @@ -44,14 +44,9 @@ final class DeactivateAppOperation: ResultOperation for profile in allIdentifiers { do { - let res = try remove_provisioning_profile(id: profile) - if case Uhoh.Bad(let code) = res { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try remove_provisioning_profile(profile) } catch { - self.finish(.failure(ALTServerError(.unknownResponse))) + return self.finish(.failure(minimuxerToOperationError(error))) } } diff --git a/AltStore/Operations/EnableJITOperation.swift b/AltStore/Operations/EnableJITOperation.swift index f89296bf..1848109b 100644 --- a/AltStore/Operations/EnableJITOperation.swift +++ b/AltStore/Operations/EnableJITOperation.swift @@ -45,23 +45,13 @@ final class EnableJITOperation: ResultOperation guard let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } installedApp.managedObjectContext?.perform { - let v = minimuxer_to_operation(code: 1) - do { - var x = try debug_app(app_id: installedApp.resignedBundleIdentifier) - switch x { - case .Good: - self.finish(.success(())) - case .Bad(let code): - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try debug_app(installedApp.resignedBundleIdentifier) } catch { - self.finish(.failure(OperationError.unknown)) + return self.finish(.failure(minimuxerToOperationError(error))) } - + self.finish(.success(())) } } } diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index f10c1272..c9ef8d50 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -11,6 +11,7 @@ import Network import AltStoreCore import AltSign import Roxas +import minimuxer @objc(InstallAppOperation) final class InstallAppOperation: ResultOperation @@ -148,17 +149,14 @@ final class InstallAppOperation: ResultOperation }) } - let ns_bundle = NSString(string: installedApp.bundleIdentifier) - let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) - - let res = minimuxer_install_ipa(ns_bundle_ptr) - if res == 0 { - installedApp.refreshedDate = Date() - self.finish(.success(installedApp)) - - } else { - self.finish(.failure(minimuxer_to_operation(code: res))) + do { + try install_ipa(installedApp.bundleIdentifier) + } catch { + return self.finish(.failure(minimuxerToOperationError(error))) } + + installedApp.refreshedDate = Date() + self.finish(.success(installedApp)) } } @@ -174,10 +172,11 @@ final class InstallAppOperation: ResultOperation do { try FileManager.default.removeItem(at: fileURL) + print("Removed refreshed IPA") } catch { - print("Failed to remove refreshed .ipa:", error) + print("Failed to remove refreshed .ipa: \(error)") } } diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 331db175..4e7a86b2 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -8,6 +8,7 @@ import Foundation import AltSign +import minimuxer enum OperationError: LocalizedError { @@ -42,9 +43,11 @@ enum OperationError: LocalizedError case uninstall case lookupApps case detach + case attach case functionArguments - case profileInstall + case profileManage case noConnection + case invalidPairingFile var failureReason: String? { switch self { @@ -70,9 +73,11 @@ enum OperationError: LocalizedError case .uninstall: return NSLocalizedString("Unable to uninstall the app", comment: "") case .lookupApps: return NSLocalizedString("Unable to fetch apps from the device", comment: "") case .detach: return NSLocalizedString("Unable to detach from the app's process", comment: "") + case .attach: return NSLocalizedString("Unable to attach to the app's process", comment: "") case .functionArguments: return NSLocalizedString("A function was passed invalid arguments", comment: "") - case .profileInstall: return NSLocalizedString("Unable to manage profiles on the device", comment: "") + case .profileManage: return NSLocalizedString("Unable to manage profiles on the device", comment: "") case .noConnection: return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") + case .invalidPairingFile: return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") } } @@ -118,49 +123,50 @@ enum OperationError: LocalizedError } } -func minimuxer_to_operation(code: Int32) -> OperationError { - switch code { - case 1: +/// crashes if error is not a MinimuxerError +func minimuxerToOperationError(_ error: Error) -> OperationError { + switch error as! MinimuxerError { + case .NoDevice: return OperationError.noDevice - case 2: - return OperationError.createService(name: "debug") - case 3: - return OperationError.createService(name: "instproxy") - case 4: - return OperationError.getFromDevice(name: "installed apps") - case 5: - return OperationError.getFromDevice(name: "path to the app") - case 6: - return OperationError.getFromDevice(name: "bundle path") - case 7: - return OperationError.setArgument(name: "max packet") - case 8: - return OperationError.setArgument(name: "working directory") - case 9: - return OperationError.setArgument(name: "argv") - case 10: - return OperationError.getFromDevice(name: "launch success") - case 11: - return OperationError.detach - case 12: - return OperationError.functionArguments - case 13: - return OperationError.createService(name: "AFC") - case 14: - return OperationError.afc - case 15: - return OperationError.install - case 16: - return OperationError.uninstall - case 17: - return OperationError.createService(name: "misagent") - case 18: - return OperationError.profileInstall - case 19: - return OperationError.profileInstall - case 20: + case .NoConnection: return OperationError.noConnection - default: - return OperationError.unknown + case .PairingFile: + return OperationError.invalidPairingFile + case .CreateDebug: + return OperationError.createService(name: "debug") + case .CreateInstproxy: + return OperationError.createService(name: "instproxy") + case .LookupApps: + return OperationError.getFromDevice(name: "installed apps") + case .FindApp: + return OperationError.getFromDevice(name: "path to the app") + case .BundlePath: + return OperationError.getFromDevice(name: "bundle path") + case .MaxPacket: + return OperationError.setArgument(name: "max packet") + case .WorkingDirectory: + return OperationError.setArgument(name: "working directory") + case .Argv: + return OperationError.setArgument(name: "argv") + case .LaunchSuccess: + return OperationError.getFromDevice(name: "launch success") + case .Detach: + return OperationError.detach + case .Attach: + return OperationError.attach + case .CreateAfc: + return OperationError.createService(name: "AFC") + case .RwAfc: + return OperationError.afc + case .InstallApp: + return OperationError.install + case .UninstallApp: + return OperationError.uninstall + case .CreateMisagent: + return OperationError.createService(name: "misagent") + case .ProfileInstall: + return OperationError.profileManage + case .ProfileRemove: + return OperationError.profileManage } } diff --git a/AltStore/Operations/RefreshAppOperation.swift b/AltStore/Operations/RefreshAppOperation.swift index 084e281c..7747d237 100644 --- a/AltStore/Operations/RefreshAppOperation.swift +++ b/AltStore/Operations/RefreshAppOperation.swift @@ -49,15 +49,12 @@ final class RefreshAppOperation: ResultOperation for p in profiles { do { - let x = try install_provisioning_profile(plist: p.value.data) - if case .Bad(let code) = x { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + let bytes = p.value.data.toRustByteSlice() + try install_provisioning_profile(bytes.forRust()) } catch { - self.finish(.failure(OperationError.unknown)) + return self.finish(.failure(minimuxerToOperationError(error))) } + self.progress.completedUnitCount += 1 let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), app.bundleIdentifier) diff --git a/AltStore/Operations/RemoveAppOperation.swift b/AltStore/Operations/RemoveAppOperation.swift index 6ec3cba4..042828ec 100644 --- a/AltStore/Operations/RemoveAppOperation.swift +++ b/AltStore/Operations/RemoveAppOperation.swift @@ -39,15 +39,11 @@ final class RemoveAppOperation: ResultOperation let resignedBundleIdentifier = installedApp.resignedBundleIdentifier do { - let res = try remove_app(app_id: resignedBundleIdentifier) - if case Uhoh.Bad(let code) = res { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try remove_app(resignedBundleIdentifier) } catch { - self.finish(.failure(ALTServerError(.appDeletionFailed))) + return self.finish(.failure(minimuxerToOperationError(error))) } + DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in self.progress.completedUnitCount += 1 diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index 8be28221..a6098e00 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -61,6 +61,7 @@ final class ResignAppOperation: ResultOperation { let destinationURL = InstalledApp.refreshedIPAURL(for: app) try FileManager.default.copyItem(at: resignedURL, to: destinationURL, shouldReplace: true) + print("Successfully resigned app to \(destinationURL.absoluteString)") // Use appBundleURL since we need an app bundle, not .ipa. guard let resignedApplication = ALTApplication(fileURL: appBundleURL) else { throw OperationError.invalidApp } diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index fb239ba1..dd366968 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -9,6 +9,7 @@ import Foundation import Network import AltStoreCore +import minimuxer @objc(SendAppOperation) final class SendAppOperation: ResultOperation<()> @@ -44,24 +45,18 @@ final class SendAppOperation: ResultOperation<()> print("AFC App `fileURL`: \(fileURL.absoluteString)") - let ns_bundle = NSString(string: app.bundleIdentifier) - let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) - if let data = NSData(contentsOf: fileURL) { - let pls = UnsafeMutablePointer.allocate(capacity: data.length) - for (index, data) in data.enumerated() { - pls[index] = data - } - let res = minimuxer_yeet_app_afc(ns_bundle_ptr, pls, UInt(data.length)) - if res == 0 { - print("minimuxer_yeet_app_afc `res` == \(res)") - self.progress.completedUnitCount += 1 - self.finish(.success(())) - } else { - self.finish(.failure(minimuxer_to_operation(code: res))) + do { + let bytes = Data(data).toRustByteSlice() + try yeet_app_afc(app.bundleIdentifier, bytes.forRust()) + } catch { + return self.finish(.failure(minimuxerToOperationError(error))) } + self.progress.completedUnitCount += 1 + self.finish(.success(())) } else { + print("IPA doesn't exist????") self.finish(.failure(ALTServerError(.underlyingError))) } } diff --git a/Build.xcconfig b/Build.xcconfig index 3c049de8..b0686dea 100644 --- a/Build.xcconfig +++ b/Build.xcconfig @@ -14,11 +14,14 @@ ORG_IDENTIFIER = com.SideStore ORG_PREFIX = $(ORG_IDENTIFIER) PRODUCT_NAME = SideStore -EXTENSION_PREFIX = $(ORG_PREFIX).SideStore //PRODUCT_NAME[configuration=Debug] = Prov Debug PRODUCT_BUNDLE_IDENTIFIER = $(ORG_PREFIX).SideStore -//PRODUCT_BUNDLE_IDENTIFIER[configuration=Debug] = $(ORG_PREFIX).$(PROJECT_NAME:lower)-debug +// add team ID to bundle ID for debug builds since these will most likely be installed via Xcode +// SideStore will expect the team ID to be at the end of the bundle ID, but this doesn't happen when we install via Xcode +// we don't want to do this for release since those builds will most likely be installed via SideServer, which adds the team ID +PRODUCT_BUNDLE_IDENTIFIER[config=Debug] = $(ORG_PREFIX).SideStore.$(DEVELOPMENT_TEAM) -APP_GROUP_IDENTIFIER = $(ORG_PREFIX).SideStore +EXTENSION_PREFIX = $(PRODUCT_BUNDLE_IDENTIFIER) +APP_GROUP_IDENTIFIER = $(PRODUCT_BUNDLE_IDENTIFIER) ICLOUD_CONTAINER_IDENTIFIER = iCloud.$(ORG_PREFIX).$(PROJECT_NAME) diff --git a/Dependencies/fetch-prebuilt.sh b/Dependencies/fetch-prebuilt.sh index 0acbfae3..35760b95 100644 --- a/Dependencies/fetch-prebuilt.sh +++ b/Dependencies/fetch-prebuilt.sh @@ -16,8 +16,8 @@ check_for_update() { LAST_FETCH=`cat .last-prebuilt-fetch-$1 | perl -n -e '/([0-9]*),([^ ]*)$/ && print $1'` LAST_COMMIT=`cat .last-prebuilt-fetch-$1 | perl -n -e '/([0-9]*),([^ ]*)$/ && print $2'` - # fetch if last fetch was over 6 hours ago - if [[ $LAST_FETCH -lt $(expr $(date +%s) - 21600) ]] || [[ "$2" == "force" ]]; then + # fetch if last fetch was over 1 hour ago + if [[ $LAST_FETCH -lt $(expr $(date +%s) - 3600) ]] || [[ "$2" == "force" ]]; then echo "Checking $1 for update" echo LATEST_COMMIT=`curl https://api.github.com/repos/SideStore/$1/releases/latest | perl -n -e '/Commit: https:\\/\\/github\\.com\\/[^\\/]*\\/[^\\/]*\\/commit\\/([^"]*)/ && print $1'` @@ -27,16 +27,30 @@ check_for_update() { if [[ "$LAST_COMMIT" != "$LATEST_COMMIT" ]]; then echo "Found update, downloading binaries" echo - wget -O "$1/lib$1.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1.a" wget -O "$1/lib$1-sim.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1-sim.a" - wget -O "$1/$1.h" "https://github.com/SideStore/$1/releases/latest/download/$1.h" - echo + if [[ "$1" != "minimuxer" ]]; then + wget -O "$1/lib$1.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1.a" + wget -O "$1/$1.h" "https://github.com/SideStore/$1/releases/latest/download/$1.h" + echo + else + wget -O "$1/lib$1-ios.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1-ios.a" + wget -O "$1/generated.zip" "https://github.com/SideStore/$1/releases/latest/download/generated.zip" + echo + echo "Unzipping generated.zip" + cd "$1" + unzip ./generated.zip + mv -v generated/* . + rm generated.zip + rmdir generated/ + cd .. + echo "Done" + fi else echo "Up-to-date" fi echo "$(date +%s),$LATEST_COMMIT" > ".last-prebuilt-fetch-$1" else - echo "It hasn't been 6 hours and force was not specified, skipping update check for $1" + echo "It hasn't been 1 hour and force was not specified, skipping update check for $1" fi } diff --git a/Dependencies/minimuxer.xcodeproj/project.pbxproj b/Dependencies/minimuxer.xcodeproj/project.pbxproj index 062d1729..0eecb844 100644 --- a/Dependencies/minimuxer.xcodeproj/project.pbxproj +++ b/Dependencies/minimuxer.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 9961EC2829BE9C2000AF2C6F /* SwiftBridgeCore.h in Sources */ = {isa = PBXBuildFile; fileRef = 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */; }; 9987603329A454B500818586 /* minimuxer.h in Sources */ = {isa = PBXBuildFile; fileRef = 9987603229A454B500818586 /* minimuxer.h */; }; /* End PBXBuildFile section */ @@ -28,12 +29,22 @@ /* End PBXBuildRule section */ /* Begin PBXFileReference section */ + 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwiftBridgeCore.h; path = minimuxer/SwiftBridgeCore.h; sourceTree = ""; }; 9987603229A454B500818586 /* minimuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = minimuxer.h; path = minimuxer/minimuxer.h; sourceTree = ""; }; ADDEDBA66A6E1 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; CA609C732349C7AAD9FA67C4 /* libminimuxer_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ + 99F87D1529D8E41100B40039 /* Generated */ = { + isa = PBXGroup; + children = ( + 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */, + 9987603229A454B500818586 /* minimuxer.h */, + ); + name = Generated; + sourceTree = ""; + }; ADDEDBA66A6E2 /* Required for static linking */ = { isa = PBXGroup; children = ( @@ -61,7 +72,7 @@ CA6012A875F9D65BC3C892A8 = { isa = PBXGroup; children = ( - 9987603229A454B500818586 /* minimuxer.h */, + 99F87D1529D8E41100B40039 /* Generated */, CA6012A875F922869D176AE5 /* Products */, CA6012A875F998AF0B5890DB /* Frameworks */, ); @@ -74,7 +85,7 @@ isa = PBXNativeTarget; buildConfigurationList = CA600589A243A560B9642892 /* Build configuration list for PBXNativeTarget "minimuxer-staticlib" */; buildPhases = ( - 9987603629A4611D00818586 /* ShellScript */, + 9987603629A4611D00818586 /* Run Script */, CA600F638141A560B9642892 /* Sources */, CA6012A875F9AF6EBB7F357C /* Universal Binary lipo */, ); @@ -121,7 +132,7 @@ /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ - 9987603629A4611D00818586 /* ShellScript */ = { + 9987603629A4611D00818586 /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -130,10 +141,15 @@ ); inputPaths = ( ); + name = "Run Script"; outputFileListPaths = ( ); outputPaths = ( ./minimuxer/minimuxer.h, + ./minimuxer/SwiftBridgeCore.h, + ./minimuxer/minimuxer.swift, + ./minimuxer/SwiftBridgeCore.swift, + "./minimuxer/minimuxer-Bridging-Header.h", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -166,6 +182,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9961EC2829BE9C2000AF2C6F /* SwiftBridgeCore.h in Sources */, 9987603329A454B500818586 /* minimuxer.h in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -182,7 +199,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; LIB_FILE_NAME = ""; - "LIB_FILE_NAME[sdk=iphoneos*]" = libminimuxer; + "LIB_FILE_NAME[sdk=iphoneos*]" = "libminimuxer-ios"; "LIB_FILE_NAME[sdk=iphonesimulator*]" = "libminimuxer-sim"; PRODUCT_NAME = minimuxer_static; SKIP_INSTALL = YES; @@ -199,7 +216,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; LIB_FILE_NAME = ""; - "LIB_FILE_NAME[sdk=iphoneos*]" = libminimuxer; + "LIB_FILE_NAME[sdk=iphoneos*]" = "libminimuxer-ios"; "LIB_FILE_NAME[sdk=iphonesimulator*]" = "libminimuxer-sim"; PRODUCT_NAME = minimuxer_static; SKIP_INSTALL = YES; diff --git a/minimuxer/minimuxer.swift b/minimuxer/minimuxer.swift deleted file mode 100644 index fb024f63..00000000 --- a/minimuxer/minimuxer.swift +++ /dev/null @@ -1,111 +0,0 @@ -// -// minimuxer.swift -// minimuxer -// -// Created by Jackson Coxson on 10/27/22. -// - -import Foundation - -public enum Uhoh: Error { - case Good - case Bad(code: Int32) -} - -public func start_minimuxer(pairing_file: String) -> Int32 { - let pf = NSString(string: pairing_file) - let pf_pointer = UnsafeMutablePointer(mutating: pf.utf8String) - let u = NSString(string: getDocumentsDirectory().absoluteString) - let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) - return minimuxer_c_start(pf_pointer, u_ptr) -} - -public func set_usbmuxd_socket() { - target_minimuxer_address() -} - -public func debug_app(app_id: String) throws -> Uhoh { - let ai = NSString(string: app_id) - let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) - #if false // Retries - var res = minimuxer_debug_app(ai_pointer) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(JIT) ATTEMPTS: \(attempts)") - res = minimuxer_debug_app(ai_pointer) - attempts -= 1 - } - #else - let res = minimuxer_debug_app(ai_pointer) - #endif - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func install_provisioning_profile(plist: Data) throws -> Uhoh { - let pls = String(decoding: plist, as: UTF8.self) - print(pls) - print(plist) - #if false // Retries - var res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(INSTALL) ATTEMPTS: \(attempts)") - res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - attempts -= 1 - } - #else - let x = plist.withUnsafeBytes { buf in UnsafeMutableRawPointer(mutating: buf) } - #endif - let res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func remove_provisioning_profile(id: String) throws -> Uhoh { - let id_ns = NSString(string: id) - let id_pointer = UnsafeMutablePointer(mutating: id_ns.utf8String) - #if false // Retries - var res = minimuxer_remove_provisioning_profile(id_pointer) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(REMOVE PROFILE) ATTEMPTS: \(attempts)") - res = minimuxer_remove_provisioning_profile(id_pointer) - attempts -= 1 - } - #else - let res = minimuxer_remove_provisioning_profile(id_pointer) - #endif - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func remove_app(app_id: String) throws -> Uhoh { - let ai = NSString(string: app_id) - let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) - let res = minimuxer_remove_app(ai_pointer) - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func auto_mount_dev_image() { - let u = NSString(string: getDocumentsDirectory().absoluteString) - let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) - minimuxer_auto_mount(u_ptr) -} - -func getDocumentsDirectory() -> URL { - // find all possible documents directories for this user - let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) - - // just send back the first one, which ought to be the only one - return paths[0] -} From 40e1225b875922d8d0dfe0e713434e4150a26e03 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:09:28 -0700 Subject: [PATCH 17/44] Don't reinstall on first SideStore refresh --- AltStore/Managing Apps/AppManager.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 5bf39ed2..f6fb71ce 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -874,7 +874,11 @@ private extension AppManager // Check if backup app is installed in place of real app. let uti = UTTypeCopyDeclaration(app.installedBackupAppUTI as CFString)?.takeRetainedValue() as NSDictionary? - if app.certificateSerialNumber != group.context.certificate?.serialNumber || + // for some reason, `app.certificateSerialNumber != group.context.certificate?.serialNumber` is true on first SideStore refresh + // in most cases, the first refresh gets stuck since it is a full reinstall, and to fix it you must exit to home screen + // which finishes it but removes all app data + // so we want to ensure we don't reinstall for SideStore if it's true (it will still reinstall if needsResign is true) + if (app.certificateSerialNumber != group.context.certificate?.serialNumber && app.bundleIdentifier != StoreApp.altstoreAppID) || uti != nil || app.needsResign { From c3ea4940d7f22da854e36836ca4230c580360e8e Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:36:27 -0700 Subject: [PATCH 18/44] Reduce duplicate consts --- Shared/Extensions/Bundle+AltStore.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/Extensions/Bundle+AltStore.swift b/Shared/Extensions/Bundle+AltStore.swift index cd3eff27..6754f5c9 100644 --- a/Shared/Extensions/Bundle+AltStore.swift +++ b/Shared/Extensions/Bundle+AltStore.swift @@ -55,7 +55,7 @@ public extension Bundle public extension Bundle { - static var baseAltStoreAppGroupID = "group.com.SideStore.SideStore" + static var baseAltStoreAppGroupID = "group." + Bundle.Info.appbundleIdentifier var appGroups: [String] { return self.infoDictionary?[Bundle.Info.appGroups] as? [String] ?? [] From b8c3060037b7b79b4094aea3f07ae4ad7a46646b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:36:39 -0700 Subject: [PATCH 19/44] Log provisioning profile application groups --- AltStore/Operations/FetchProvisioningProfilesOperation.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 182cedec..74bdeb3b 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -397,6 +397,7 @@ extension FetchProvisioningProfilesOperation applicationGroups.append(Bundle.baseAltStoreAppGroupID) } } + print("Application groups: \(applicationGroups)") // Dispatch onto global queue to prevent appGroupsLock deadlock. DispatchQueue.global().async { From b1ed413c4ff94c18bec04173aa7d3947cb3fd7fb Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:15:04 -0700 Subject: [PATCH 20/44] Revert Joelle's fix --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index 9a7ee78f..dc983b66 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,12 +11,9 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier - static let altstoreBundleIDOriginal = "AltStore" - static let storeBundleID = "SideStore" - static let widgetID = "Widget" var isAltStoreApp: Bool { - let isAltStoreApp = ( self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) || self.bundleIdentifier.contains(ALTApplication.storeBundleID) ) && !self.bundleIdentifier.contains(ALTApplication.widgetID) + let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) return isAltStoreApp } } From 2ce639e7508bee0f85ce34cfebb27076d4236939 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:03:15 -0700 Subject: [PATCH 21/44] Remove app groups that contain AltStore --- .../Operations/FetchProvisioningProfilesOperation.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 74bdeb3b..1b2de2f2 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -382,8 +382,17 @@ extension FetchProvisioningProfilesOperation return completionHandler(.success(appID)) } + print("Application groups before app.isAltStoreApp: \(applicationGroups)") if app.isAltStoreApp { + // Remove app groups that contain AltStore since they can be problematic (cause SideStore to expire early) + for (index, group) in applicationGroups.enumerated() { + if group.contains("AltStore") { + print("Removing application group: \(group)") + applicationGroups.remove(at: index) + } + } + // Potentially updating app groups for this specific AltStore. // Find the (unique) AltStore app group, then replace it // with the correct "base" app group ID. From 20cf54bfcdfe926e2308f9f4e3ccd43d92ac4d31 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 07:34:48 -0700 Subject: [PATCH 22/44] [skip ci] Rename and move the first application groups log --- AltStore/Operations/FetchProvisioningProfilesOperation.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 1b2de2f2..955282f4 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -382,9 +382,10 @@ extension FetchProvisioningProfilesOperation return completionHandler(.success(appID)) } - print("Application groups before app.isAltStoreApp: \(applicationGroups)") if app.isAltStoreApp { + print("Application groups before modifying for SideStore: \(applicationGroups)") + // Remove app groups that contain AltStore since they can be problematic (cause SideStore to expire early) for (index, group) in applicationGroups.enumerated() { if group.contains("AltStore") { From 5710cdf19c2fd16c26222b168b178149f811b458 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 07:58:38 -0700 Subject: [PATCH 23/44] [skip ci] Fix PR commit suffix --- .github/workflows/pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b91318e5..9b2211fb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,7 +23,9 @@ jobs: run: brew install ldid - name: Add PR suffix to version - run: sed -e "/MARKETING_VERSION = .*/s/\$/-pr.${{ github.event.pull_request.number }}+$(git rev-parse --short HEAD)/" -i '' Build.xcconfig + run: sed -e "/MARKETING_VERSION = .*/s/\$/-pr.${{ github.event.pull_request.number }}+$(git rev-parse --short ${COMMIT:-HEAD})/" -i '' Build.xcconfig + env: + COMMIT: ${{ github.event.pull_request.head.sha }} - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 From 9bfda3664748fb00d9e6209700d08cf2678e72af Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 08:00:11 -0700 Subject: [PATCH 24/44] [skip ci] Log version --- .github/workflows/beta.yml | 11 +++++++---- .github/workflows/nightly.yml | 11 +++++++---- .github/workflows/pr.yml | 7 +++++++ .github/workflows/stable.yml | 11 +++++++---- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 0dec182a..789f866f 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -27,6 +27,13 @@ jobs: - name: Change version to tag run: sed -e '/MARKETING_VERSION = .*/s/= .*/= ${{ github.ref_name }}/' -i '' Build.xcconfig + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -53,10 +60,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 42555c0f..c00ce2fb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -36,6 +36,13 @@ jobs: - name: Increase nightly build number and set as version run: bash .github/workflows/increase-nightly-build-num.sh + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -62,10 +69,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9b2211fb..eccf4b0d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,6 +27,13 @@ jobs: env: COMMIT: ${{ github.event.pull_request.head.sha }} + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 7db5cd49..a0d1aeea 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -27,6 +27,13 @@ jobs: - name: Change version to tag run: sed -e '/MARKETING_VERSION = .*/s/= .*/= ${{ github.ref_name }}/' -i '' Build.xcconfig + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -53,10 +60,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT From 98ccba53a254c9ab768fab0a62c1d293878fae15 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 08:01:57 -0700 Subject: [PATCH 25/44] [skip ci] Add version to artifact name we can't do this for releases because some download URLs might rely on it being named SideStore.ipa Build Info will also have version anyways --- .github/workflows/beta.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/stable.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 789f866f..1973681b 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c00ce2fb..96acefed 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -60,7 +60,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index eccf4b0d..7e3df0eb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index a0d1aeea..06a759ae 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact From b2a29ae606c44988393ead4a59c2bd139bc876ae Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 15:08:48 -0700 Subject: [PATCH 26/44] [skip ci] Include commit SHA in nightly version --- .github/workflows/increase-nightly-build-num.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/increase-nightly-build-num.sh b/.github/workflows/increase-nightly-build-num.sh index 4be78710..4d152d07 100644 --- a/.github/workflows/increase-nightly-build-num.sh +++ b/.github/workflows/increase-nightly-build-num.sh @@ -7,7 +7,7 @@ DATE=`date -u +'%Y.%m.%d'` BUILD_NUM=1 write() { - sed -e "/MARKETING_VERSION = .*/s/$/-nightly.$DATE.$BUILD_NUM/" -i '' Build.xcconfig + sed -e "/MARKETING_VERSION = .*/s/$/-nightly.$DATE.$BUILD_NUM+$(git rev-parse --short HEAD)/" -i '' Build.xcconfig echo "$DATE,$BUILD_NUM" > .nightly-build-num } From f5d82d9ef03635af4b281a2c0db3767414b133a5 Mon Sep 17 00:00:00 2001 From: f1shy-dev <56125930+f1shy-dev@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:23:27 +0100 Subject: [PATCH 27/44] Update tempEnt.plist to change AltStore to SideStore Signed-off-by: f1shy-dev <56125930+f1shy-dev@users.noreply.github.com> --- AltStore/Resources/tempEnt.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index 2ae02803..ccb84c68 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -12,9 +12,9 @@ A72ZC8AJ5X com.apple.security.application-groups - group.com.SideStore.AltStore + group.com.SideStore.SideStore get-task-allow - \ No newline at end of file + From 6146f1bdaa3720dea2cf856dce46f251f58e149b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:42:37 -0700 Subject: [PATCH 28/44] Update tempEnt.plist --- AltStore/Resources/tempEnt.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index ccb84c68..a7b3b7dc 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -3,7 +3,7 @@ application-identifier - A72ZC8AJ5X.com.SideStore.AltStore + A72ZC8AJ5X.com.SideStore.SideStore aps-environment development com.apple.developer.siri From 40bcef1dcb572498c98991d8adbbb2eae200006c Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:45:18 -0700 Subject: [PATCH 29/44] Use XYZ0123456 team ID for tempEnt.plist Signed-off-by: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> --- AltStore/Resources/tempEnt.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index a7b3b7dc..8b3ff4bd 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -3,13 +3,13 @@ application-identifier - A72ZC8AJ5X.com.SideStore.SideStore + XYZ0123456.com.SideStore.SideStore aps-environment development com.apple.developer.siri com.apple.developer.team-identifier - A72ZC8AJ5X + XYZ0123456 com.apple.security.application-groups group.com.SideStore.SideStore From b3d827f56a2839ebb09d5222805fb5eb0f3ee44f Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:04:07 -0700 Subject: [PATCH 30/44] refactor: remove minimuxerToOperationError in favor of extending MinimuxerError to be a LocalizedError and remove unused cases from OperationError --- AltStore/LaunchViewController.swift | 2 +- .../Operations/DeactivateAppOperation.swift | 2 +- AltStore/Operations/EnableJITOperation.swift | 2 +- AltStore/Operations/InstallAppOperation.swift | 2 +- AltStore/Operations/OperationError.swift | 135 ++++++++---------- AltStore/Operations/RefreshAppOperation.swift | 2 +- AltStore/Operations/RemoveAppOperation.swift | 2 +- AltStore/Operations/SendAppOperation.swift | 2 +- 8 files changed, 68 insertions(+), 81 deletions(-) diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index cece54c2..9c0abd06 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -153,7 +153,7 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg try start(pairing_file, documentsDirectory) } catch { try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) - displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") + displayError("minimuxer failed to start, please restart SideStore. \((error as? LocalizedError)?.failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") } start_auto_mounter(documentsDirectory) } diff --git a/AltStore/Operations/DeactivateAppOperation.swift b/AltStore/Operations/DeactivateAppOperation.swift index 5742ec87..6feec196 100644 --- a/AltStore/Operations/DeactivateAppOperation.swift +++ b/AltStore/Operations/DeactivateAppOperation.swift @@ -46,7 +46,7 @@ final class DeactivateAppOperation: ResultOperation do { try remove_provisioning_profile(profile) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } } diff --git a/AltStore/Operations/EnableJITOperation.swift b/AltStore/Operations/EnableJITOperation.swift index 1848109b..36081af1 100644 --- a/AltStore/Operations/EnableJITOperation.swift +++ b/AltStore/Operations/EnableJITOperation.swift @@ -48,7 +48,7 @@ final class EnableJITOperation: ResultOperation do { try debug_app(installedApp.resignedBundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.finish(.success(())) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index c9ef8d50..abe24a85 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -152,7 +152,7 @@ final class InstallAppOperation: ResultOperation do { try install_ipa(installedApp.bundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } installedApp.refreshedDate = Date() diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 4e7a86b2..8de1f0ff 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -34,21 +34,6 @@ enum OperationError: LocalizedError case openAppFailed(name: String) case missingAppGroup - case noDevice - case createService(name: String) - case getFromDevice(name: String) - case setArgument(name: String) - case afc - case install - case uninstall - case lookupApps - case detach - case attach - case functionArguments - case profileManage - case noConnection - case invalidPairingFile - var failureReason: String? { switch self { case .unknown: return NSLocalizedString("An unknown error occured.", comment: "") @@ -64,20 +49,6 @@ enum OperationError: LocalizedError case .openAppFailed(let name): return String(format: NSLocalizedString("SideStore was denied permission to launch %@.", comment: ""), name) case .missingAppGroup: return NSLocalizedString("SideStore's shared app group could not be found.", comment: "") case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "") - case .noDevice: return NSLocalizedString("Cannot fetch the device from the muxer", comment: "") - case .createService(let name): return String(format: NSLocalizedString("Cannot start a %@ server on the device.", comment: ""), name) - case .getFromDevice(let name): return String(format: NSLocalizedString("Cannot fetch %@ from the device.", comment: ""), name) - case .setArgument(let name): return String(format: NSLocalizedString("Cannot set %@ on the device.", comment: ""), name) - case .afc: return NSLocalizedString("AFC was unable to manage files on the device", comment: "") - case .install: return NSLocalizedString("Unable to install the app from the staging directory", comment: "") - case .uninstall: return NSLocalizedString("Unable to uninstall the app", comment: "") - case .lookupApps: return NSLocalizedString("Unable to fetch apps from the device", comment: "") - case .detach: return NSLocalizedString("Unable to detach from the app's process", comment: "") - case .attach: return NSLocalizedString("Unable to attach to the app's process", comment: "") - case .functionArguments: return NSLocalizedString("A function was passed invalid arguments", comment: "") - case .profileManage: return NSLocalizedString("Unable to manage profiles on the device", comment: "") - case .noConnection: return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") - case .invalidPairingFile: return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") } } @@ -123,50 +94,66 @@ enum OperationError: LocalizedError } } -/// crashes if error is not a MinimuxerError -func minimuxerToOperationError(_ error: Error) -> OperationError { - switch error as! MinimuxerError { - case .NoDevice: - return OperationError.noDevice - case .NoConnection: - return OperationError.noConnection - case .PairingFile: - return OperationError.invalidPairingFile - case .CreateDebug: - return OperationError.createService(name: "debug") - case .CreateInstproxy: - return OperationError.createService(name: "instproxy") - case .LookupApps: - return OperationError.getFromDevice(name: "installed apps") - case .FindApp: - return OperationError.getFromDevice(name: "path to the app") - case .BundlePath: - return OperationError.getFromDevice(name: "bundle path") - case .MaxPacket: - return OperationError.setArgument(name: "max packet") - case .WorkingDirectory: - return OperationError.setArgument(name: "working directory") - case .Argv: - return OperationError.setArgument(name: "argv") - case .LaunchSuccess: - return OperationError.getFromDevice(name: "launch success") - case .Detach: - return OperationError.detach - case .Attach: - return OperationError.attach - case .CreateAfc: - return OperationError.createService(name: "AFC") - case .RwAfc: - return OperationError.afc - case .InstallApp: - return OperationError.install - case .UninstallApp: - return OperationError.uninstall - case .CreateMisagent: - return OperationError.createService(name: "misagent") - case .ProfileInstall: - return OperationError.profileManage - case .ProfileRemove: - return OperationError.profileManage +extension MinimuxerError: LocalizedError { + public var failureReason: String? { + switch self { + case .NoDevice: + return NSLocalizedString("Cannot fetch the device from the muxer", comment: "") + case .NoConnection: + return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") + case .PairingFile: + return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") + + case .CreateDebug: + return self.createService(name: "debug") + case .LookupApps: + return self.getFromDevice(name: "installed apps") + case .FindApp: + return self.getFromDevice(name: "path to the app") + case .BundlePath: + return self.getFromDevice(name: "bundle path") + case .MaxPacket: + return self.setArgument(name: "max packet") + case .WorkingDirectory: + return self.setArgument(name: "working directory") + case .Argv: + return self.setArgument(name: "argv") + case .LaunchSuccess: + return self.getFromDevice(name: "launch success") + case .Detach: + return NSLocalizedString("Unable to detach from the app's process", comment: "") + case .Attach: + return NSLocalizedString("Unable to attach to the app's process", comment: "") + + case .CreateInstproxy: + return self.createService(name: "instproxy") + case .CreateAfc: + return self.createService(name: "AFC") + case .RwAfc: + return NSLocalizedString("AFC was unable to manage files on the device", comment: "") + case .InstallApp: + return NSLocalizedString("Unable to install the app from the staging directory", comment: "") + case .UninstallApp: + return NSLocalizedString("Unable to uninstall the app", comment: "") + + case .CreateMisagent: + return self.createService(name: "misagent") + case .ProfileInstall: + return NSLocalizedString("Unable to manage profiles on the device", comment: "") + case .ProfileRemove: + return NSLocalizedString("Unable to manage profiles on the device", comment: "") + } + } + + fileprivate func createService(name: String) -> String { + return String(format: NSLocalizedString("Cannot start a %@ server on the device.", comment: ""), name) + } + + fileprivate func getFromDevice(name: String) -> String { + return String(format: NSLocalizedString("Cannot fetch %@ from the device.", comment: ""), name) + } + + fileprivate func setArgument(name: String) -> String { + return String(format: NSLocalizedString("Cannot set %@ on the device.", comment: ""), name) } } diff --git a/AltStore/Operations/RefreshAppOperation.swift b/AltStore/Operations/RefreshAppOperation.swift index 7747d237..edf6a9e5 100644 --- a/AltStore/Operations/RefreshAppOperation.swift +++ b/AltStore/Operations/RefreshAppOperation.swift @@ -52,7 +52,7 @@ final class RefreshAppOperation: ResultOperation let bytes = p.value.data.toRustByteSlice() try install_provisioning_profile(bytes.forRust()) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.progress.completedUnitCount += 1 diff --git a/AltStore/Operations/RemoveAppOperation.swift b/AltStore/Operations/RemoveAppOperation.swift index 042828ec..46400cfa 100644 --- a/AltStore/Operations/RemoveAppOperation.swift +++ b/AltStore/Operations/RemoveAppOperation.swift @@ -41,7 +41,7 @@ final class RemoveAppOperation: ResultOperation do { try remove_app(resignedBundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index dd366968..afa5e57f 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -50,7 +50,7 @@ final class SendAppOperation: ResultOperation<()> let bytes = Data(data).toRustByteSlice() try yeet_app_afc(app.bundleIdentifier, bytes.forRust()) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.progress.completedUnitCount += 1 From d79b166a6a80dd99e36b001a983dcff4ecd06ef5 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:05:53 -0700 Subject: [PATCH 31/44] chore: Remove old apps.json/app.json files --- AltStore.xcodeproj/project.pbxproj | 2 - AltStore/Resources/apps.json | 269 ----------------------------- app.json | 79 --------- 3 files changed, 350 deletions(-) delete mode 100644 AltStore/Resources/apps.json delete mode 100644 app.json diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 8a12bc50..96c93b3d 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -729,7 +729,6 @@ BF9ABA4A22DD137F008935CF /* NavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBar.swift; sourceTree = ""; }; BF9ABA4C22DD16DE008935CF /* PillButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillButton.swift; sourceTree = ""; }; BFA8172A23C5633D001B5953 /* FetchAnisetteDataOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchAnisetteDataOperation.swift; sourceTree = ""; }; - BFB1169C22932DB100BB457C /* apps.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = apps.json; sourceTree = ""; }; BFB39B5B252BC10E00D1BE50 /* Managed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Managed.swift; sourceTree = ""; }; BFB4323E22DE852000B7F8BC /* UpdateCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UpdateCollectionViewCell.xib; sourceTree = ""; }; BFB6B21D231870160022A802 /* NewsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsViewController.swift; sourceTree = ""; }; @@ -1619,7 +1618,6 @@ isa = PBXGroup; children = ( BF44EEF2246B3A17002A52F2 /* AltBackup.ipa */, - BFB1169C22932DB100BB457C /* apps.json */, BFD247762284B9A700981D42 /* Assets.xcassets */, BF770E6822BD57DD002A40FE /* Silence.m4a */, ); diff --git a/AltStore/Resources/apps.json b/AltStore/Resources/apps.json deleted file mode 100644 index c7a3bad2..00000000 --- a/AltStore/Resources/apps.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "name": "AltStore", - "identifier": "com.rileytestut.AltStore", - "sourceURL": "https://cdn.altstore.io/file/altstore/apps.json", - "apps": [ - { - "name": "AltStore", - "bundleIdentifier": "com.rileytestut.AltStore", - "developerName": "Riley Testut", - "version": "1.5.1", - "versionDate": "2022-07-14T12:00:00-05:00", - "versionDescription": "This update fixes the following issues:\n\n• Using Apple IDs that contain capital letters\n• Using Apple IDs with 2FA enabled without any trusted devices\n• Repeatedly asking some users to sign in every refresh\n• \"Incorrect Apple ID or password\" error after changing Apple ID email address\n• “Application is missing application-identifier” error when sideloading or (de-)activating certain apps\n• Potential crash when receiving unknown error codes from AltServer", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_5_1.ipa", - "localizedDescription": "AltStore is an alternative app store for non-jailbroken devices. \n\nThis version of AltStore allows you to install Delta, an all-in-one emulator for iOS, as well as sideload other .ipa files from the Files app.", - "iconURL": "https://user-images.githubusercontent.com/705880/65270980-1eb96f80-dad1-11e9-9367-78ccd25ceb02.png", - "tintColor": "018084", - "size": 5465976, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "AltStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows AltStore to run longer than 30 seconds when refreshing apps in background." - } - ] - }, - { - "name": "AltStore", - "bundleIdentifier": "com.rileytestut.AltStore.Beta", - "developerName": "Riley Testut", - "subtitle": "An alternative App Store for iOS.", - "version": "1.6b2", - "versionDate": "2022-09-21T13:00:00-05:00", - "versionDescription": "• Fixed “error migrating persistent store” issue on launch\n\nPREVIOUS VERSION\n\nLock Screen Widget (iOS 16+)\n• Counts down days until AltStore expires\n• Comes in 2 different styles: “icon” and “text”\n\nError Log\n• View past errors in more detail\n• Tap an error to copy the error message or error code\n• Search for error code directly in AltStore FAQ", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_6_b2.ipa", - "localizedDescription": "AltStore is an alternative app store for non-jailbroken devices. \n\nThis beta release of AltStore adds support for 3rd party sources, allowing you to download apps from other developers directly through AltStore.", - "iconURL": "https://user-images.githubusercontent.com/705880/65270980-1eb96f80-dad1-11e9-9367-78ccd25ceb02.png", - "tintColor": "018084", - "size": 5465933, - "beta": true, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "AltStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows AltStore to run longer than 30 seconds when refreshing apps in background." - } - ] - }, - { - "name": "Delta", - "bundleIdentifier": "com.rileytestut.Delta", - "developerName": "Riley Testut", - "subtitle": "Classic games in your pocket.", - "version": "1.3.1", - "versionDate": "2021-12-02T13:30:00-08:00", - "versionDescription": "• Fixes game artwork not loading\n• Fixes using deprecated DeSmuME core over melonDS core for some users", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/delta/1_3_1.ipa", - "localizedDescription": "Delta is an all-in-one emulator for iOS. Delta builds upon the strengths of its predecessor, GBA4iOS, while expanding to include support for more game systems such as NES, SNES, and N64.\n\nFEATURES\n\nSupported Game Systems\n• Nintendo Entertainment System\n• Super Nintendo Entertainment System\n• Nintendo 64\n• Game Boy (Color)\n• Game Boy Advance\n• Nintendo DS\n• And plenty more to come!\n\nController Support\n• Supports PS4, PS5, Xbox One S, Xbox Series X, and MFi game controllers.\n• Supports bluetooth (and wired) keyboards, as well as the Apple Smart Keyboard.\n• Completely customize button mappings on a per-system, per-controller basis.\n• Map buttons to special “Quick Save”, “Quick Load,” and “Fast Forward” actions.\n\nSave States\n• Save and load save states for any game from the pause menu.\n• Lock save states to prevent them from being accidentally overwritten.\n• Automatically makes backup save states to ensure you never lose your progress.\n• Support for “Quick Saves,” save states that can be quickly saved/loaded with a single button press (requires external controller).\n\nCheats\n• Supports various types of cheat codes for each supported system:\n• NES: Game Genie\n• SNES: Game Genie, Pro Action Replay\n• N64: GameShark\n• GBC: Game Genie, GameShark\n• GBA: Action Replay, Code Breaker, GameShark\n• DS: Action Replay\n\nDelta Sync\n• Sync your games, game saves, save states, cheats, controller skins, and controller mappings between devices.\n• View version histories of everything you sync and optionally restore them to earlier versions.\n• Supports both Google Drive and Dropbox.\n\nCustom Controller Skins\n• Beautiful built-in controller skins for all systems.\n• Import controller skins made by others, or even make your own to share with the world!\n\nHold Button\n• Choose buttons for Delta to hold down on your behalf, freeing up your thumbs to press other buttons instead.\n• Perfect for games that typically require one button be held down constantly (ex: run button in Mario games, or the A button in Mario Kart).\n\nFast Forward\n• Speed through slower parts of games by running the game much faster than normal.\n• Easily enable or disable from the pause menu, or optionally with a mapped button on an external controller.\n\n3D/Haptic Touch\n• Use 3D or Haptic Touch to “peek” at games, save states, and cheat codes.\n• App icon shortcuts allow quick access to your most recently played games, or optionally customize the shortcuts to always include certain games.\n\nGame Artwork\n• Automatically displays appropriate box art for imported games.\n• Change a game’s artwork to anything you want, or select from the built-in game artwork database.\n\nMisc.\n• Gyroscope support (WarioWare: Twisted! only)\n• Microphone support (DS only)\n• Support for delta:// URL scheme to jump directly into a specific game.\n\n**Delta and AltStore LLC are in no way affiliated with Nintendo. The name \"Nintendo\" and all associated game console names are registered trademarks of Nintendo Co., Ltd.**", - "iconURL": "https://user-images.githubusercontent.com/705880/63391976-4d311700-c37a-11e9-91a8-4fb0c454413d.png", - "tintColor": "8A28F7", - "size": 19739373, - "permissions": [ - { - "type": "photos", - "usageDescription": "Allows Delta to use images from your Photo Library as game artwork." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/65600448-f7d9be00-df54-11e9-9e3e-d4c31296da94.PNG", - "https://user-images.githubusercontent.com/705880/65813009-f2ae8600-e183-11e9-9eb7-704effc11173.png", - "https://user-images.githubusercontent.com/705880/65601117-58b5c600-df56-11e9-9c19-9a5ba5da54cf.PNG", - "https://user-images.githubusercontent.com/705880/65601125-5b182000-df56-11e9-9e7e-261480e893c0.PNG" - ] - }, - { - "name": "Delta", - "bundleIdentifier": "com.rileytestut.Delta.Beta", - "developerName": "Riley Testut", - "subtitle": "Classic games in your pocket.", - "version": "1.4b2", - "versionDate": "2022-08-16T08:00:00-05:00", - "versionDescription": "NEW\n• Supports Split View and Stage Manager multitasking on iPad\n• Automatically pauses + resumes emulation when switching between foreground apps with Stage Manager\n• Optimized full screen-width controller skins when using Split View, Slide Over, or Stage Manager\n• Supports controller skins with new `placement` parameter\n• Supports controller skins with custom screens that don’t have explicit `outputFrame`\n\nFIXED\n• Fixed not detecting keyboard presses when remapping inputs\n• Fixed potential crash rendering game screen after changing EAGLContext\n• Fixed incorrect game screen frame when software keyboard appears on iOS 16\n• Fixed software keyboard sometimes appearing when not emulating anything", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/delta/1_4_b2.ipa", - "localizedDescription": "The next consoles for Delta are coming: this beta version of Delta brings support for playing Nintendo DS and Sega Genesis games!\n\nPlease report any issues you find to support@altstore.io. Thanks!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391976-4d311700-c37a-11e9-91a8-4fb0c454413d.png", - "tintColor": "8A28F7", - "size": 42968657, - "beta": true, - "permissions": [ - { - "type": "photos", - "usageDescription": "Allows Delta to use images from your Photo Library as game artwork." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/65600448-f7d9be00-df54-11e9-9e3e-d4c31296da94.PNG", - "https://user-images.githubusercontent.com/705880/65601942-e5ad4f00-df57-11e9-9255-1463e0296e46.PNG", - "https://user-images.githubusercontent.com/705880/65813009-f2ae8600-e183-11e9-9eb7-704effc11173.png", - "https://user-images.githubusercontent.com/705880/65601117-58b5c600-df56-11e9-9c19-9a5ba5da54cf.PNG" - ] - }, - { - "name": "Clip", - "bundleIdentifier": "com.rileytestut.Clip", - "subtitle": "Manage your clipboard history with ease.", - "developerName": "Riley Testut", - "version": "1.0", - "versionDate": "2020-06-17T12:30:00-07:00", - "versionDescription": "Initial version 🎉", - "downloadURL": "https://f000.backblazeb2.com/file/altstore/apps/clip/1_0.ipa", - "localizedDescription": "Clip is a simple clipboard manager for iOS. \n\nUnlike other clipboard managers, Clip can continue monitoring your clipboard while in the background. No longer do you need to remember to manually open or share to an app to save your clipboard; just copy and paste as you would normally do, and Clip will have your back.\n\nIn addition to background monitoring, Clip also has these features:\n\n• Save text, URLs, and images copied to the clipboard.\n• Copy, delete, or share any clippings saved to Clip.\n• Customizable history limit.\n\nDownload Clip today, and never worry about losing your clipboard again!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391981-5326f800-c37a-11e9-99d8-760fd06bb601.png", - "tintColor": "EC008C", - "size": 445056, - "permissions": [ - { - "type": "background-audio", - "usageDescription": "Allows Clip to continuously monitor your clipboard in the background." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/63391950-34286600-c37a-11e9-965f-832efe3da507.png", - "https://user-images.githubusercontent.com/705880/70830209-8e738980-1da4-11ea-8b3b-6e5fbc78adff.png" - ] - }, - { - "name": "Clip", - "bundleIdentifier": "com.rileytestut.Clip.Beta", - "subtitle": "Manage your clipboard history with ease.", - "developerName": "Riley Testut", - "version": "1.1b1", - "versionDate": "2020-06-17T12:30:00-07:00", - "versionDescription": "This update adds a Custom Keyboard app extension for quick access to clippings when editing text.\n\nTo enable the keyboard, go to Settings > General > Keyboard > Keyboards > Add New Keyboard... and add \"ClipBoard\". Once added, make sure to then enable \"Allow Full Access\" for ClipBoard so it can access your clippings.", - "downloadURL": "https://f000.backblazeb2.com/file/altstore/apps/clip/1_1_b1.ipa", - "localizedDescription": "Clip is a simple clipboard manager for iOS. \n\nUnlike other clipboard managers, Clip can continue monitoring your clipboard while in the background. No longer do you need to remember to manually open or share to an app to save your clipboard; just copy and paste as you would normally do, and Clip will have your back.\n\nIn addition to background monitoring, Clip also has these features:\n\n• Save text, URLs, and images copied to the clipboard.\n• Copy, delete, or share any clippings saved to Clip.\n• Customizable history limit.\n\nDownload Clip today, and never worry about losing your clipboard again!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391981-5326f800-c37a-11e9-99d8-760fd06bb601.png", - "tintColor": "EC008C", - "size": 462771, - "beta": true, - "permissions": [ - { - "type": "background-audio", - "usageDescription": "Allows Clip to continuously monitor your clipboard in the background." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/63391950-34286600-c37a-11e9-965f-832efe3da507.png", - "https://user-images.githubusercontent.com/705880/70830209-8e738980-1da4-11ea-8b3b-6e5fbc78adff.png", - "https://user-images.githubusercontent.com/705880/84842227-70a80b00-aff9-11ea-8b04-bedb1f49c4a7.PNG", - "https://user-images.githubusercontent.com/705880/84842231-7271ce80-aff9-11ea-9272-e128aeceb95b.PNG" - ] - } - ], - "news": [ - { - "title": "Delta Gaining DS Support", - "identifier": "delta-ds-support", - "caption": "Available this Saturday for patrons, coming soon for everyone else.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/65603159-0676a400-df5a-11e9-882e-dc5566f4d50a.png", - "date": "2019-09-25", - "notify": false - }, - { - "title": "Delta Now Available", - "identifier": "delta-now-available", - "caption": "Finally, relive your favorite NES, SNES, GB(C), GBA, and N64 games.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/65604130-c1ec0800-df5b-11e9-8150-7657c474e3c3.png", - "appID": "com.rileytestut.Delta", - "date": "2019-09-28", - "notify": true - }, - { - "title": "Sideloading is Here!", - "identifier": "sideloading-is-here", - "caption": "Update to AltStore 1.3 to install any app directly from Files.", - "tintColor": "018084", - "imageURL": "https://user-images.githubusercontent.com/705880/79022069-02932380-7b32-11ea-8bad-49907cb97ece.png", - "date": "2020-04-10T13:00:00-07:00", - "notify": true - }, - { - "title": "iOS 13.4 Fixes App Crashes", - "identifier": "ios-13-4-now-available", - "caption": "Update to iOS 13.4 to fix some sideloaded apps crashing on launch.", - "tintColor": "34C759", - "date": "2020-04-10T13:30:00-07:00", - "notify": false - }, - { - "title": "Clip Now Available!", - "identifier": "clip-now-available", - "caption": "Finally, a clipboard manager that can run in the background — no jailbreak required.", - "tintColor": "EC008C", - "imageURL": "https://user-images.githubusercontent.com/705880/65606598-04afdf00-df60-11e9-8f93-af6345d39557.png", - "appID": "com.rileytestut.Clip", - "date": "2020-06-17", - "notify": true - }, - { - "title": "Delta, Meet Nintendo DS", - "identifier": "delta-meet-ds", - "caption": "Update to Delta 1.3 to relive all your favorite Nintendo DS games.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/115617602-6ce2b600-a2a6-11eb-984e-2197a30c71e2.png", - "appID": "com.rileytestut.Delta", - "date": "2021-04-21", - "notify": true - }, - { - "title": "#StandWithUkraine", - "identifier": "support-ukraine", - "caption": "Find out how you can help support those impacted by the Russian invasion.", - "tintColor": "003e80", - "imageURL": "https://user-images.githubusercontent.com/705880/156053447-a158cac7-df5f-4497-8025-15c3c2e10b48.png", - "url": "https://linktr.ee/razomforukraine", - "date": "2022-03-01", - "notify": false - }, - { - "title": "The Biggest AltServer Update Yet!", - "identifier": "altserver-1-5", - "caption": "Update to AltServer 1.5 to use AltJIT and other exciting new features.", - "tintColor": "018084", - "imageURL": "https://user-images.githubusercontent.com/705880/166509576-744be578-6868-4b7d-b4fd-b9418c084327.png", - "url": "https://faq.altstore.io/release-notes/altserver", - "date": "2022-05-03", - "notify": true - }, - { - "title": "More Apps in AltStore!", - "identifier": "trusted-sources", - "caption": "Update to AltStore 1.5 to easily download some of our favorite apps.", - "tintColor": "00CAB3", - "imageURL": "https://user-images.githubusercontent.com/705880/167026375-ddcb004f-7160-405c-b3e3-87a6795d2f43.png", - "url": "https://faq.altstore.io/release-notes/altstore", - "date": "2022-05-05", - "notify": true - }, - { - "title": "New to AltStore?", - "identifier": "updated-faq", - "caption": "Check out our updated guide to learn how to sideload apps!", - "tintColor": "018084", - "url": "https://faq.altstore.io", - "date": "2022-07-28", - "notify": false - } - ], - "userInfo": { - "patreonAccessToken": "uqoDoTxH8dY1ImE8tK76wxrzKk67gjyjBAcK8sD3RLU" - } -} diff --git a/app.json b/app.json deleted file mode 100644 index f0b7dabb..00000000 --- a/app.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "SideStore Offical", - "identifier": "com.SideStore.SideStore", - "sourceURL": "https://apps.sidestore.io/", - "apps": [ - { - "name": "SideStore", - "bundleIdentifier": "com.SideStore.SideStore", - "developerName": "SideStore Team", - "version": "0.1.1", - "versionDate": "2022-010-15T12:00:00-05:00", - "versionDescription": "If you see this then please sideload the new version of SideStore via AltServer!", - "downloadURL": "https://github.com/SideStore/SideStore/releases/download/0.1.1/SideStore.ipa", - "localizedDescription": "SideStore is an alternative app store for non-jailbroken devices. \n\nSideStore allows you to sideload other .ipa files and apps from the Files app or via the SideStore Library", - "iconURL": "https://raw.githubusercontent.com/SideStore/apps.json/main/105070799.jpeg", - "tintColor": "8043FF", - "size": 5465976, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "SideStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows SideStore to run longer than 30 seconds when refreshing apps in background." - } - ] - } - ], - "news": [ - { - "title": "Rick on the rocks", - "identifier": "rick", - "caption": "never gonna give ya rocks", - "tintColor": "912F8D", - "imageURL": "https://variety.com/wp-content/uploads/2021/07/Rick-Astley-Never-Gonna-Give-You-Up.png?w=681&h=383&crop=1", - "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "date": "2022-05-06", - "notify": false - }, - { - "title": "Rick waves his arms around", - "identifier": "no", - "caption": "never gonna", - "tintColor": "912F8D", - "imageURL": "https://variety.com/wp-content/uploads/2021/07/Rick-Astley-Never-Gonna-Give-You-Up.png?w=681&h=383&crop=1", - "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "date": "2022-05-05", - "notify": false - }, - { - "title": "#StandWithUkraine", - "identifier": "support-ukraine", - "caption": "Find out how you can help support those impacted by the Russian invasion.", - "tintColor": "003e80", - "imageURL": "https://user-images.githubusercontent.com/705880/156053447-a158cac7-df5f-4497-8025-15c3c2e10b48.png", - "url": "https://linktr.ee/razomforukraine", - "date": "2022-03-01", - "notify": false - }, - { - "title": "New to SideStore?", - "identifier": "updated-faq", - "caption": "Good luck!", - "tintColor": "8043FF", - "url": "https://faq.sidestore.io", - "date": "2050-07-28", - "notify": false - } - ], - "userInfo": { - "patreonAccessToken": "uqoDoTxH8dY1ImE8tK76wxrzKk67gjyjBAcK8sD3RLU" - } -} From 00f7a684a31e009103ca8b372329edad467af7f6 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:09:32 -0700 Subject: [PATCH 32/44] [skip ci] chore: rename tempEnt.plist to ReleaseEntitlements.plist to reduce future confusion --- AltStore/Resources/{tempEnt.plist => ReleaseEntitlements.plist} | 0 Makefile | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename AltStore/Resources/{tempEnt.plist => ReleaseEntitlements.plist} (100%) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/ReleaseEntitlements.plist similarity index 100% rename from AltStore/Resources/tempEnt.plist rename to AltStore/Resources/ReleaseEntitlements.plist diff --git a/Makefile b/Makefile index 503859bf..3163b86c 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,7 @@ build: fakesign: rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/ - ldid -SAltStore/Resources/tempEnt.plist archive.xcarchive/Products/Applications/SideStore.app/SideStore + ldid -SAltStore/Resources/ReleaseEntitlements.plist archive.xcarchive/Products/Applications/SideStore.app/SideStore ipa: mkdir Payload From 536f775baab49bccb59ffd21b93da3790e7af361 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:12:01 -0700 Subject: [PATCH 33/44] Revert "Don't reinstall on first SideStore refresh" This reverts commit 40e1225b875922d8d0dfe0e713434e4150a26e03. --- AltStore/Managing Apps/AppManager.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index f6fb71ce..5bf39ed2 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -874,11 +874,7 @@ private extension AppManager // Check if backup app is installed in place of real app. let uti = UTTypeCopyDeclaration(app.installedBackupAppUTI as CFString)?.takeRetainedValue() as NSDictionary? - // for some reason, `app.certificateSerialNumber != group.context.certificate?.serialNumber` is true on first SideStore refresh - // in most cases, the first refresh gets stuck since it is a full reinstall, and to fix it you must exit to home screen - // which finishes it but removes all app data - // so we want to ensure we don't reinstall for SideStore if it's true (it will still reinstall if needsResign is true) - if (app.certificateSerialNumber != group.context.certificate?.serialNumber && app.bundleIdentifier != StoreApp.altstoreAppID) || + if app.certificateSerialNumber != group.context.certificate?.serialNumber || uti != nil || app.needsResign { From 3dd0735305e281b6920a120d8ae5574b1a14067a Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:50:15 -0700 Subject: [PATCH 34/44] fix: always reinstall when refreshing ourselves --- AltStore/Managing Apps/AppManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 5bf39ed2..fc28cfba 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -876,7 +876,9 @@ private extension AppManager if app.certificateSerialNumber != group.context.certificate?.serialNumber || uti != nil || - app.needsResign + app.needsResign || + // We need to reinstall ourselves on refresh to ensure the new provisioning profile is used + app.bundleIdentifier == StoreApp.altstoreAppID { // Resign app instead of just refreshing profiles because either: // * Refreshing using different certificate From 8a97c409facda05aa676527b8cc2021fa5438ffb Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Wed, 12 Apr 2023 07:46:14 -0700 Subject: [PATCH 35/44] fix: add .AltWidget to app group ID when modifying for SideStore --- .../FetchProvisioningProfilesOperation.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 955282f4..2782a467 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -394,17 +394,26 @@ extension FetchProvisioningProfilesOperation } } + // Make sure we add .AltWidget for the widget + var altStoreAppGroupID = Bundle.baseAltStoreAppGroupID + for (_, group) in applicationGroups.enumerated() { + if group.contains("AltWidget") { + altStoreAppGroupID += ".AltWidget" + break + } + } + // Potentially updating app groups for this specific AltStore. // Find the (unique) AltStore app group, then replace it // with the correct "base" app group ID. // Otherwise, we may append a duplicate team identifier to the end. if let index = applicationGroups.firstIndex(where: { $0.contains(Bundle.baseAltStoreAppGroupID) }) { - applicationGroups[index] = Bundle.baseAltStoreAppGroupID + applicationGroups[index] = altStoreAppGroupID } else { - applicationGroups.append(Bundle.baseAltStoreAppGroupID) + applicationGroups.append(altStoreAppGroupID) } } print("Application groups: \(applicationGroups)") From 0178c63f6ae3273ce227f147308eb2039de5fd14 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:53:27 -0700 Subject: [PATCH 36/44] fix: hopefully reduce ApplicationVerificationFailed errors by removing _CodeSignature folders since those may cause a problem --- AltStore/Operations/ResignAppOperation.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index a6098e00..12760205 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -148,6 +148,14 @@ private extension ResignAppOperation infoDictionary[Bundle.Info.exportedUTIs] = exportedUTIs try (infoDictionary as NSDictionary).write(to: bundle.infoPlistURL) + + // Remove _CodeSignature folder (if it exists) because it will be added when resigning and it may have files that aren't overwritten when resigning + // These files might be the cause of some ApplicationVerificationFailed errors + let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString + if FileManager.default.fileExists(atPath: codeSignaturePath) { + try FileManager.default.removeItem(atPath: codeSignaturePath) + print("Removed _CodeSignature folder at \(codeSignaturePath)") + } } DispatchQueue.global().async { From 1ca3aa3cdb50e73e830411850b843be926755e57 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 07:20:36 -0700 Subject: [PATCH 37/44] fix: force close SideStore after 3 seconds if still reinstalling --- AltStore/Operations/InstallAppOperation.swift | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index abe24a85..41deab1a 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -149,9 +149,45 @@ final class InstallAppOperation: ResultOperation }) } + // Since reinstalling ourself will hang until we leave the app, force quit after 3 seconds if still installing + var installing = true + if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + if installing { + print("We are still installing after 3 seconds") + + let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must force close itself. Please reopen SideStore after continuing!", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in + if installing { + print("Closing SideStore since we are still installing") + exit(0) + } else { + print("Not closing SideStore since installing finished") + } + })) + + let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first + if var topController = keyWindow?.rootViewController { + while let presentedViewController = topController.presentedViewController { + topController = presentedViewController + } + + topController.present(alert, animated: true) + } else { + print("No key window? Closing SideStore") + exit(0) + } + } else { + print("Installing finished") + } + } + } + do { try install_ipa(installedApp.bundleIdentifier) + installing = false } catch { + installing = false return self.finish(.failure(error)) } From 51ed87086ab6165d3461a86656941edfb80f0983 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 07:30:20 -0700 Subject: [PATCH 38/44] [skip ci] ci: fully rename SideStore.ipa, even after extracting the artifact zip --- .github/workflows/beta.yml | 27 +++++++++++++++------------ .github/workflows/nightly.yml | 27 +++++++++++++++------------ .github/workflows/pr.yml | 7 +++++-- .github/workflows/stable.yml | 27 +++++++++++++++------------ 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 1973681b..e5792b55 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -48,18 +48,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -91,3 +79,18 @@ jobs: Built at (UTC date): `${{ steps.date_altstore.outputs.date }}` Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 96acefed..aea20363 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -57,18 +57,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -99,5 +87,20 @@ jobs: Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ + - name: Reset cache for apps.sidestore.io/nightly run: sleep 10 && curl https://apps.sidestore.io/reset-cache/nightly/${{ secrets.SIDESOURCE_KEY }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7e3df0eb..6befcfbb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,14 +48,17 @@ jobs: - name: Convert to IPA run: make ipa + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore-dSYM + name: SideStore-${{ steps.version.outputs.version }}-dSYM path: ./*.dSYM/ diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 06a759ae..d1a6d1e5 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -48,18 +48,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -88,3 +76,18 @@ jobs: Built at (UTC date): `${{ steps.date_altstore.outputs.date }}` Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ From f519d22d81b837a522add8e654aa8f80d96496b8 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 21:21:51 -0700 Subject: [PATCH 39/44] fix: removing _CodeSignature folder before resigning --- AltStore/Operations/ResignAppOperation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index 12760205..59336d86 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -151,7 +151,7 @@ private extension ResignAppOperation // Remove _CodeSignature folder (if it exists) because it will be added when resigning and it may have files that aren't overwritten when resigning // These files might be the cause of some ApplicationVerificationFailed errors - let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString + let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString.replacingOccurrences(of: "file://", with: "") if FileManager.default.fileExists(atPath: codeSignaturePath) { try FileManager.default.removeItem(atPath: codeSignaturePath) print("Removed _CodeSignature folder at \(codeSignaturePath)") From ee5ddd426481bed99652945755476e138b194b6b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 16 Apr 2023 09:29:12 -0700 Subject: [PATCH 40/44] fix: use a notification instead of an alert for force close --- AltStore/Operations/InstallAppOperation.swift | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 41deab1a..12db3326 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -154,29 +154,14 @@ final class InstallAppOperation: ResultOperation if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { DispatchQueue.main.asyncAfter(deadline: .now() + 3) { if installing { - print("We are still installing after 3 seconds") + print("We are still installing after 3 seconds, requesting notification and then closing") - let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must force close itself. Please reopen SideStore after continuing!", preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in - if installing { - print("Closing SideStore since we are still installing") - exit(0) - } else { - print("Not closing SideStore since installing finished") - } - })) - - let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first - if var topController = keyWindow?.rootViewController { - while let presentedViewController = topController.presentedViewController { - topController = presentedViewController - } - - topController.present(alert, animated: true) - } else { - print("No key window? Closing SideStore") - exit(0) - } + var content = UNMutableNotificationContent() + content.title = "Refreshing..." + content.body = "To finish refreshing, SideStore must force close itself. Please reopen SideStore after it is done refreshing!" + let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)) + UNUserNotificationCenter.current().add(notification) + exit(0) } else { print("Installing finished") } From 07533e0365b04f3d797e2ea0e73287a84969dc96 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 16 Apr 2023 10:07:04 -0700 Subject: [PATCH 41/44] fix: ensure minimuxer is started when refreshing in the background --- AltStore/Operations/BackgroundRefreshAppsOperation.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AltStore/Operations/BackgroundRefreshAppsOperation.swift b/AltStore/Operations/BackgroundRefreshAppsOperation.swift index 0b3aa209..e38a9a1c 100644 --- a/AltStore/Operations/BackgroundRefreshAppsOperation.swift +++ b/AltStore/Operations/BackgroundRefreshAppsOperation.swift @@ -11,6 +11,7 @@ import CoreData import AltStoreCore import EmotionalDamage +import minimuxer enum RefreshError: LocalizedError { @@ -97,6 +98,14 @@ final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result Date: Sat, 6 May 2023 19:25:37 -0700 Subject: [PATCH 42/44] fix: open Safari instead of force closing and provide a fallback for users with notifications disabled --- AltStore/Operations/InstallAppOperation.swift | 59 +++++++++++++++---- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 12db3326..bc866498 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -149,21 +149,58 @@ final class InstallAppOperation: ResultOperation }) } - // Since reinstalling ourself will hang until we leave the app, force quit after 3 seconds if still installing var installing = true if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { + // Reinstalling ourself will hang until we leave the app, so we need to exit it without force closing DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - if installing { - print("We are still installing after 3 seconds, requesting notification and then closing") - - var content = UNMutableNotificationContent() - content.title = "Refreshing..." - content.body = "To finish refreshing, SideStore must force close itself. Please reopen SideStore after it is done refreshing!" - let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)) - UNUserNotificationCenter.current().add(notification) - exit(0) - } else { + if UIApplication.shared.applicationState != .active { + print("We are not in the foreground, let's not do anything") + return + } + if !installing { print("Installing finished") + return + } + print("We are still installing after 3 seconds") + + UNUserNotificationCenter.current().getNotificationSettings { settings in + switch (settings.authorizationStatus) { + case .authorized, .ephemeral, .provisional: + print("Notifications are enabled") + + let content = UNMutableNotificationContent() + content.title = "Refreshing..." + content.body = "To finish refreshing, SideStore must be moved to the background, which it does by opening Safari. Please reopen SideStore after it is done refreshing!" + let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 2, repeats: false)) + UNUserNotificationCenter.current().add(notification) + + DispatchQueue.main.async { UIApplication.shared.open(URL(string: "x-web-search://")!) } + + break + default: + print("Notifications are not enabled") + + let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must be moved to the background. To do this, you can either go to the Home Screen or open Safari by pressing Continue. Please reopen SideStore after doing this.", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in + print("Opening Safari") + DispatchQueue.main.async { UIApplication.shared.open(URL(string: "x-web-search://")!) } + })) + + DispatchQueue.main.async { + let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first + if var topController = keyWindow?.rootViewController { + while let presentedViewController = topController.presentedViewController { + topController = presentedViewController + } + topController.present(alert, animated: true) + } else { + print("No key window? Let's just open Safari") + UIApplication.shared.open(URL(string: "x-web-search://")!) + } + } + + break + } } } } From 1c0d0be62214ac75d565c26f117a89b84bb148ce Mon Sep 17 00:00:00 2001 From: SoY0ung <32095074+SoY0ung@users.noreply.github.com> Date: Sun, 14 May 2023 02:55:36 +0800 Subject: [PATCH 43/44] Fix 'The name for this app is invalid' error This error is related to App ID creation failure. App ID name must be an ascii text. It is not allowed to create an App ID with non-ascii text like Chinese, Japanese. If the name is NOT an ascii text, using bundleID instead. --- .../FetchProvisioningProfilesOperation.swift | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 2782a467..69f47449 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -268,8 +268,17 @@ extension FetchProvisioningProfilesOperation } } } + //App ID name must be ascii. If the name is not ascii, using bundleID instead + let appIDName: String + if containsNonASCII(text: name) { + //Contains non ASCII (Such as Chinese/Japanese...), using bundleID + appIDName = bundleIdentifier + }else { + //ASCII text, keep going as usual + appIDName = name + } - ALTAppleAPI.shared.addAppID(withName: name, bundleIdentifier: bundleIdentifier, team: team, session: session) { (appID, error) in + ALTAppleAPI.shared.addAppID(withName: appIDName, bundleIdentifier: bundleIdentifier, team: team, session: session) { (appID, error) in do { do @@ -514,3 +523,13 @@ extension FetchProvisioningProfilesOperation } } } + +func containsNonASCII(text: String) -> Bool { + let ascii = CharacterSet(charactersIn: "\0"..."~") + for scalar in text.unicodeScalars { + if !ascii.contains(scalar) { + return true + } + } + return false +} From 84e2284f5691d58f0808723d071b49cb44fb348e Mon Sep 17 00:00:00 2001 From: SoY0ung <32095074+SoY0ung@users.noreply.github.com> Date: Sun, 14 May 2023 19:06:22 +0800 Subject: [PATCH 44/44] Optimizing function calls Thanks for @ktprograms advice --- .../FetchProvisioningProfilesOperation.swift | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 69f47449..89663226 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -270,7 +270,7 @@ extension FetchProvisioningProfilesOperation } //App ID name must be ascii. If the name is not ascii, using bundleID instead let appIDName: String - if containsNonASCII(text: name) { + if !name.allSatisfy({ $0.isASCII }) { //Contains non ASCII (Such as Chinese/Japanese...), using bundleID appIDName = bundleIdentifier }else { @@ -523,13 +523,3 @@ extension FetchProvisioningProfilesOperation } } } - -func containsNonASCII(text: String) -> Bool { - let ascii = CharacterSet(charactersIn: "\0"..."~") - for scalar in text.unicodeScalars { - if !ascii.contains(scalar) { - return true - } - } - return false -}