tools: beacon receiver can serve a staged APK on /apk (443)

A test device that can only reach fmr on 443 (LAN blocks other outbound
ports) can pull an APK via its own downloader — more resilient than adb's
sustained transport over flaky wifi. GET /apk serves APK_PATH. (Doesn't
help the Lenovo tablet, which ships no curl; kept for devices that do.)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrambossek
2026-07-31 23:08:09 +02:00
co-authored by Claude Opus 5
parent 6e269d424b
commit ee4031b086
+13 -2
View File
@@ -49,9 +49,20 @@ class Handler(BaseHTTPRequestHandler):
self.wfile.write(body)
def do_GET(self):
if self.path.rstrip("/") != "/beacon":
p = self.path.rstrip("/")
if p == "/beacon":
return self._send(200, json.dumps(load()).encode())
# Dev convenience: serve a staged APK so a device (which can only reach
# this host on 443) can pull it via its own curl — more resilient than
# adb's sustained transport over a flaky wifi. Path from APK_PATH.
if p == "/apk":
apk = os.environ.get("APK_PATH", "/tmp/echolot-app.apk")
try:
with open(apk, "rb") as f:
return self._send(200, f.read(), "application/vnd.android.package-archive")
except FileNotFoundError:
return self._send(404, b'{"error":"no apk staged"}')
return self._send(404, b'{"error":"not found"}')
self._send(200, json.dumps(load()).encode())
def do_POST(self):
if self.path.rstrip("/") != "/beacon":