From 9b047f53770541ec6bc3580e0e50446b7542b9b6 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Sun, 8 Nov 2026 13:33:06 +0000 Subject: [PATCH] Phones stay joined. Ported from release-0.108 (0.110.2) Co-Authored-By: Claude Opus 5.5 --- android/app/src/main/assets/phone/app.html | 3 +++ .../app/src/main/assets/phone/companion.html | 3 +++ .../main/java/tv/orbit/classic/PhoneLink.kt | 22 ++++++++++++++++++- .../main/java/tv/orbit/classic/PhonePages.kt | 5 ++++- .../java/tv/orbit/classic/PhoneLinkTest.kt | 7 ++++++ 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/assets/phone/app.html b/android/app/src/main/assets/phone/app.html index 10f33a54..820fbcb7 100644 --- a/android/app/src/main/assets/phone/app.html +++ b/android/app/src/main/assets/phone/app.html @@ -14,6 +14,9 @@ button.wide{width:100%;padding:15px;font-size:18px}button:disabled{opacity:.5}in .bar div{max-width:480px;margin:0 auto}.note{color:var(--gold);margin:10px 0}.chosen li{margin:4px 0}.ok{color:var(--mint);font-size:13px}
""" fun join(note: String?) = """Orbit$STYLE

Orbit

Enter the code shown on the TV in Settings › Rooms and phones › Connect a phone.

${note?.let { "

${esc(it)}

" }.orEmpty()} -
""" +
$REJOIN""" fun pin(k: String?, code: String?, wrong: Boolean) = """Orbit$STYLE

Adult PIN

The code worked. Joining a phone is for adults, so now enter your Adult PIN: the four digits that unlock After Dark on the TV.

It isn't the code on the TV screen.

${if (wrong) "

That PIN didn't match. It's the After Dark PIN, not the TV's code.

" else ""} diff --git a/android/app/src/test/java/tv/orbit/classic/PhoneLinkTest.kt b/android/app/src/test/java/tv/orbit/classic/PhoneLinkTest.kt index 87c902c0..8f37b89b 100644 --- a/android/app/src/test/java/tv/orbit/classic/PhoneLinkTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/PhoneLinkTest.kt @@ -70,6 +70,13 @@ class PhoneLinkTest { assertEquals(302, joined.status); val cookie = joined.cookie!! assertEquals(1, phones.size); assertNull(PhoneLink.pairing) assertTrue(call("/join", "POST", "code=${p.code}", form = true).body.contains("run out")) // once only + // A phone that lost its cookie (8 November 2026) puts it back from the token it kept; nothing else gets in that way. + val token = cookie.substringAfter('=') + val back = call("/rejoin", "POST", token, cookie = null) + assertEquals(200, back.status); assertEquals(cookie, back.cookie) + assertEquals(403, call("/rejoin", "POST", "f".repeat(64)).status) + assertEquals(403, call("/rejoin", "POST", "not a token").status) + assertFalse(call("/rejoin", "POST", token, orbit = false).body.contains("joined")) // no X-Orbit: just the join page // The API, joined. assertEquals(0, JSONObject(call("/api/channels", cookie = cookie).body).getJSONArray("channels").length()) assertEquals("The X-Files", JSONArray(call("/api/suggest?d=90s%20sci-fi", cookie = cookie).body).getJSONObject(0).getString("title"))