Open source CapCut alternative.
TypeScript
fix(app): surface updates a non-admin user cannot install [rebuild]
David Ledd7be1521a55
diff --git a/apps/Donkey/Sources/Donkey/DonkeyStatusItemController.swift b/apps/Donkey/Sources/Donkey/DonkeyStatusItemController.swiftindex 824a5222..214f6c97 100644--- a/apps/Donkey/Sources/Donkey/DonkeyStatusItemController.swift+++ b/apps/Donkey/Sources/Donkey/DonkeyStatusItemController.swift@@ -138,6 +138,8 @@ final class DonkeyStatusItemController: NSObject, NSMenuDelegate {return ("Checking for Updates…", false, true)case .installing:return ("Updating…", false, true)+ case .requiresAdmin:+ return ("Update Requires an Admin", false, false)default:return ("Check for Updates", true, false)}diff --git a/apps/Donkey/Sources/Donkey/SparkleUpdateController.swift b/apps/Donkey/Sources/Donkey/SparkleUpdateController.swiftindex 6eb02e7c..0a506ace 100644--- a/apps/Donkey/Sources/Donkey/SparkleUpdateController.swift+++ b/apps/Donkey/Sources/Donkey/SparkleUpdateController.swift@@ -117,6 +117,14 @@ final class SparkleUpdateController: NSObject, DonkeyUpdateChecking, SPUUserDrivstate: SPUUserUpdateState,reply: @escaping (SPUUserUpdateChoice) -> Void) {+ // The silent install replaces the app bundle in place. When this user cannot write it+ // (a non-admin account with the app in /Applications), installing would dead-end in an+ // admin credentials prompt, so surface that state instead of offering the install.+ guard FileManager.default.isWritableFile(atPath: Bundle.main.bundlePath) else {+ reply(.dismiss)+ emit(.requiresAdmin, latestVersion: appcastItem.displayVersionString)+ return+ }// Hold the decision and light up the notch button instead of installing immediately.pendingInstall = replyemit(.available, latestVersion: appcastItem.displayVersionString)diff --git a/apps/Donkey/Sources/Donkey/UpdateContracts.swift b/apps/Donkey/Sources/Donkey/UpdateContracts.swiftindex 226c154b..26fbd6b7 100644--- a/apps/Donkey/Sources/Donkey/UpdateContracts.swift+++ b/apps/Donkey/Sources/Donkey/UpdateContracts.swift@@ -8,6 +8,9 @@ public enum DonkeyUpdateStatus: String, Equatable, Sendable {case upToDatecase availablecase installing+ /// An update exists but the app bundle is not writable by this user, so the silent install+ /// would dead-end in an admin prompt this user cannot answer.+ case requiresAdmincase unavailablecase failed}