Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(macos): hold Mac updates until the App Store has the iPhone app
leepokai922136c30449
diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.ymlindex 8d4dea7e..cb5eca20 100644--- a/.github/workflows/release-macos.yml+++ b/.github/workflows/release-macos.yml@@ -131,6 +131,9 @@ jobs:--download-url-prefix "https://github.com/leepokai/Codync/releases/download/v${VERSION}/" \--link https://www.codync.dev/ \-o build/appcast.xml build/updates+ # The iPhone app this release needs: Macs with iPhones wait until the App Store has it.+ MIN_APP=$("$RUNNER_TEMP/Codync.app/Contents/MacOS/codync-host" compat | python3 -c 'import json,sys; print(json.load(sys.stdin)["minApp"])')+ python3 packaging/updates/annotate-appcast.py build/appcast.xml "$MIN_APP"python3 -m venv "$RUNNER_TEMP/update-verification""$RUNNER_TEMP/update-verification/bin/pip" install 'cryptography>=44,<47'"$RUNNER_TEMP/update-verification/bin/python" packaging/updates/verify-appcast.py \diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swiftindex 44dc1043..24eaca2b 100644--- a/apps/macos/App/CodyncMacApp.swift+++ b/apps/macos/App/CodyncMacApp.swift@@ -138,6 +138,10 @@ struct MenuView: View {updates.checkForUpdates()}.disabled(!updates.canCheckForUpdates && !updates.hasStagedUpdate)+ if let app = updates.waitingForApp {+ // The release waits until paired iPhones can get the app it needs.+ Text("Waiting for iPhone app \(app) to pass App Store review")+ }Toggle("Automatically check for updates", isOn: Binding(get: { updates.automaticallyChecksForUpdates },set: { updates.automaticallyChecksForUpdates = $0 }diff --git a/apps/macos/App/UpdatesManager.swift b/apps/macos/App/UpdatesManager.swiftindex b864b1df..8b58765f 100644--- a/apps/macos/App/UpdatesManager.swift+++ b/apps/macos/App/UpdatesManager.swift@@ -1,4 +1,5 @@import AppKit+import CodyncKitimport Observationimport Sparkle@@ -13,6 +14,8 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUStaprivate(set) var errorMessage: String?private(set) var hasStagedUpdate = falseprivate(set) var preparingInstallation = false+ /// The iPhone app the available release needs while the App Store doesn't have it yet.+ private(set) var waitingForApp: String?var automaticallyChecksForUpdates = true {didSet { controller?.updater.automaticallyChecksForUpdates = automaticallyChecksForUpdates }@@ -35,6 +38,11 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUSta@ObservationIgnored private var automaticInstall: (() -> Void)?@ObservationIgnored private var servicesPrepared = false@ObservationIgnored private var preparationTask: Task<Bool, Never>?+ /// For the App Store gate, refreshed before manual checks and every few hours: Sparkle asks+ /// its delegate synchronously (docs/reference/compatibility.md).+ @ObservationIgnored private var appStoreVersion: String?+ @ObservationIgnored private var iphonesPaired: Bool?+ @ObservationIgnored private var gateTask: Task<Void, Never>?func start(host: HostController) {guard controller == nil, isSupported else { return }@@ -62,6 +70,19 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUSta} catch {errorMessage = error.localizedDescription}+ gateTask = Task { [weak self] in+ while !Task.isCancelled {+ await self?.refreshGate()+ try? await Task.sleep(for: .seconds(6 * 3600))+ }+ }+ }++ private func refreshGate() async {+ if let version = try? await AppStoreRelease.latestVersion() { appStoreVersion = version }+ if let devices = try? await host?.store?.client?.devices() {+ iphonesPaired = devices.contains { $0.platform == "ios" }+ }}private func readSettings() {@@ -90,7 +111,10 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUStaguard canCheckForUpdates else { return }errorMessage = nilNSApp.activate()- controller?.checkForUpdates(nil)+ Task {+ await refreshGate()+ controller?.checkForUpdates(nil)+ }}func retryInstallation() {@@ -141,6 +165,24 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUSta}}+ /// A release that needs a newer iPhone app than the App Store has (still in review) waits,+ /// so paired iPhones aren't asked for an update they can't get yet. Without an answer from+ /// the App Store, background checks wait and a check the person started goes ahead.+ func updater(_ updater: SPUUpdater, shouldProceedWithUpdate item: SUAppcastItem, updateCheck: SPUUpdateCheck) throws {+ waitingForApp = nil+ guard let required = item.propertiesDictionary["codync:minApp"] as? String,+ AppVersion.isBelow(host?.store?.hostVersion?.minApp ?? "0", required),+ iphonesPaired != false else { return }+ if let appStoreVersion, AppVersion.parse(appStoreVersion) != nil, !AppVersion.isBelow(appStoreVersion, required) {+ return+ }+ if appStoreVersion == nil && updateCheck == .updates { return }+ waitingForApp = required+ throw NSError(domain: "Codync", code: 1, userInfo: [NSLocalizedDescriptionKey:+ "Codync \(item.displayVersionString) needs the iPhone app \(required), which isn't in the App Store yet. "+ + "It installs once that version passes review."])+ }+func updater(_ updater: SPUUpdater, shouldPostponeRelaunchForUpdate item: SUAppcastItem,untilInvokingBlock installHandler: @escaping () -> Void) -> Bool {hasStagedUpdate = truediff --git a/packaging/updates/annotate-appcast.py b/packaging/updates/annotate-appcast.pynew file mode 100755index 00000000..b89a2ed0--- /dev/null+++ b/packaging/updates/annotate-appcast.py@@ -0,0 +1,28 @@+#!/usr/bin/env python3+"""Add the iPhone app version a release needs (codync:minApp) to its Sparkle appcast item.++The Mac app reads it from the item before installing (docs/reference/compatibility.md).+The feed itself isn't signed; Sparkle signs the archive, so editing the XML is safe.+"""+import sys+import xml.etree.ElementTree as ET++SPARKLE = "http://www.andymatuschak.org/xml-namespaces/sparkle"+CODYNC = "https://codync.dev/xml-namespaces/appcast"+++def main():+ feed, min_app = sys.argv[1:]+ ET.register_namespace("sparkle", SPARKLE)+ ET.register_namespace("dc", "http://purl.org/dc/elements/1.1/")+ ET.register_namespace("codync", CODYNC)+ tree = ET.parse(feed)+ items = tree.getroot().findall("./channel/item")+ assert len(items) == 1, "expected one current release"+ element = ET.SubElement(items[0], f"{{{CODYNC}}}minApp")+ element.text = min_app+ tree.write(feed, xml_declaration=True, encoding="utf-8")+++if __name__ == "__main__":+ main()diff --git a/packaging/updates/verify-appcast.py b/packaging/updates/verify-appcast.pyindex a7b94210..8a8db654 100644--- a/packaging/updates/verify-appcast.py+++ b/packaging/updates/verify-appcast.py@@ -31,6 +31,8 @@ def main():)assert info["SUPublicEDKey"] == public_key, "app has the wrong Sparkle public key"assert info["SUVerifyUpdateBeforeExtraction"] is True+ min_app = item.findtext("{https://codync.dev/xml-namespaces/appcast}minApp")+ assert min_app and all(part.isdigit() for part in min_app.split(".")), "appcast needs codync:minApp"print("Sparkle appcast matches the signed app and release archive")