0.108.33: the After Dark lock

Paul, 5 November 2026: the first of first-run setup, with children on the
TV. Settings > After Dark lock sets a four-digit PIN (dialled or typed,
entered twice). With a PIN set, Orbit After Dark and The Late Show at the
Drive-In are hidden from the guide, Home, What's On, Catch Up, channel up
and down and the number box; if it locks while on After Dark, Orbit goes
to the first channel. Entering the PIN unlocks them until Orbit closes,
when they lock again. Changing the PIN or turning the lock off needs the
PIN; signing out clears it. The PIN is kept only as a salted SHA-256 hash.
After Dark also leaves the Pairs cards. Loaded before anything is drawn.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-05 22:53:05 +00:00
co-authored by Claude Opus 5.5
parent d795b5fb56
commit ffddf55b44
12 changed files with 206 additions and 11 deletions
@@ -0,0 +1,26 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
class AfterDarkLockTest {
@Test fun thePinIsKeptOnlyAsASaltedHash() {
val a = pinHash("salt-one", "1234")
assertEquals(a, pinHash("salt-one", "1234"))
assertNotEquals(a, pinHash("salt-two", "1234"))
assertNotEquals(a, pinHash("salt-one", "1235"))
assertFalse("1234" in a)
assertEquals(64, a.length)
}
@Test fun lockedHidesAfterDarkAndTheLateShowOnly() {
assertTrue(lockedOut(AFTER_DARK_NUMBER, locked = true))
assertFalse(lockedOut(AFTER_DARK_NUMBER, locked = false))
assertFalse(lockedOut(101, locked = true)); assertFalse(lockedOut(TOTS_NUMBER, locked = true))
val media = ScheduledMedia(SampleItem("A film", "Movie", 90, "", "f1", 90 * 60_000L), "s1", 90 * 60_000L)
val entry = ScheduleEntry("f1", EpisodeMark(1, 1), media, 0L)
assertTrue(lockedOut(DriveInBill(DriveInKind.LateShow, listOf(entry)), locked = true))
assertFalse(lockedOut(DriveInBill(DriveInKind.Marquee, listOf(entry)), locked = true))
assertFalse(lockedOut(DriveInBill(DriveInKind.LateShow, listOf(entry)), locked = false))
}
}