Просмотр исходного кода

Add Traditional Chinese README

hsiang 5 месяцев назад
Родитель
Сommit
cd20ff8965
2 измененных файлов с 155 добавлено и 1 удалено
  1. 23 1
      README.md
  2. 132 0
      README.zh-TW.md

+ 23 - 1
README.md

@@ -1,9 +1,23 @@
 # AirAccept
 
+Language: [English](README.md) | [繁體中文](README.zh-TW.md)
+
 AirAccept is a small macOS menu bar app that watches for incoming AirPlay Receiver prompts and automatically presses `Accept` only when the prompt clearly matches an AirPlay request.
 
 It is intended for a Mac that already has the built-in AirPlay Receiver enabled in System Settings.
 
+## Why This Exists
+
+macOS can use a Mac as an AirPlay Receiver, and System Settings lets you choose who can AirPlay to it:
+
+- Current User
+- Anyone on the Same Network
+- Everyone
+
+In practice, even when AirPlay Receiver is enabled and `Allow AirPlay for` is set to `Anyone on the Same Network` or `Everyone`, macOS can still show an incoming AirPlay prompt that must be manually accepted before playback starts.
+
+AirAccept exists for Macs that are used as always-available AirPlay receivers, media machines, or headless/remote systems where manually clicking `Accept` every time is inconvenient.
+
 ## Requirements
 
 - macOS Sequoia 15 or Tahoe 26
@@ -12,6 +26,13 @@ It is intended for a Mac that already has the built-in AirPlay Receiver enabled
 
 AirAccept does not require Screen Recording and does not use AppleScript/System Events automation.
 
+Tested on:
+
+- macOS Tahoe 26.4.1
+- macOS Sequoia 15.7.7
+
+AirAccept uses macOS Accessibility APIs to inspect Notification Center. It should continue working as long as Apple keeps the AirPlay prompt exposed in a similar Accessibility structure, but it is not guaranteed across every macOS release.
+
 ## Build
 
 ```sh
@@ -46,7 +67,8 @@ You can move that app bundle to `/Applications` after building. Keeping the app
 1. Launch `build/AirAccept.app`.
 2. Use the menu bar item `AirAccept` -> `Request Accessibility Permission`.
 3. In System Settings, allow AirAccept under Privacy & Security -> Accessibility.
-4. Quit and reopen AirAccept if macOS does not apply the permission immediately.
+4. Optional: enable `AirAccept` -> `Launch at Login` if you want it to start automatically when you sign in.
+5. Quit and reopen AirAccept if macOS does not apply the permission immediately.
 
 To confirm it launched, check the log:
 

+ 132 - 0
README.zh-TW.md

@@ -0,0 +1,132 @@
+# AirAccept
+
+語言:[English](README.md) | [繁體中文](README.zh-TW.md)
+
+AirAccept 是一個輕量 macOS 選單列 app,會監看 AirPlay 接收器的連線提示,並且只在提示明確符合 AirPlay 請求時,自動按下 `Accept`。
+
+這個工具適合已經在「系統設定」中啟用內建 AirPlay Receiver 的 Mac。
+
+## 為什麼需要這個工具
+
+macOS 可以把 Mac 當成 AirPlay Receiver 使用,而且系統設定中可以選擇允許誰 AirPlay 到這台 Mac:
+
+- Current User
+- Anyone on the Same Network
+- Everyone
+
+但實際使用時,即使 AirPlay Receiver 已經開啟,且 `Allow AirPlay for` 設為 `Anyone on the Same Network` 或 `Everyone`,macOS 仍然可能跳出 AirPlay 連線提示,要求你手動按下 `Accept` 之後才會開始播放。
+
+AirAccept 就是為了解決這個情境:如果你把 Mac 當成常駐 AirPlay 接收器、媒體播放機,或是沒有固定螢幕/鍵盤滑鼠的遠端主機,每次都要手動按 `Accept` 會很不方便。
+
+## 需求
+
+- macOS Sequoia 15 或 Tahoe 26
+- Xcode Command Line Tools 或 Xcode
+- 需要授予 AirAccept Accessibility 權限
+
+AirAccept 不需要 Screen Recording 權限,也不使用 AppleScript/System Events 自動化。
+
+已測試版本:
+
+- macOS Tahoe 26.4.1
+- macOS Sequoia 15.7.7
+
+AirAccept 使用 macOS Accessibility API 來檢查 Notification Center。只要 Apple 保持 AirPlay 提示的 Accessibility 結構大致相同,應該可以繼續運作;但這不代表保證支援所有 macOS 版本。
+
+## 建置
+
+```sh
+make test
+make app
+```
+
+app bundle 會產生在:
+
+```text
+build/AirAccept.app
+```
+
+如果要建置後直接啟動:
+
+```sh
+make run
+```
+
+如果 `open` 看起來沒有反應,可以用 foreground 模式執行,方便看啟動錯誤:
+
+```sh
+make debug-run
+```
+
+正常執行時,`debug-run` 會保持執行狀態,直到你退出 AirAccept 或按下 `Ctrl-C`。
+
+建置完成後可以把 app bundle 移到 `/Applications`。建議放在固定路徑,因為 macOS 的 Accessibility 權限會和 app identity/path 有關。
+
+## 第一次使用
+
+1. 啟動 `build/AirAccept.app`。
+2. 從選單列點選 `AirAccept` -> `Request Accessibility Permission`。
+3. 到 System Settings -> Privacy & Security -> Accessibility 允許 AirAccept。
+4. 選用:如果希望登入時自動啟動,開啟 `AirAccept` -> `Launch at Login`。
+5. 如果 macOS 沒有立刻套用權限,請退出並重新開啟 AirAccept。
+
+確認 app 是否有啟動,可以查看 log:
+
+```sh
+tail -n 20 "$HOME/Library/Logs/AirAccept/airaccept.log"
+```
+
+你應該會看到類似這樣的內容:
+
+```text
+[info] ... AirAccept launched pid=12345
+```
+
+## 設定
+
+AirAccept 第一次執行時會建立這個設定檔:
+
+```text
+~/Library/Application Support/AirAccept/config.json
+```
+
+預設設定:
+
+```json
+{
+  "poll_interval_ms": 2500
+}
+```
+
+`poll_interval_ms` 控制 AirAccept 檢查 Notification Center 中 AirPlay 請求的頻率。
+你也可以直接從選單列設定:
+
+```text
+AirAccept -> Poll Interval -> 2/3/4/5 seconds
+```
+
+## Logs
+
+AirAccept 會把 newline-delimited JSON event 寫到:
+
+```text
+~/Library/Logs/AirAccept/airaccept.log
+```
+
+每個 event 會包含 timestamp、host process、prompt summary、解析出的 device name、action 和 reason。它也會使用 subsystem `com.airaccept.AirAccept` 寫入 Apple unified logging。
+
+log 檔約 1 MB 時會輪替,並保留前一份檔案在 `airaccept.log.1`。
+
+## 登入時啟動
+
+使用選單列項目:
+
+```text
+AirAccept -> Launch at Login
+```
+
+這個功能使用 macOS 13+ 的 `SMAppService.mainApp` login item API。
+
+## 安全性說明
+
+AirAccept 不會點擊任意系統對話框。提示內容必須包含 AirPlay-specific request text,例如某個裝置想要 AirPlay 到這台 Mac,並且存在 accept-like Accessibility action,AirAccept 才會透過 Accessibility 路徑按下接受。