feat: add Android to Android phone sharing

This commit is contained in:
zhy200308
2026-08-12 15:17:34 +08:00
parent f248deac17
commit d3e840ff0a
15 changed files with 953 additions and 44 deletions
+24
View File
@@ -98,3 +98,27 @@ Range: bytes=<start>-<end>
The sender returns `206 Partial Content`, the matching `Content-Range`, and the exact requested body length. Android splits the file toward 8 workers with **64 KiB–16 MiB** chunks, stores each completed chunk in a `.qftpart.map` ledger, and resumes only missing chunks after a reconnect. Each range retries with the currently available `Network`; the complete partial file must pass SHA-256 before it is published to `Downloads/QFT`.
For both direct-transfer directions, the Windows listener may accept connections non-blockingly for shutdown responsiveness, but each accepted file socket is switched to blocking I/O with explicit timeouts before reading or writing request bodies. This prevents `WSAEWOULDBLOCK (10035)` from turning an in-progress parallel transfer into an HTTP 500 failure.
## 6. Android → Android (`QFTPHONE2`, v0.5.0-dev1)
The sender starts an authenticated local HTTP service and encodes only session,
port, sender identity and optional LocalOnlyHotspot credentials in the QR. The
file queue is fetched after pairing so QR density is independent of queue size:
```text
GET /qft/ping
GET /qft/phone/manifest
GET /qft/phone/download/<queue-index>
Range: bytes=<start>-<end>
X-QFT-Token: <one-time session>
```
The manifest contains a bounded ordered list of `name`, `size`, `sha256` and a
server-generated fixed download path. The receiver does not accept arbitrary
paths from the QR or manifest: entry `N` must use `/qft/phone/download/N`.
Android 8+ prefers a system LocalOnlyHotspot. Android 7, or a hotspot failure,
falls back to literal private IPv4 endpoints on the current LAN. WPA2/WPA3
credentials are distinguished in `w[2]`. The receiver then reuses the existing
parallel Range ledger, retries and SHA-256-before-publish behavior for every
file, processing items in manifest order.