Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
Updates: a beta channel, phased stable rollouts, daily checks, a hard release gate. Epic menu shows the connected state. Make a shortcut.
Gauthier Piarretteddf242a45067
diff --git a/Scripts/gate.sh b/Scripts/gate.shnew file mode 100755index 0000000..0a98fd1--- /dev/null+++ b/Scripts/gate.sh@@ -0,0 +1,50 @@+#!/bin/zsh+# Release gate: the automated checks in one run, one result file. Scripts/release.sh refuses a beta+# or stable release without a passing result younger than 24 hours for the commit being released+# (--hotfix skips the gate and only warns, so an urgent fix is never hostage to a ten-minute run).+#+# Required: upgrade-smoke (an existing home stays visible after an update), firstrun-smoke (an empty+# home installs the engine and shows the window), launch-window-smoke (the main window comes back+# after a relaunch). Advisory, recorded but never blocking until their false-fail rate is zero:+# game-smoke (the Sims capture, the CS:GO one-in-six escape) and, with --with-render, render-smoke+# (a long benchmark run, worth it when the engine or a renderer changed).+#+# Needs the screen unlocked: the smokes launch the app and look at its windows.+# Usage: Scripts/gate.sh [--with-render]+set -uo pipefail+cd "$(dirname "$0")/.."+OUT=private/gate; mkdir -p "$OUT"+WITH_RENDER=0; [ "${1:-}" = "--with-render" ] && WITH_RENDER=1+COMMIT=$(git rev-parse HEAD)+git diff-index --quiet HEAD -- || echo "note: tracked files modified, so this result is for $COMMIT plus local changes" >&2++echo "gate: building dist/Highball.app from the working tree"+Scripts/make-app.sh >"$OUT/make-app.log" 2>&1 || { echo "gate: make-app failed, see $OUT/make-app.log" >&2; exit 2; }++typeset -A R T+run() {+ local name=$1; shift; local start=$(date +%s)+ if "$@" >"$OUT/$name.log" 2>&1; then R[$name]=pass; else R[$name]=fail; fi+ T[$name]=$(( $(date +%s) - start ))+ printf ' %-14s %s (%ss)\n' "$name" "${R[$name]}" "${T[$name]}"+}+echo "gate: required checks"+run upgrade Scripts/upgrade-smoke.sh --screen+run firstrun Scripts/firstrun-smoke.sh --screen+run launch-window Scripts/launch-window-smoke.sh+echo "gate: advisory checks"+run game Scripts/game-smoke.sh+[ $WITH_RENDER = 1 ] && run render Scripts/render-smoke.sh++passed=true+for n in upgrade firstrun launch-window; do [ "${R[$n]}" = pass ] || passed=false; done+json="{"+for n in ${(k)R}; do json+="\"$n\":{\"result\":\"${R[$n]}\",\"seconds\":${T[$n]}},"; done+json="${json%,}}"+HB_JSON="$json" HB_COMMIT="$COMMIT" HB_PASSED="$passed" python3 - "$OUT/latest.json" <<'PY'+import json, os, sys, time+json.dump({"passed": os.environ['HB_PASSED'] == 'true', "epoch": int(time.time()), "date": time.strftime('%Y-%m-%d'),+ "commit": os.environ['HB_COMMIT'], "required": ["upgrade", "firstrun", "launch-window"],+ "checks": json.loads(os.environ['HB_JSON'])}, open(sys.argv[1], 'w'), indent=2)+PY+if [ $passed = true ]; then echo "GATE PASSED for ${COMMIT:0:7} ($OUT/latest.json)"; else echo "GATE FAILED for ${COMMIT:0:7}: see $OUT/*.log"; exit 1; fidiff --git a/Scripts/make-app.sh b/Scripts/make-app.shindex 2c517b0..d1ad50d 100755--- a/Scripts/make-app.sh+++ b/Scripts/make-app.sh@@ -60,6 +60,8 @@ cat > "$APP/Contents/Info.plist" <<PLIST<key>NSHighResolutionCapable</key><true/><key>SUFeedURL</key><string>${FEED_URL}</string><key>SUPublicEDKey</key><string>${ED_PUBLIC_KEY}</string>+ <key>SUEnableAutomaticChecks</key><true/>+ <key>SUScheduledCheckInterval</key><integer>86400</integer><key>SUEnableInstallerLauncherService</key><false/><key>NSHumanReadableCopyright</key><string>GPL-3.0 — no paid tier, ever.</string><key>CFBundleURLTypes</key>diff --git a/Scripts/release.sh b/Scripts/release.shindex 2ae435a..6188951 100755--- a/Scripts/release.sh+++ b/Scripts/release.sh@@ -1,94 +1,80 @@#!/bin/zsh# Cut a Highball release: build+sign+notarize the app, sign the update for Sparkle,# update appcast.xml, publish the GitHub release.-# Usage: Scripts/release.sh 0.3.1 "One-line summary" [notes-file.md]+# Usage: Scripts/release.sh [--beta|--hotfix] 0.3.1 "One-line summary" [notes-file.md]+# Scripts/release.sh --promote 0.3.1 (beta -> stable, phased over seven days)set -euo pipefailcd "$(dirname "$0")/.."-VERSION="${1:?usage: release.sh <version> <summary> [notes.md]}"+# Channels (2026-09-07): a normal release goes to beta first (`--beta`), then `--promote <version>`+# turns the same signed artifact into a stable, phased rollout by editing the appcast: no rebuild,+# so what testers ran is byte for byte what everyone gets. `--hotfix` is stable at once, no phasing.+CHANNEL=stable+case "${1:-}" in+ --beta) CHANNEL=beta; shift ;;+ --hotfix) CHANNEL=hotfix; shift ;;+ --promote)+ PV="${2:?usage: release.sh --promote <version>}"+ git diff-index --quiet HEAD -- || { echo "tracked files modified; commit before promoting" >&2; exit 1; }+ HB_VERSION="$PV" HB_DATE="$(date -R 2>/dev/null || date "+%a, %d %b %Y %H:%M:%S %z")" python3 - <<'PY'+import os, re, xml.dom.minidom+v = os.environ['HB_VERSION']+s = open('appcast.xml').read()+m = re.search(r'( <item>\n <title>Highball ' + re.escape(v) + r'</title>.*?</item>)', s, re.S)+assert m, f'no appcast item for {v}'+item = m.group(1)+assert '<sparkle:channel>beta</sparkle:channel>' in item, f'{v} is not a beta item'+new = item.replace(' <sparkle:channel>beta</sparkle:channel>\n', ' <sparkle:phasedRolloutInterval>86400</sparkle:phasedRolloutInterval>\n')+# The phased rollout counts from pubDate, so promotion is the item's new date.+new = re.sub(r'<pubDate>.*?</pubDate>', f"<pubDate>{os.environ['HB_DATE']}</pubDate>", new)+open('appcast.xml', 'w').write(s.replace(item, new, 1))+xml.dom.minidom.parse('appcast.xml')+print(f'appcast: {v} promoted to stable, phased over seven days from now')+PY+ gh release edit "v$PV" --prerelease=false --latest+ git add appcast.xml && git commit -m "release: promote v$PV to stable" && git push+ echo "promoted v$PV"+ exit 0 ;;+esac+VERSION="${1:?usage: release.sh [--beta|--hotfix] <version> <summary> [notes.md] | release.sh --promote <version>}"SUMMARY="${2:?summary required}"NOTES_FILE="${3:-}"+export HB_CHANNEL="$CHANNEL"# The tag below marks HEAD as the source of this build, so the tree must be clean.git diff-index --quiet HEAD -- || { echo "tracked files modified; commit before releasing" >&2; exit 1; }-# Renderer regressions (the issue #21 class) ship via code/engine changes, not time,-# so a release wants a recent Scripts/render-smoke.sh result. Warn, don't block:-# hotfixes (like 0.7.9) must never be hostage to a benchmark run.-if ! python3 - <<'PY' 2>/dev/null-import json, sys, time-d = json.load(open("private/render-smoke/latest.json"))-sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)-PY-then- echo "" >&2- echo "WARNING: no passing render-smoke result from the last 14 days." >&2- echo " Run Scripts/render-smoke.sh when convenient — renderer regressions ship silently without it." >&2- echo " Continuing in 5s…" >&2- sleep 5-fi--# Upgrade regressions (the issue #21 class: 0.8.0 hid an existing user's environment) ship via-# UI and state changes, and every first-run check starts from an empty home, so a release wants-# a recent Scripts/upgrade-smoke.sh result too. Same rule as above: warn, don't block.-if ! python3 - <<'PY' 2>/dev/null-import json, sys, time-d = json.load(open("private/upgrade-smoke/latest.json"))-sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)-PY-then- echo "" >&2- echo "WARNING: no passing upgrade-smoke result from the last 14 days." >&2- echo " Run Scripts/upgrade-smoke.sh --screen — an existing install going invisible ships silently without it." >&2- echo " Continuing in 5s…" >&2- sleep 5-fi--# First-run regressions (issue #57/#21: engine tab empty, create-environment silent) hit brand-new-# users only, and every other check assumes an engine already exists. A release wants a recent-# Scripts/firstrun-smoke.sh result: an empty home installs the engine from the bundled manifest.-if ! python3 - <<'PY'-import json, sys, time-d = json.load(open("private/firstrun-smoke/latest.json"))-sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)-PY-then- echo "" >&2- echo "WARNING: no passing firstrun-smoke result from the last 14 days." >&2- echo " Run Scripts/firstrun-smoke.sh: a broken first run leaves new users with no engine." >&2- echo " Continuing in 5s…" >&2- sleep 5-fi--# Launch-window regressions (issue #58: only Settings came back after a relaunch) ship silently-# because every other check starts the app fresh. A release wants a recent-# Scripts/launch-window-smoke.sh result: Settings open, main closed, quit, relaunch, main is back.-if ! python3 - <<'PY'-import json, sys, time-d = json.load(open("private/launch-window-smoke/latest.json"))-sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)+# Release gate (2026-09-07): Scripts/gate.sh runs every automated check and records+# private/gate/latest.json. A beta or stable release needs a passing result younger than 24 hours+# for this very commit: the tree that was tested is the tree that ships. A hotfix skips the gate+# (an urgent fix is never hostage to a ten-minute run) and only warns about stale smoke results.+if [ "$CHANNEL" != hotfix ]; then+ HB_HEAD="$(git rev-parse HEAD)" python3 - <<'PY' || exit 1+import json, os, sys, time+try:+ d = json.load(open("private/gate/latest.json"))+except Exception:+ print("release gate: no Scripts/gate.sh result. Run Scripts/gate.sh (about ten minutes), or --hotfix for an urgent fix.", file=sys.stderr); sys.exit(1)+required = d.get("required", []); checks = d.get("checks", {})+if not d.get("passed"):+ failed = [k for k in required if checks.get(k, {}).get("result") != "pass"]+ print(f"release gate: the last Scripts/gate.sh run failed ({', '.join(failed)}). Fix it, or --hotfix for an urgent fix.", file=sys.stderr); sys.exit(1)+age = time.time() - d.get("epoch", 0)+if age > 86400:+ print(f"release gate: the last passing Scripts/gate.sh run is {age/3600:.0f} hours old. Run it again, or --hotfix for an urgent fix.", file=sys.stderr); sys.exit(1)+if d.get("commit") != os.environ["HB_HEAD"]:+ print(f"release gate: Scripts/gate.sh ran on {d.get('commit', '?')[:7]}, HEAD is {os.environ['HB_HEAD'][:7]}. Run it again on this commit, or --hotfix for an urgent fix.", file=sys.stderr); sys.exit(1)+advisory = [k for k, v in checks.items() if k not in required and v.get("result") != "pass"]+print("release gate: passed." + (f" Advisory checks not passing: {', '.join(advisory)} (private/gate/*.log)." if advisory else ""), file=sys.stderr)PY-then- echo "" >&2- echo "WARNING: no passing launch-window-smoke result from the last 14 days." >&2- echo " Run Scripts/launch-window-smoke.sh: the app must open its main window on relaunch." >&2- echo " Continuing in 5s…" >&2- sleep 5-fi--# Game regressions (a launcher going silent, a map load freezing) ship via engine, app and OS-# changes alike, so a release wants a recent Scripts/game-smoke.sh result: every verified title-# installed here launched, showed its window and kept drawing. Same rule: warn, don't block.-if ! python3 - <<'PY'-import json, sys, time-d = json.load(open("private/game-smoke/latest.json"))+else+ for check in render-smoke upgrade-smoke firstrun-smoke launch-window-smoke game-smoke; do+ if ! HB_CHECK="$check" python3 - <<'PY' 2>/dev/null+import json, os, sys, time+d = json.load(open(f"private/{os.environ['HB_CHECK']}/latest.json"))sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)PY-then- echo "" >&2- echo "WARNING: no passing game-smoke result from the last 14 days." >&2- echo " Run Scripts/game-smoke.sh: a verified game going silent ships unnoticed without it." >&2- echo " Continuing in 5s…" >&2- sleep 5+ then echo "WARNING (hotfix): no passing $check result from the last 14 days." >&2; fi+ donefiScripts/make-app.sh release "$VERSION"@@ -119,12 +105,21 @@ fiHB_VERSION="$VERSION" HB_SUMMARY="$SUMMARY" HB_DATE="$DATE" HB_URL="$DOWNLOAD_URL" HB_ED="$ED_ATTRS" python3 - <<'PY'import os, xml.dom.minidomv = os.environ['HB_VERSION']+# Channel: a beta item is only seen by installs that opted in; a stable item rolls out in phases+# (Sparkle: seven groups, one per interval, from pubDate; manual checks get it at once). A hotfix+# is stable with no phasing.+channel = os.environ.get('HB_CHANNEL', 'stable')+extra = ''+if channel == 'beta':+ extra = ' <sparkle:channel>beta</sparkle:channel>\n'+elif channel == 'stable':+ extra = ' <sparkle:phasedRolloutInterval>86400</sparkle:phasedRolloutInterval>\n'item = f""" <item><title>Highball {v}</title><description><![CDATA[{os.environ['HB_SUMMARY']}]]></description><pubDate>{os.environ['HB_DATE']}</pubDate><sparkle:minimumSystemVersion>14.0</sparkle:minimumSystemVersion>- <enclosure url="{os.environ['HB_URL']}" sparkle:version="{v}" sparkle:shortVersionString="{v}" {os.environ['HB_ED']} type="application/octet-stream"/>+{extra} <enclosure url="{os.environ['HB_URL']}" sparkle:version="{v}" sparkle:shortVersionString="{v}" {os.environ['HB_ED']} type="application/octet-stream"/></item>"""s = open('appcast.xml').read()anchor = '<description>Run Windows games on Apple Silicon.</description>'@@ -157,14 +152,17 @@ git push origin HEAD "v$VERSION"# (0.8.2: a read error on the final PATCH left a tag with no release and no appcast). Retry, and if# a previous attempt left the release behind, finish it instead of failing: upload the assets again# and make sure it is published.+# A beta is a GitHub prerelease and never "latest": the website's latest-download link and the+# stable appcast item stay on the previous stable until promotion.+if [ "$CHANNEL" = beta ]; then FLAGS="--prerelease"; TITLE="Highball $VERSION (beta)"; else FLAGS="--latest"; TITLE="Highball $VERSION"; fipublish() {if gh release view "v$VERSION" >/dev/null 2>&1; thengh release upload "v$VERSION" "$ZIP" "$DMG" --clobber- gh release edit "v$VERSION" --draft=false --latest --title "Highball $VERSION"+ gh release edit "v$VERSION" --draft=false $FLAGS --title "$TITLE"elif [ -n "$NOTES_FILE" ]; then- gh release create "v$VERSION" "$ZIP" "$DMG" --latest --title "Highball $VERSION" --notes-file "$NOTES_FILE"+ gh release create "v$VERSION" "$ZIP" "$DMG" $FLAGS --title "$TITLE" --notes-file "$NOTES_FILE"else- gh release create "v$VERSION" "$ZIP" "$DMG" --latest --title "Highball $VERSION" --notes "$SUMMARY"+ gh release create "v$VERSION" "$ZIP" "$DMG" $FLAGS --title "$TITLE" --notes "$SUMMARY"fi}for attempt in 1 2 3 4; dodiff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swiftindex a5f9596..e2fc42e 100644--- a/Sources/HighballApp/BottleView.swift+++ b/Sources/HighballApp/BottleView.swift@@ -113,7 +113,7 @@ struct BottleView: View {else { state.applyRecipe(meta.id, to: bottle) }}.contextMenu {- Button(L("Make a Mac app…")) { state.makeMacApp(forLauncher: meta.id, short: meta.short) }+ Button(L("Make a shortcut…")) { state.makeMacApp(forLauncher: meta.id, short: meta.short) }if installed, let pin {Button(L("Open")) { state.launch(pin: pin, in: bottle) }Button(L("Program settings…")) { editingPin = pin }diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swiftindex 21440a3..e692e28 100644--- a/Sources/HighballApp/GameDetailView.swift+++ b/Sources/HighballApp/GameDetailView.swift@@ -217,7 +217,7 @@ struct GameDetailView: View {Text(L("Files")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }.controlSize(.small)if PlayLink.target(for: item) != nil {- Button(L("Make a Mac app…")) { state.makeMacApp(for: item) }.controlSize(.small)+ Button(L("Make a shortcut…")) { state.makeMacApp(for: item) }.controlSize(.small).help(L("A small app in ~/Applications/Highball that starts this game without opening Highball first."))}}diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 47f7efe..aa7e609 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -73,9 +73,26 @@ final class CheckForUpdatesViewModel: ObservableObject {}}+/// Sparkle asks which channels an install may see. Everyone sees stable; "Get beta builds"+/// in Settings adds the beta channel, where each release soaks a day or two first.+final class UpdaterDelegate: NSObject, SPUUpdaterDelegate {+ func allowedChannels(for updater: SPUUpdater) -> Set<String> {+ UpdateChannels.allowed(beta: UserDefaults.standard.bool(forKey: UpdateChannels.betaDefaultsKey))+ }+}+final class AppDelegate: NSObject, NSApplicationDelegate {+ /// Owned here because Sparkle holds its delegate weakly.+ let updaterDelegate: UpdaterDelegate/// Sparkle: reads SUFeedURL and SUPublicEDKey from Info.plist; no-ops in bare dev builds without them.- let updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)+ let updaterController: SPUStandardUpdaterController++ override init() {+ let delegate = UpdaterDelegate()+ updaterDelegate = delegate+ updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: delegate, userDriverDelegate: nil)+ super.init()+ }/// Set from the App's onAppear so quit-time can reach the bottles.weak var appState: AppState?@@ -152,7 +169,12 @@ struct ContentView: View {ToolbarItem(placement: .primaryAction) {Menu {Button(state.defaultBottle.map(state.steamInstalled) == true ? L("Open Steam") : L("Install Steam")) { state.installSteam() }- Button(L("Connect Epic account…")) { state.showEpicSignIn = true }+ if state.epicSignedIn {+ // The menu said "Connect" even once connected (0.8.0 feedback).+ Button(L("Epic account connected")) {}.disabled(true)+ } else {+ Button(L("Connect Epic account…")) { state.showEpicSignIn = true }+ }Divider()ForEach(BottleView.launcherMeta.filter { $0.id != "steam" }, id: \.id) { meta inButton(String(format: state.launcherInstalled(meta.id) ? L("Open %@") : L("Install %@"), meta.short)) {diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex e61a90b..88af6e9 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -115,6 +115,9 @@ enum L10n {"DXMT — D3D10/11 → Metal (default)": "DXMT — D3D10/11 → Metal (défaut)","D3DMetal — D3D11/12, Apple": "D3DMetal — D3D11/12, Apple","DXVK — D3D9/10/11 → Vulkan": "DXVK — D3D9/10/11 → Vulkan",+ "Get beta builds": "Recevoir les versions bêta",+ "Epic account connected": "Compte Epic connecté",+ "Each release goes to beta a day or two before everyone else, less tested. Turning this off keeps the build you have until the next stable one is newer.": "Chaque version passe en bêta un jour ou deux avant tout le monde, moins testée. Désactiver garde la version actuelle jusqu'à ce qu'une version stable plus récente arrive.","vkd3d-proton — D3D12 → Vulkan (experimental)": "vkd3d-proton — D3D12 → Vulkan (expérimental)","WineD3D — slow fallback": "WineD3D — solution de repli, lent","D3DMetal (needed for DirectX 12) requires accepting Apple’s Game Porting Toolkit license.":@@ -179,12 +182,12 @@ enum L10n {"Details": "Détails","Run and add to Programs": "Lancer et ajouter aux programmes","Keep current": "Garder l’actuel",- "Make a Mac app…": "Créer une app Mac…",+ "Make a shortcut…": "Créer un raccourci…","Steam's first start got stuck; restarting it": "Le premier démarrage de Steam s’est bloqué ; on le relance","That launcher link did not come from one of your Highball apps.": "Ce lien de lanceur ne vient pas d’une de vos apps Highball.","Open %@ in Highball?": "Ouvrir %@ dans Highball ?","This link did not come from one of your Highball apps, so it asks first.": "Ce lien ne vient pas d'une de vos apps Highball, donc il demande d'abord.",- "Make a Mac app for this game in ~/Applications/Highball: open it from the Dock, Spotlight or Launchpad to play without opening Highball first.": "Crée une app Mac pour ce jeu dans ~/Applications/Highball : ouvrez-la depuis le Dock, Spotlight ou Launchpad pour jouer sans ouvrir Highball.",+ "Make a shortcut: a small Mac app for this game in ~/Applications/Highball. Put it in the Dock or open it from Spotlight or Launchpad to play without opening Highball first.": "Crée un raccourci : une petite app Mac pour ce jeu dans ~/Applications/Highball. Mettez-la dans le Dock ou ouvrez-la depuis Spotlight ou Launchpad pour jouer sans ouvrir Highball.","Running": "En cours","Stop": "Arrêter","a cold Steam client can take a couple of minutes": "un client Steam à froid peut prendre quelques minutes",diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swiftindex 984a0a8..e345743 100644--- a/Sources/HighballApp/LibraryView.swift+++ b/Sources/HighballApp/LibraryView.swift@@ -276,7 +276,7 @@ struct LibraryTile: View {Button(L("Stop")) { state.stopSession(running) }} else if playable { Button(L("Play")) { state.play(item) } }if playable, PlayLink.target(for: item) != nil {- Button(L("Make a Mac app…")) { state.makeMacApp(for: item) }+ Button(L("Make a shortcut…")) { state.makeMacApp(for: item) }}Button(L("Choose cover image…")) { state.chooseCover(for: item) }if state.coverStore.coverURL(for: item.id) != nil {diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swiftindex fb509e8..09a5197 100644--- a/Sources/HighballApp/SettingsView.swift+++ b/Sources/HighballApp/SettingsView.swift@@ -198,6 +198,8 @@ struct EnvironmentsPane: View {struct EnginePane: View {@Environment(AppState.self) private var state+ /// The updater delegate reads the same key: AppStorage so the switch redraws when flipped.+ @AppStorage(UpdateChannels.betaDefaultsKey) private var betaUpdates = false@State private var showLicense = falsevar body: some View {@@ -219,6 +221,17 @@ struct EnginePane: View {}.frame(maxWidth: .infinity, alignment: .leading)}}+ GroupBox {+ VStack(alignment: .leading, spacing: 6) {+ Toggle(L("Get beta builds"), isOn: $betaUpdates)+ .onChange(of: betaUpdates) { _, on in+ // A fresh opt-in should find the current beta now, not at the next scheduled check.+ if on { (NSApp.delegate as? AppDelegate)?.updaterController.updater.checkForUpdatesInBackground() }+ }+ Text(L("Each release goes to beta a day or two before everyone else, less tested. Turning this off keeps the build you have until the next stable one is newer."))+ .font(.caption).foregroundStyle(.secondary)+ }.frame(maxWidth: .infinity, alignment: .leading)+ }if let update = state.engineUpdate {GroupBox {HStack {diff --git a/Sources/HighballKit/UpdateChannels.swift b/Sources/HighballKit/UpdateChannels.swiftnew file mode 100644index 0000000..c6b9d89--- /dev/null+++ b/Sources/HighballKit/UpdateChannels.swift@@ -0,0 +1,14 @@+import Foundation++/// Which Sparkle channels an install may see. Stable is the unnamed channel every install gets;+/// "beta" carries each release for a day or two before promotion. The rule is a function so a+/// test pins it: a wrong answer here would either hide betas from testers or ship betas to everyone.+public enum UpdateChannels {+ public static let beta = "beta"+ /// The UserDefaults key behind Settings' "Get beta builds".+ public static let betaDefaultsKey = "betaUpdates"++ public static func allowed(beta: Bool) -> Set<String> {+ beta ? [Self.beta] : []+ }+}diff --git a/Tests/HighballKitTests/UpdateChannelsTests.swift b/Tests/HighballKitTests/UpdateChannelsTests.swiftnew file mode 100644index 0000000..be84ef4--- /dev/null+++ b/Tests/HighballKitTests/UpdateChannelsTests.swift@@ -0,0 +1,15 @@+import XCTest+@testable import HighballKit++/// The beta channel rule: off means the unnamed stable channel only, on adds exactly "beta".+/// A wrong answer either hides betas from testers or ships betas to everyone.+final class UpdateChannelsTests: XCTestCase {+ func testStableSeesNoNamedChannel() {+ XCTAssertEqual(UpdateChannels.allowed(beta: false), [])+ }++ func testBetaOptInSeesOnlyBeta() {+ XCTAssertEqual(UpdateChannels.allowed(beta: true), ["beta"])+ XCTAssertEqual(UpdateChannels.beta, "beta", "the name the release script writes into the appcast")+ }+}