Kids gate on the phone's Create. Ported from release-0.108 (0.108.106)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -299,6 +299,9 @@ internal object PhoneLink {
|
||||
private fun api(r: Request, out: OutputStream, phone: String) {
|
||||
active = prefs().get(phone)?.substringBefore('|')
|
||||
if (companion(r, out)) return
|
||||
// Kids on the phone (8 November 2026, audit S8): everything past the remote is Create's (browsing, searching and
|
||||
// making channels), so while Kids is watching none of it answers, not just the routes that change things.
|
||||
if (!OrbitCompanion.grownUp) return json(out, 403, JSONObject().put("error", "Kids is watching. Switch to Adult to use Create."))
|
||||
val h = standIn ?: handler ?: return json(out, 403, JSONObject().put("error", "The TV isn't signed in to a library right now."))
|
||||
when ("${r.method} ${r.path}") {
|
||||
"GET /api/channels" -> json(out, 200, JSONObject().put("next", CustomChannels.nextNumber() ?: JSONObject.NULL).put("channels", JSONArray(CustomChannels.list.map { c ->
|
||||
|
||||
@@ -248,8 +248,15 @@ class PhoneLinkTest {
|
||||
assertEquals(200, call("/api/profile", "POST", """{"id":"$kidsId"}""", cookie = cookie).status); assertTrue(Profiles.kids)
|
||||
assertEquals(403, call("/api/director", cookie = cookie).status)
|
||||
assertEquals(403, call("/api/channels", "POST", """{"name":"X","shows":[]}""", cookie = cookie).status)
|
||||
// Nor browsing or searching the library (8 November 2026, audit S8), while the remote itself still works.
|
||||
for (path in listOf("/api/search?q=xf", "/api/suggest?d=sci-fi", "/api/shows?number=701", "/api/facets", "/api/collections", "/api/browse?genre=Drama",
|
||||
"/api/channels", "/api/brands", "/api/unplayable", "/api/arrivals", "/api/taste"))
|
||||
assertEquals(path, 403, call(path, cookie = cookie).status)
|
||||
assertEquals(403, call("/api/watch", "POST", """{"number":701}""", cookie = cookie).status)
|
||||
assertEquals(200, call("/api/now", cookie = cookie).status)
|
||||
// Back to Adult (no PIN set here, so it goes straight in, as on the TV).
|
||||
assertEquals(200, call("/api/profile", "POST", """{"id":"$adultId"}""", cookie = cookie).status); assertFalse(Profiles.kids)
|
||||
assertEquals(200, call("/api/search?q=xf", cookie = cookie).status)
|
||||
assertEquals(403, call("/api/profile", "POST", """{"id":"nobody"}""", cookie = cookie).status)
|
||||
} finally { PhoneLink.screen = null; Profiles.current = before }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user