Adds a daily-budget visualization for users worried about hitting the
Apps Script free-tier quota (20,000 UrlFetchApp calls/day).
Usage today card (desktop + Android):
- today_calls / today_bytes / today_key / today_reset_secs atomics on
DomainFronter, hooked into the bytes_relayed fetch_add path so we only
count successful relays (matching what Google actually billed)
- Daily rollover at 00:00 UTC, std-only date math (Hinnant's
civil_from_days) — no chrono/time dep pull
- StatsSnapshot extended with the four new fields + to_json() for the
Android JNI bridge
- Desktop UI renders the card right under the existing Traffic stats
with a hyperlink to https://script.google.com/home/usage for the
authoritative Google-side number
- Android UI renders the same card via Compose, polling
Native.statsJson(handle) once a second only while the proxy is up,
with an Intent(ACTION_VIEW, …) opening the dashboard URL
JNI / state plumbing:
- New Java_…_statsJson reads the Arc<DomainFronter> kept in slot_map
- VpnState.proxyHandle StateFlow so HomeScreen knows which handle to
poll without poking into the service's internal state
- MhrvVpnService publishes the handle on start, zeroes on teardown
Persian localization:
- HowToUseBody (5-step guide + Cloudflare Turnstile note) was
hardcoded English even when locale=FA. Ported to a string resource
with a full FA translation in values-fa/strings.xml. Persian users
no longer drop to English at the bottom of the screen.
Also lands the deferred Android ConfigStore.kt wiring for
passthrough_hosts (commit fe9328e shipped the Rust + desktop side).
82 tests pass (added: unix_to_ymd_utc_handles_known_epochs,
seconds_until_utc_midnight_is_bounded). Built and visually verified on
both desktop and Android emulator (mhrv_test AVD).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.8 KiB
• کارت «مصرف امروز (تخمینی)»: در UI دسکتاپ و اندروید، یک کارت زنده اضافه شد که تعداد relay calls امروز نسبت به سهمیهٔ روزانهٔ Apps Script (۲۰٬۰۰۰ درخواست در ردهٔ رایگان)، حجم بایت رد شده، روز UTC فعلی، و زمان باقیمانده تا ریست ۰۰:۰۰ UTC را نشان میدهد. شمارندهها بر اساس atomic counterهای خود mhrv-rs هستند — هیچ API key از گوگل نمیخواهد. عدد فقط چیزی است که این دستگاه رد کرده؛ برای عدد دقیق سمت گوگل، دکمهٔ «مشاهدهٔ سهمیه در گوگل» داشبورد Apps Script را در مرورگر باز میکند
• پل JNI آمار: Native.statsJson(handle) بهصورت سبک (فقط خواندن چند atomic) StatsSnapshot را به JSON سریالایز میکند. VpnState هم اکنون handle جاری proxy را منتشر میکند تا UI بتواند هر ثانیه poll کند بدون اینکه به state داخلی service دست بزند
• ترجمهٔ فارسی راهنمای داخلی برنامهٔ اندروید: متن «راهنمای استفاده» که قبلاً ثابت روی انگلیسی بود، به string resource منتقل و ترجمهٔ فارسی برای هر ۵ مرحله + توضیح محدودیت Cloudflare Turnstile اضافه شد. زبان فارسی دیگر ته صفحه به انگلیسی نمیافتد
• "Usage today (estimated)" card on both desktop and Android. Shows live count of today's relay calls vs the Apps Script free-tier daily quota (20,000), bytes relayed today, current UTC day, and countdown to the 00:00 UTC reset. Counters come from mhrv-rs's own atomic counters — no Google API key needed. The number reflects only what this device relayed; the "View quota on Google" button opens the Apps Script dashboard in the user's browser for the authoritative cross-account number
• Stats JNI bridge: Native.statsJson(handle) cheaply (just reads atomics) serializes StatsSnapshot to JSON. VpnState now publishes the running proxy handle so the Compose UI can poll once a second without poking into the service's internal state
• Persian translation of the in-app guide on Android. The "How to use" body was previously hardcoded English; ported to a string resource with FA translation covering all 5 numbered steps + the Cloudflare Turnstile limitation note. Persian users no longer drop to English at the bottom of the screen