Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Peel says in About when a new version of it is out

Țugui Dragoșa70233884dc3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c5320c0..161f146d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ The first public release, for macOS 26 and later, on Apple silicon and Intel Mac
what it didn't move, with the reason.
- Leaves alone the files, folders, and apps you exclude.
- Checks your apps for updates, and watches the Trash for apps you remove yourself.
+- Says in About when a new version of Peel is out, with where to get it, and downloads nothing itself.
- Exports what is installed and where each app came from, as JSON, CSV, plain text, or a Brewfile.
- Comes with the `peel` command for Terminal, a Finder extension, and actions for Shortcuts.
- Speaks English and 17 other languages.
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 2976de1a..9c65318a 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -3215,6 +3215,112 @@
}
}
},
+ "%@ is out" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vyšla verze %@"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ verfügbar"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ disponible"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ disponible"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ disponibile"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@が公開"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 출시됨"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ is verschenen"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dostępna wersja %@"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ disponível"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A apărut %@"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вышла версия %@"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ har släppts"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ çıktı"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вийшла %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@已发布"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@已推出"
+ }
+ }
+ }
+ },
"%@ is up to date" : {
"localizations" : {
"cs" : {
@@ -20932,6 +21038,112 @@
}
}
},
+ "Copy Command" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zkopírovat příkaz"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Befehl kopieren"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copiar comando"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copier la commande"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copia comando"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "コマンドをコピー"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "명령 복사"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kopieer commando"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kopiuj polecenie"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copiar Comando"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copiați comanda"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Скопировать команду"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kopiera kommando"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Komutu Kopyala"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Скопіювати команду"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "拷贝命令"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "拷貝指令"
+ }
+ }
+ }
+ },
"Copy Details" : {
"localizations" : {
"cs" : {
@@ -24560,6 +24772,218 @@
}
}
},
+ "Download" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Stáhnout"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Laden"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Descargar"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Télécharger"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Scarica"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ダウンロード"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "다운로드"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Download"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pobierz"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Baixar"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Descărcați"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Загрузить"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hämta"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "İndir"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Викачати"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "下载"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "下載"
+ }
+ }
+ }
+ },
+ "Download it, then replace this copy in Applications." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Stáhněte si ji a pak jí nahraďte tuto kopii ve složce Aplikace."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lade sie und ersetze dann diese Kopie im Ordner „Programme“."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Descárgala y luego reemplaza esta copia en la carpeta Aplicaciones."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Téléchargez-la, puis remplacez cette copie dans le dossier Applications."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Scaricala, poi sostituisci questa copia nella cartella Applicazioni."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ダウンロードしてから、“アプリケーション”フォルダにあるこのPeelを新しいバージョンに置き換えてください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "다운로드한 다음 응용 프로그램 폴더에서 이 복사본을 새로운 버전으로 대치하십시오."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Download de nieuwe versie en vervang daarmee deze kopie in de map 'Apps'."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pobierz ją, a potem zastąp nią tę kopię w folderze Aplikacje."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Baixe-a e depois substitua esta cópia na pasta Aplicativos."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Descărcați‑o, apoi înlocuiți cu ea această copie din dosarul Aplicații."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Загрузите ее, а затем замените эту копию в папке «Программы»."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hämta den och ersätt sedan den här kopian i mappen Appar."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "İndirin, ardından Uygulamalar klasöründeki bu kopyayı yenisiyle değiştirin."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Викачайте її, а потім замініть нею цю копію в папці «Програми»."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "请下载新版本,然后在“应用程序”文件夹中用它替换此Peel副本。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "請下載新版本,然後用它取代「應用程式」檔案夾中的這份副本。"
+ }
+ }
+ }
+ },
"Downloaded" : {
"localizations" : {
"cs" : {
@@ -36371,6 +36795,112 @@
}
}
},
+ "Homebrew installed this copy, so upgrade it by running the command in Terminal." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tuto kopii nainstaloval Homebrew, proto ji upgradujte spuštěním příkazu v Terminálu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Da Homebrew diese Kopie installiert hat, führe für das Upgrade den Befehl im Terminal aus."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew instaló esta copia, así que, para actualizarla, ejecuta el comando en Terminal."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew a installé cette copie : mettez-la donc à niveau en exécutant la commande dans Terminal."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Questa copia è stata installata da Homebrew, quindi aggiornala eseguendo il comando in Terminale."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このPeelはHomebrewでインストールされたため、ターミナルでコマンドを実行してアップグレードしてください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew가 이 복사본을 설치했으므로 터미널에서 이 명령을 실행하여 업그레이드하십시오."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew heeft deze kopie geïnstalleerd, dus upgrade die door het commando in Terminal uit te voeren."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tę kopię zainstalował Homebrew, więc aby ją uaktualnić, uruchom polecenie w Terminalu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Homebrew instalou esta cópia, então faça upgrade dela executando o comando no Terminal."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew a instalat această copie, așa că faceți‑i upgrade rulând comanda în Terminal."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Эту копию установил Homebrew, поэтому обновите ее, выполнив команду в Терминале."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Homebrew installerade den här kopian, så uppgradera den genom att köra kommandot i Terminal."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu kopyayı Homebrew yükledi, bu yüzden onu yükseltmek için komutu Terminal’de çalıştırın."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Цю копію інсталював Homebrew, тож оновіть її, виконавши команду в Терміналі."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此Peel副本由Homebrew安装,因此请在“终端”中运行该命令来升级它。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "這份副本是由Homebrew安裝的,因此請在「終端機」中執行此指令來升級它。"
+ }
+ }
+ }
+ },
"Homebrew installs command-line tools as formulae and apps as casks. On this page Peel only runs Homebrew’s own commands and reads what they report." : {
"localizations" : {
"cs" : {
@@ -106972,6 +107502,112 @@
}
}
},
+ "The latest release of Peel itself. Peel says when a new one is out and downloads nothing." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nejnovější vydání samotného Peelu. Peel dá vědět, když vyjde nové, a nic nestahuje."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Die neueste Version von Peel selbst. Peel zeigt an, wenn eine neue verfügbar ist, und lädt nichts."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La versión más reciente del propio Peel. Peel avisa cuando sale una nueva y no descarga nada."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La dernière version de Peel lui-même. Peel indique quand une nouvelle version est disponible et ne télécharge rien."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "L’ultima versione di Peel stesso. Peel segnala quando ne è disponibile una nuova e non scarica nulla."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel自身の最新リリースを確認します。新しいリリースが公開されたときに知らせますが、何もダウンロードしません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel 자체의 최신 릴리즈 정보입니다. Peel은 새로운 버전이 출시되면 알려 주며, 아무것도 다운로드하지 않습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "De nieuwste versie van Peel zelf. Peel laat weten wanneer er een nieuwe is verschenen, en downloadt niets."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Najnowsze wydanie samego Peel. Peel informuje, gdy pojawi się nowe, i niczego nie pobiera."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A versão mais recente do próprio Peel. O Peel avisa quando uma nova está disponível e não baixa nada."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cea mai recentă versiune a aplicației Peel înseși. Peel vă spune când apare una nouă și nu descarcă nimic."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Последний выпуск самого Peel. Peel сообщает, когда выходит новый, и ничего не загружает."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Den senaste versionen av Peel själv. Peel talar om när en ny version har släppts och hämtar ingenting."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel’in kendi en son sürümü. Peel, yeni bir sürüm çıktığında bunu söyler ve hiçbir şey indirmez."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Найновіший випуск самої Peel. Peel повідомляє, коли виходить новий, і нічого не викачує."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel本身的最新发布版本。Peel会在有新版本发布时告诉你,但不会下载任何内容。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel本身的最新發行版本。Peel會在有新版本推出時告訴你,但不會下載任何內容。"
+ }
+ }
+ }
+ },
"The latest version of apps installed from the App Store." : {
"localizations" : {
"cs" : {
@@ -120174,6 +120810,112 @@
}
}
},
+ "Version %@ is out." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vyšla verze %@."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Version %@ ist verfügbar."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ya está disponible la versión %@."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La version %@ est disponible."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "È disponibile la versione %@."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "バージョン%@が公開されました。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 버전이 출시되었습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Versie %@ is verschenen."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dostępna jest wersja %@."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A versão %@ está disponível."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A apărut versiunea %@."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вышла версия %@."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Version %@ har släppts."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ sürümü çıktı."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вийшла версія %@."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "版本%@已发布。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "版本%@已推出。"
+ }
+ }
+ }
+ },
"Version %@ skipped" : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
index a3ca1594..06a4eaf5 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
@@ -100,12 +100,12 @@ public struct Inventory: Sendable {
if app.isFromSetapp {
return ("Setapp", nil)
}
- // `.appStore` only means Peel asks the App Store's lookup API about updates. The receipt inside the
- // bundle is the only thing that says an app was installed from there.
+ // `.appStore` and `.gitHubRelease` only say where Peel asks about updates. The receipt inside the bundle
+ // is the only thing that says an app was installed from the App Store.
return switch app.updateFeed {
case .sparkle(let url): ("Sparkle", url.absoluteString)
case .electron(let url): ("Electron", url.absoluteString)
- case .appStore, nil: origins?.address(of: app.url).map { ("Downloaded", $0.absoluteString) } ?? ("Unknown", nil)
+ case .appStore, .gitHubRelease, nil: origins?.address(of: app.url).map { ("Downloaded", $0.absoluteString) } ?? ("Unknown", nil)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/GitHubRelease.swift b/Packages/PeelCore/Sources/PeelCore/Updates/GitHubRelease.swift
new file mode 100644
index 00000000..849b3ea1
--- /dev/null
+++ b/Packages/PeelCore/Sources/PeelCore/Updates/GitHubRelease.swift
@@ -0,0 +1,30 @@
+import Foundation
+
+/// A repository's latest release, as GitHub's REST API answers it: the newest one that is neither a draft nor a
+/// prerelease.
+enum GitHubRelease {
+ /// Peel's own releases, the one repository Peel asks about: no other app says where it is released.
+ static let peel = URL(string: "https://api.github.com/repos/TuguiDragos/Peel/releases/latest")!
+
+ /// The version the release's tag names, and the release's page on GitHub, where it is downloaded. Nil for an
+ /// answer in any other form.
+ static func latest(in data: Data) -> (version: String, page: URL?)? {
+ guard let release = try? JSONDecoder().decode(Release.self, from: data) else { return nil }
+ let version = release.tagName.first == "v" || release.tagName.first == "V"
+ ? String(release.tagName.dropFirst())
+ : release.tagName
+ guard !version.isEmpty else { return nil }
+ let page = release.htmlURL.flatMap(URL.init(string:)).flatMap { $0.scheme == "https" && $0.host() == "github.com" ? $0 : nil }
+ return (version, page)
+ }
+
+ private struct Release: Decodable {
+ let tagName: String
+ let htmlURL: String?
+
+ enum CodingKeys: String, CodingKey {
+ case tagName = "tag_name"
+ case htmlURL = "html_url"
+ }
+ }
+}
diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift
index 922aa3ab..cd98ed5f 100644
--- a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift
@@ -89,6 +89,7 @@ public struct UpdateChecker: Sendable {
case nil: UpdateAnswer(status: .unsupported)
case .sparkle(let url): UpdateAnswer(status: await sparkleStatus(for: app, at: url))
case .electron(let url): UpdateAnswer(status: await electronStatus(for: app, at: url))
+ case .gitHubRelease(let url): UpdateAnswer(status: await gitHubReleaseStatus(for: app, at: url))
case .appStore: await appStoreAnswer(for: app)
}
}
@@ -120,6 +121,13 @@ public struct UpdateChecker: Sendable {
: .upToDate
}
+ private func gitHubReleaseStatus(for app: InstalledApp, at url: URL) async -> UpdateStatus {
+ guard let data = await fetch(url), let release = GitHubRelease.latest(in: data) else { return .failed }
+ return VersionComparison.isNewer(release.version, than: app.version ?? "")
+ ? .updateAvailable(version: release.version, source: .developer, releaseNotes: release.page)
+ : .upToDate
+ }
+
/// Asks the App Store about `app`, but only when the app has an App Store receipt, whoever calls this.
/// Asking about other apps would send Apple, one identifier at a time, the list of installed apps.
private func appStoreAnswer(for app: InstalledApp) async -> UpdateAnswer {
diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift
index 80ad6785..00ed84a0 100644
--- a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift
@@ -1,8 +1,11 @@
public import Foundation
+internal import PeelPrivileged
public enum UpdateFeed: Sendable, Hashable {
case sparkle(URL)
case electron(URL)
+ /// Peel's own releases on GitHub (`GitHubRelease`).
+ case gitHubRelease(URL)
case appStore
}
@@ -55,6 +58,9 @@ extension UpdateFeed {
if isFromAppStore {
return .appStore
}
+ if (info["CFBundleIdentifier"] as? String)?.lowercased() == HelperIdentity.appIdentifier.lowercased() {
+ return .gitHubRelease(GitHubRelease.peel)
+ }
if let feed = (info["SUFeedURL"] as? String).flatMap(URL.init(string:)), feed.scheme == "https" {
return .sparkle(feed)
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift
index 1b6a4fab..25194ed9 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift
@@ -123,6 +123,30 @@ private final class CannedProtocol: URLProtocol, @unchecked Sendable {
#expect(await checker.status(for: fed, preference: .automatic, casks: [current]) == .upToDate)
}
+ /// Peel asks GitHub for its own latest release, the newest that is neither a draft nor a prerelease, and says a
+ /// newer one is out with the release's page, where it is downloaded. A page anywhere but GitHub is not believed,
+ /// and an answer in another form, or none, is a failed check.
+ @Test func peelLearnsOfItsOwnNewReleaseFromGitHub() async {
+ let peel = InstalledApp(url: URL(filePath: "/Applications/Peel.app"), bundleIdentifier: "com.tuguidragos.Peel", name: "Peel", version: "1.0.1", updateFeed: .gitHubRelease(GitHubRelease.peel))
+ let page = "https://github.com/TuguiDragos/Peel/releases/tag/v1.0.2"
+
+ reply("api.github.com", #"{"tag_name":"v1.0.2","html_url":"\#(page)","draft":false,"prerelease":false}"#)
+ #expect(await checker.status(for: peel) == .updateAvailable(version: "1.0.2", source: .developer, releaseNotes: URL(string: page)))
+ #expect(CannedProtocol.asked.withLock { $0 } == ["api.github.com"])
+
+ reply("api.github.com", #"{"tag_name":"v1.0.2","html_url":"https://example.com/peel.dmg"}"#)
+ #expect(await checker.status(for: peel) == .updateAvailable(version: "1.0.2", source: .developer, releaseNotes: nil))
+
+ reply("api.github.com", #"{"tag_name":"v1.0.1","html_url":"https://github.com/TuguiDragos/Peel/releases/tag/v1.0.1"}"#)
+ #expect(await checker.status(for: peel) == .upToDate)
+
+ reply("api.github.com", status: 404, #"{"message":"Not Found"}"#)
+ #expect(await checker.status(for: peel) == .failed)
+
+ reply("api.github.com", "<html>")
+ #expect(await checker.status(for: peel) == .failed)
+ }
+
/// An app sold once for iPhone, iPad, and Mac has one record, of kind "software", whose version is the
/// iPhone's. For an app the store doesn't sell in this region, or anymore, Apple answers with no record at
/// all. Neither is a failed check: there is no Mac version to read, so the app is `.unsupported` and is asked
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
index 1bd1a4f3..2e9d6bb1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
@@ -233,6 +233,16 @@ struct UpdateFeedDetectionTests {
#expect(UpdateFeed.detect(info: info, contents: contents, isFromAppStore: false, isSystemProtected: true) == nil)
#expect(UpdateFeed.detect(info: info, contents: contents, isFromAppStore: false, isSystemProtected: false) == .sparkle(try #require(URL(string: "https://example.com/appcast.xml"))))
}
+
+ /// Peel's own copy is checked against its releases on GitHub. No other app says where it is released, so no
+ /// other app is asked about there.
+ @Test func onlyPeelAsksGitHubForItsLatestRelease() throws {
+ let directory = try TemporaryDirectory()
+ let contents = try directory.directory("Peel.app/Contents")
+ let peel = UpdateFeed.detect(info: ["CFBundleIdentifier": "com.tuguidragos.Peel"], contents: contents, isFromAppStore: false, isSystemProtected: false)
+ #expect(peel == .gitHubRelease(GitHubRelease.peel))
+ #expect(UpdateFeed.detect(info: ["CFBundleIdentifier": "com.example.editor"], contents: contents, isFromAppStore: false, isSystemProtected: false) == nil)
+ }
}
struct TeamRegistryTests {
diff --git a/Peel/HomeSnapshot.swift b/Peel/HomeSnapshot.swift
index 49333eea..5018a7c8 100644
--- a/Peel/HomeSnapshot.swift
+++ b/Peel/HomeSnapshot.swift
@@ -27,7 +27,7 @@ enum HomeSnapshot {
// The permissions at their widest, and at their narrowest, where Home puts its two halves side by side.
render(HomePermissionsContent().environment(home).environment(helper).environment(ExclusionsStore.shared).environment(found), width: 720, on: window, scheme: scheme, contrast: contrast, to: "\(directory)/home-detail-\(name).png")
render(HomePermissionsContent().environment(home).environment(helper).environment(ExclusionsStore.shared).environment(found), width: 480, on: window, scheme: scheme, contrast: contrast, to: "\(directory)/detail-narrow-\(name).png")
- render(AboutContent().fixedSize(horizontal: false, vertical: true), width: AboutContent.width, on: Album.sheet, scheme: scheme, contrast: contrast, to: "\(directory)/about-\(name).png")
+ render(AboutContent().environment(AppLibrary()).fixedSize(horizontal: false, vertical: true), width: AboutContent.width, on: Album.sheet, scheme: scheme, contrast: contrast, to: "\(directory)/about-\(name).png")
render(MenuBarPanel().environment(AppLibrary()).environment(stats), width: 320, scheme: scheme, contrast: contrast, to: "\(directory)/menu-bar-\(name).png")
}
}
diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swift
index 9abb6d17..ffd3b568 100644
--- a/Peel/Model/AppLibrary.swift
+++ b/Peel/Model/AppLibrary.swift
@@ -474,13 +474,33 @@ final class AppLibrary {
/// Whether an update is waiting for `app`. An ignored app has none, and neither has one whose waiting
/// version was skipped. The list, the menu bar, and the notification all ask this, so they always agree.
+ /// Peel's own is told by About instead (`newerPeel`).
func hasUpdate(_ app: InstalledApp) -> Bool {
- updatePreferences.isWaiting(updateStatuses[app.id], for: app)
+ !app.isPeelItself && updatePreferences.isWaiting(updateStatuses[app.id], for: app)
}
/// The answer about `app`'s updates that its page shows: an update the user muted is not announced again.
func shownUpdateStatus(of app: InstalledApp) -> UpdateStatus? {
- updatePreferences.shownStatus(updateStatuses[app.id], for: app)
+ app.isPeelItself ? nil : updatePreferences.shownStatus(updateStatuses[app.id], for: app)
+ }
+
+ /// A newer release of the copy of Peel that is running, which About tells and never installs.
+ struct PeelUpdate: Equatable {
+ let version: String
+ /// The release's page on GitHub, where it is downloaded.
+ let page: URL?
+ /// The command that upgrades a copy Homebrew installed, which Peel never runs on itself.
+ let homebrewCommand: String?
+ }
+
+ var newerPeel: PeelUpdate? {
+ let running = PathPattern.comparablePath(of: Bundle.main.bundleURL)
+ guard
+ let peel = apps.first(where: { PathPattern.comparablePath(of: $0.url) == running }),
+ let status = updateStatuses[peel.id], let version = status.displayVersion
+ else { return nil }
+ let command = status.source == .homebrew ? cask(for: peel).map { "brew upgrade --cask \($0.name)" } : nil
+ return PeelUpdate(version: version, page: status.releaseNotes, homebrewCommand: command)
}
var appsWithUpdates: [InstalledApp] { apps.filter(hasUpdate) }
diff --git a/Peel/Navigation/Links.swift b/Peel/Navigation/Links.swift
index f19df653..2f44f985 100644
--- a/Peel/Navigation/Links.swift
+++ b/Peel/Navigation/Links.swift
@@ -5,6 +5,7 @@ import PeelCore
enum Links {
static let author = URL(string: "https://tuguidragos.com")!
static let repository = URL(string: "https://github.com/TuguiDragos/Peel")!
+ static let latestRelease = repository.appending(path: "releases/latest")
static let license = URL(string: "https://www.gnu.org/licenses/gpl-3.0.html")!
static let argumentParser = URL(string: "https://github.com/apple/swift-argument-parser")!
static let blobatar = URL(string: "https://github.com/Alain00/blobatar")!
diff --git a/Peel/Navigation/ToolSidebar.swift b/Peel/Navigation/ToolSidebar.swift
index 312ca62f..af477d96 100644
--- a/Peel/Navigation/ToolSidebar.swift
+++ b/Peel/Navigation/ToolSidebar.swift
@@ -12,6 +12,7 @@ enum SidebarDestination: Hashable {
struct ToolSidebar: View {
@Environment(HomeModel.self) private var home
+ @Environment(AppLibrary.self) private var library
@Environment(\.accessibilityReduceMotion) private var reduceMotion
@AppStorage("sidebar.apps.expanded") private var isAppsExpanded = true
@AppStorage("sidebar.storage.expanded") private var isStorageExpanded = true
@@ -100,9 +101,15 @@ struct ToolSidebar: View {
VStack(alignment: .leading, spacing: 0) {
Text(verbatim: "Peel")
.font(.callout.weight(.semibold))
- Text(verbatim: AppVersion.display)
- .font(.caption)
- .foregroundStyle(.secondary)
+ if let update = library.newerPeel {
+ Text("\(update.version) is out")
+ .font(.caption)
+ .foregroundStyle(.tint)
+ } else {
+ Text(verbatim: AppVersion.display)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
}
.lineLimit(1)
Spacer(minLength: 0)
@@ -118,7 +125,7 @@ struct ToolSidebar: View {
.padding(.top, -8)
.padding(.bottom, 8)
.accessibilityLabel(Text(AboutView.title))
- .accessibilityValue(Text(verbatim: AppVersion.display))
+ .accessibilityValue(library.newerPeel.map { Text("Version \($0.version) is out.") } ?? Text(verbatim: AppVersion.display))
}
/// A group whose rows are added and removed here rather than by a collapsible `Section`, because SwiftUI
diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swift
index e9e5cddf..6fc56b10 100644
--- a/Peel/PeelApp.swift
+++ b/Peel/PeelApp.swift
@@ -294,6 +294,7 @@ struct PeelApp: App {
Window(Text(AboutView.title), id: AboutView.windowID) {
AboutView()
+ .environment(library)
}
.windowResizability(.contentSize)
.windowStyle(.hiddenTitleBar)
diff --git a/Peel/Views/AboutView.swift b/Peel/Views/AboutView.swift
index 18990b21..bb1a33ea 100644
--- a/Peel/Views/AboutView.swift
+++ b/Peel/Views/AboutView.swift
@@ -7,6 +7,7 @@ struct AboutContent: View {
static let width: CGFloat = 380
@Environment(\.colorScheme) private var colorScheme
+ @Environment(AppLibrary.self) private var library
var body: some View {
VStack(spacing: 12) {
@@ -25,6 +26,9 @@ struct AboutContent: View {
.font(.callout)
.foregroundStyle(.secondary)
.textSelection(.enabled)
+ if let update = library.newerPeel {
+ PeelUpdateNotice(update: update)
+ }
Text("Remove apps and the files they leave behind.")
.multilineTextAlignment(.center)
.foregroundStyle(.secondary)
@@ -107,6 +111,37 @@ struct AboutContent: View {
}
}
+/// A newer Peel than this copy, and where to get it. Peel downloads and installs nothing itself.
+private struct PeelUpdateNotice: View {
+ let update: AppLibrary.PeelUpdate
+
+ var body: some View {
+ VStack(spacing: 8) {
+ Text("Version \(update.version) is out.")
+ .font(.system(.callout, design: .rounded, weight: .bold))
+ .foregroundStyle(Album.orangeInk)
+ if let command = update.homebrewCommand {
+ Text("Homebrew installed this copy, so upgrade it by running the command in Terminal.")
+ .multilineTextAlignment(.center)
+ .foregroundStyle(.secondary)
+ Text(verbatim: command)
+ .font(.callout.monospaced())
+ .textSelection(.enabled)
+ CopyButton(text: command, title: "Copy Command")
+ .buttonStyle(StickerButtonStyle(fill: Album.orange, size: 12, ink: Album.onOrange))
+ } else {
+ Text("Download it, then replace this copy in Applications.")
+ .multilineTextAlignment(.center)
+ .foregroundStyle(.secondary)
+ Button("Download") { NSWorkspace.shared.open(update.page ?? Links.latestRelease) }
+ .buttonStyle(StickerButtonStyle(fill: Album.orange, size: 12, ink: Album.onOrange))
+ }
+ }
+ .font(.callout)
+ .padding(.vertical, 4)
+ }
+}
+
fileprivate extension View {
func creditTarget() -> some View {
padding(.vertical, AboutContent.creditReach)
diff --git a/Peel/Views/Settings/PrivacySettingsView.swift b/Peel/Views/Settings/PrivacySettingsView.swift
index 0851f07b..f4d1209d 100644
--- a/Peel/Views/Settings/PrivacySettingsView.swift
+++ b/Peel/Views/Settings/PrivacySettingsView.swift
@@ -12,6 +12,7 @@ struct PrivacySettingsView: View {
private let hosts = [
Host(address: "itunes.apple.com", purpose: "The latest version of apps installed from the App Store."),
Host(address: "github.com", purpose: "The release feed of apps that update through GitHub, and wherever GitHub sends the download. Homebrew also updates itself from here when you ask it to update or upgrade."),
+ Host(address: "api.github.com", purpose: "The latest release of Peel itself. Peel says when a new one is out and downloads nothing."),
Host(address: "formulae.brew.sh", purpose: "Homebrew’s own package list, downloaded when you ask Homebrew to update or upgrade."),
Host(address: "ghcr.io", purpose: "Where Homebrew downloads the packages it upgrades. A cask comes from its maker’s own address."),
Host(address: "api.osv.dev", purpose: "The list of known vulnerabilities Homebrew checks formulae against."),
diff --git a/README.md b/README.md
index 85393f60..3dd23fe5 100644
--- a/README.md
+++ b/README.md
@@ -215,6 +215,7 @@ Settings > Privacy lists the same places.
|---|---|
| `itunes.apple.com` | The latest version of an app bought from the App Store. No other app is ever asked about. |
| `github.com` | Release feeds of apps that update through GitHub, and wherever GitHub sends the download. Homebrew also updates itself from here when you ask it to. |
+| `api.github.com` | The latest release of Peel itself. Peel says when a new one is out and downloads nothing. |
| `formulae.brew.sh` | Homebrew's list of packages, when you ask Homebrew to update or upgrade. |
| `ghcr.io` | Where Homebrew downloads the packages it upgrades. A cask comes from its maker's own address. |
| `api.osv.dev` | The database of known vulnerabilities that Homebrew's scan checks your formulae against. |