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.

Tell VS Code's update service nothing of this Mac, and name the service

Țugui Dragoșd252c019ee8b
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 0bef23f1..70e8ddc5 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -188866,6 +188866,112 @@
}
}
},
+ "The latest stable version of Visual Studio Code, asked about only while it is installed." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nejnovější stabilní verze aplikace Visual Studio Code, na kterou se Peel ptá, jen dokud je aplikace nainstalovaná."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Die neueste stabile Version von Visual Studio Code, nur abgefragt, solange die App installiert ist."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La versión estable más reciente de Visual Studio Code, por la que solo se pregunta mientras está instalada."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La dernière version stable de Visual Studio Code, demandée uniquement tant que cette app est installée."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "L’ultima versione stabile di Visual Studio Code, richiesta solo mentre l’app è installata."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visual Studio Codeの最新の安定バージョンを確認します。インストールされている間だけ問い合わせます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "설치되어 있는 동안에만 묻는 Visual Studio Code의 최신 안정 버전 정보입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "De nieuwste stabiele versie van Visual Studio Code, alleen opgevraagd zolang de app is geïnstalleerd."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Najnowsza stabilna wersja Visual Studio Code, o którą Peel pyta tylko wtedy, gdy ta aplikacja jest zainstalowana."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "A versão estável mais recente do Visual Studio Code, consultada só enquanto ele estiver instalado."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cea mai recentă versiune stabilă de Visual Studio Code, despre care Peel întreabă doar cât timp aplicația este instalată."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Последняя стабильная версия Visual Studio Code, о которой Peel спрашивает, только пока приложение установлено."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Den senaste stabila versionen av Visual Studio Code, som Peel bara frågar efter så länge appen är installerad."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visual Studio Code’un en son kararlı sürümü; yalnızca uygulama yüklüyken sorulur."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Найновіша стабільна версія Visual Studio Code, про яку Peel запитує лише тоді, коли цю програму інстальовано."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visual Studio Code的最新稳定版本,仅在已安装它时才会查询。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visual Studio Code的最新穩定版本,只有在已安裝時才會詢問。"
+ }
+ }
+ }
+ },
"The latest version of apps installed from the App Store." : {
"localizations" : {
"cs" : {
diff --git a/PRIVACY.md b/PRIVACY.md
index 8d372a88..d5cffe5f 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -48,6 +48,7 @@ them as the page loads, and they are posted only if you send the issue.
|---|---|
| `itunes.apple.com` | The latest version of an app from the App Store. No other app is ever asked about. |
| `github.com` | Peel's own update feed, release feeds of apps that update through GitHub, and wherever GitHub sends the download. Homebrew also updates itself and its taps from here when you ask it to, Repair Taps included, and a tap you added from another address from there. |
+| `update.code.visualstudio.com` | The latest stable version of Visual Studio Code, asked about only while it is installed. |
| `api.github.com` | When you ask Homebrew to update or upgrade, it first asks here whether Homebrew itself, and each tap kept on GitHub, has changed. |
| `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, and wherever it redirects. A package with no ready-made build for your Mac downloads its source from the address its formula names, and a cask comes from its maker's own address. |
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift
index d6c19072..98951061 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift
@@ -100,9 +100,6 @@ public enum AppInspector {
let architectures = executable.flatMap(MachOHeader.architectures(ofExecutableAt:)) ?? []
let asksForIntelFirst = (info["LSArchitecturePriority"] as? [String])?.first == "x86_64"
let vsCodeProduct = ProductFolders.vsCodeProduct(of: url)
- // VS Code asks for the build of the processor it runs on, Intel code running translated on Apple silicon.
- let runsOnAppleSilicon = HostArchitecture.isAppleSilicon && architectures.contains(.arm64)
- && !(asksForIntelFirst && architectures.contains(.x86_64))
return InstalledApp(
url: url,
@@ -127,7 +124,7 @@ public enum AppInspector {
info: info,
electronConfiguration: electronConfiguration,
vsCodeFeed: vsCodeProduct.flatMap {
- VSCodeUpdateService.feedURL(product: $0, runsOnAppleSilicon: runsOnAppleSilicon)
+ VSCodeUpdateService.feedURL(product: $0)
},
appStoreListing: appStoreListing,
isSystemProtected: isSystemProtected,
diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/VSCodeUpdateService.swift b/Packages/PeelCore/Sources/PeelCore/Updates/VSCodeUpdateService.swift
index c4facbd3..fe59efeb 100644
--- a/Packages/PeelCore/Sources/PeelCore/Updates/VSCodeUpdateService.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Updates/VSCodeUpdateService.swift
@@ -6,14 +6,14 @@ enum VSCodeUpdateService {
/// An editor built on VS Code names a service of its own, whose answers Peel doesn't know.
static let service = "https://update.code.visualstudio.com"
- /// The address of the latest stable build for the installed build's platform, from its `product.json`. VS Code
- /// asks about the commit it was built from, which names its version, so Peel asks for the latest build instead.
- /// Only a stable build, since an Insiders build keeps its version from one build to the next.
- static func feedURL(product: [String: Any], runsOnAppleSilicon: Bool) -> URL? {
+ /// The address of the latest stable build, for a stable build of Microsoft's, whose `product.json` names the
+ /// service. VS Code asks about the commit it was built from, which names its version, and for its own platform, so
+ /// Peel asks for the latest build of one platform whatever is installed: every platform gets the same version, and
+ /// the address says nothing of this Mac. Only a stable build, since an Insiders build keeps its version from one
+ /// build to the next.
+ static func feedURL(product: [String: Any]) -> URL? {
guard product["updateUrl"] as? String == service, product["quality"] as? String == "stable" else { return nil }
- let platform = product["darwinUniversalAssetId"] as? String ?? (runsOnAppleSilicon ? "darwin-arm64" : "darwin")
- guard platform.wholeMatch(of: /[a-z0-9-]+/) != nil else { return nil }
- return URL(string: "\(service)/api/update/\(platform)/stable/latest")
+ return URL(string: "\(service)/api/update/darwin-universal/stable/latest")
}
/// The version a reply gives the latest build, its `productVersion`: its `version` is the commit.
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
index 757cf962..a7dda203 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
@@ -93,6 +93,18 @@ struct DocumentationTests {
#expect(missing.isEmpty, "\(missing)")
}
+ @Test func everyAddressAnUpdateCheckWritesItselfIsInPrivacyMD() throws {
+ let privacy = try String(contentsOf: LineLengthTests.repository.appending(path: "PRIVACY.md"), encoding: .utf8)
+ let folder = LineLengthTests.repository.appending(path: "Packages/PeelCore/Sources/PeelCore/Updates")
+ let sources = try FileManager.default.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil)
+ .map { try String(contentsOf: $0, encoding: .utf8) }
+ let hosts = Set(sources.flatMap { $0.matches(of: /"https:\/\/([a-z0-9.-]+)/).map { String($0.output.1) } })
+
+ #expect(hosts.contains("update.code.visualstudio.com"))
+ let missing = hosts.filter { !privacy.contains("| `\($0)` |") }
+ #expect(missing.isEmpty, "\(missing)")
+ }
+
@Test func aFileNameInTheCodeCountsAsItsWords() {
#expect(Self.words(in: #"let tag = "CACHEDIR.TAG" // BrowserWallets.swift"#).isSuperset(of: ["CACHEDIR", "BrowserWallets"]))
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
index 302fef30..11f97919 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift
@@ -414,17 +414,29 @@ struct UpdateFeedDetectionTests {
"updateUrl": "https://update.code.visualstudio.com", "quality": "stable",
"commit": "e646868227c3e3a9e3f24277c8c7220be42c0be7",
]
- let address = { (platform: String) in "https://update.code.visualstudio.com/api/update/\(platform)/stable/latest" }
- #expect(VSCodeUpdateService.feedURL(product: product, runsOnAppleSilicon: true)?.absoluteString == address("darwin-arm64"))
- #expect(VSCodeUpdateService.feedURL(product: product, runsOnAppleSilicon: false)?.absoluteString == address("darwin"))
+ #expect(VSCodeUpdateService.feedURL(product: product) != nil)
for (key, value) in [("quality", "insider"), ("updateUrl", "https://updates.example.com")] {
var other = product
other[key] = value
- #expect(VSCodeUpdateService.feedURL(product: other, runsOnAppleSilicon: true) == nil, "\(key)")
+ #expect(VSCodeUpdateService.feedURL(product: other) == nil, "\(key)")
}
}
+ @Test func tellsVSCodesServiceNothingOfThisMacOrItsBuild() throws {
+ let universal = try #require(VSCodeUpdateService.feedURL(product: [
+ "updateUrl": "https://update.code.visualstudio.com", "quality": "stable",
+ "darwinUniversalAssetId": "darwin-universal",
+ "commit": "e646868227c3e3a9e3f24277c8c7220be42c0be7", "version": "1.144.0",
+ ]))
+ let appleSilicon = VSCodeUpdateService.feedURL(product: [
+ "updateUrl": "https://update.code.visualstudio.com", "quality": "stable",
+ ])
+
+ #expect(appleSilicon == universal)
+ #expect(universal.absoluteString == "https://update.code.visualstudio.com/api/update/darwin-universal/stable/latest")
+ }
+
@Test func readsTheFolderElectronUpdaterKeepsItsDownloadsIn() throws {
let cases: [(settings: String, folder: String?)] = [
("provider: generic\nurl: https://example.com/updates\nupdaterCacheDirName: notes-updater\n", "notes-updater"),
diff --git a/Peel/Views/Settings/PrivacySettingsView.swift b/Peel/Views/Settings/PrivacySettingsView.swift
index 2ef521fa..610ebf74 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: "Peel’s own update feed, the release feed of apps that update through GitHub, and wherever GitHub sends the download. Homebrew also updates itself and its taps from here when you ask it to update, upgrade, or repair its taps, and a tap you added from another address from there."),
+ Host(address: "update.code.visualstudio.com", purpose: "The latest stable version of Visual Studio Code, asked about only while it is installed."),
Host(address: "api.github.com", purpose: "When you ask Homebrew to update or upgrade, it first asks here whether Homebrew itself, and each tap kept on GitHub, has changed."),
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, and wherever it redirects. A package with no ready-made build for your Mac downloads its source from the address its formula names, and a cask comes from its maker’s own address."),