feat(findmy-tag): Find My タグの取得を10分ごとの LaunchAgent にする - #525
Merged
Conversation
自作の Find My タグ (~/Developer/github.com/gapul/generic-airtag) の位置 レポートを定期取得して repo の reports.db に追記する。 10分という間隔には理由がある。取得エンドポイントはリクエストの日時範囲を 無視して、鍵ごとに最新数件しか返さない (このアカウントでの実測は8件)。 Apple 側の保持期間は7日あるのに、それより前に古いものが返らなくなるので、 ポーリングで拾えなかったぶんは復旧できない。継続的に拾われているタグは 15分で8件ほど出るので、そこから逆算している。 launchd から10分ごとに flake を評価させたくないので、devShell と同じ python 環境をモジュール側で組み直している。
蓋を閉じたノートは全部のポーリングを落とすが、落としたぶんは8件の上限に 押し流されて復旧できない。常時稼働の macmini に置く。 homeserver ではなく macmini なのは、Apple が要求するアネットが AOSKit 由来で macOS にしか無いため。Linux だと anisette サーバでデバイス identity を偽装することになり、この構成が避けている当のものに戻る。 macmini は iCloud にサインインしていないが、AOSKit はユーザーではなく マシンに答えるので問題なく動くことを実機で確認した。 auth.json のトークンは取得したマシンに紐づく。母艦からコピーすると401に なるので、マシンごとに一度ログインする (macmini 側は実施済み)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
自作 Find My タグの位置レポートを10分ごとに取得し、
generic-airtagのreports.dbに追記する LaunchAgent をmacWorkstationロールに追加する。なぜ10分か
取得エンドポイントはリクエストの日時範囲を無視して、鍵ごとに最新数件しか返さない。実測すると窓を1時間にしても24時間にしても同じ最新8件だけが返り、その日の朝に取れていたレポートはもう返ってこなかった。Apple の保持は7日あるが、こちらから見えるのは常に最新8件なので、取りこぼしたぶんは永久に失われる。継続的に拾われているタグは15分あたり8件ほど出るため、そこから10分を逆算した。
実装メモ
bleakだけ不要なので除外)auth.jsonが無ければ静かに exit 0 するので、このプロジェクトを設定していないマシンでも無害RunAtLoad確認
just fmt/just check通過src/fetch.pyを実行し、8件取得・復号できることを確認済み