From 8990514417cf0f029bccebfcb7fcd672427e1371 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Sun, 12 Apr 2026 07:04:46 +0400 Subject: [PATCH] fix(call): default Accept to AcceptTrusted + add log Copy/Share buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Accept button regression — diagnosed from a user log Field report: incoming call → callee taps Accept → debug log shows the dual-path race being skipped with `connect:dual_path_skipped {"has_own":false,"has_peer":true, "role":"None"}` and the call falling to relay-only on the callee side. Root cause: the Accept button was calling `answer_call` with `mode: 2` which falls through to `AcceptGeneric` (privacy mode). By design, privacy mode SKIPS the reflex query on the callee so the callee's IP stays hidden from the caller — but the side effect is that `own_reflex_addr` never gets cached in `SignalState`. When `connect` runs a moment later, it sees `own_reflex_addr = None`, can't compute the deterministic role for the dual-path race, and falls back to relay. For a normal VoIP app where P2P is the desired default, the right behavior is `AcceptTrusted` — which queries reflect, advertises the callee's addr in the answer, and enables direct P2P. Privacy mode can come back as a dedicated second button if anyone actually needs it. Changed `acceptCallBtn` click handler from `mode: 2` to `mode: 1`. The next call from a Phase-5 APK should show `connect:dual_path_race_start` + `connect:dual_path_race_won {"path":"Direct"}` on a cone-NAT-to-cone-NAT pair. ## Debug log export — new Copy / Share buttons Field-testing the GUI debug log required me to keep asking the user to type out what they saw. Added two new buttons next to Clear: - **Copy log** — serialises the rolling buffer as plain text (same HH:MM:SS.mmm format the on-screen panel uses) and writes to `navigator.clipboard`. Falls back to the old selection-based `execCommand("copy")` for WebViews that refuse the new API without a permission prompt. - **Share** — tries the Web Share API (`navigator.share(...)`) first. On Android WebView this opens the system share sheet so the user can send the text straight to a messaging app. Falls back to clipboard copy on WebViews that don't expose navigator.share (most desktop ones). Also falls back if the user cancels the share sheet. Flash status line below the buttons shows a 2.5s confirmation ("✓ Copied 47 entries") or an error hint. The log is plain text so anyone can paste a log fragment into a message and send it. Co-Authored-By: Claude Opus 4.6 (1M context) --- desktop/index.html | 7 ++- desktop/src/main.ts | 107 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/desktop/index.html b/desktop/index.html index f2d5e33..b84b3dc 100644 --- a/desktop/index.html +++ b/desktop/index.html @@ -181,7 +181,12 @@