Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
addons/game-day: a setup line in the wrong order never prints its link
Justin Newmance2a28e1ceb5
diff --git a/addons/game-day/app/src/main/java/io/github/justinnewman/gameday/CalendarStore.java b/addons/game-day/app/src/main/java/io/github/justinnewman/gameday/CalendarStore.javaindex 7c8093efe..51c0e011a 100644--- a/addons/game-day/app/src/main/java/io/github/justinnewman/gameday/CalendarStore.java+++ b/addons/game-day/app/src/main/java/io/github/justinnewman/gameday/CalendarStore.java@@ -42,7 +42,8 @@ final class CalendarStore {if (f.length < 3 || f.length > 4) throw new BadLine(n, "expected sport | name | link, optionally | colour");Sport sport = Sport.byLabel(f[0]);if (sport == null) {- throw new BadLine(n, "unknown sport \"" + f[0].trim() + "\". Choose one of: " + Sport.labels());+ // The column is named, never quoted: in a line written in the wrong order it can be the link.+ throw new BadLine(n, "the first column is not a sport. Choose one of: " + Sport.labels());}String name = f[1].trim();if (name.isEmpty()) throw new BadLine(n, "the name is empty");@@ -52,7 +53,7 @@ final class CalendarStore {int colour;if (f.length == 4 && !f[3].trim().isEmpty()) {colour = Palette.byName(f[3]);- if (colour < 0) throw new BadLine(n, "unknown colour \"" + f[3].trim() + "\", for example \"Green, dark\"");+ if (colour < 0) throw new BadLine(n, "the fourth column is not one of the 36 colours, for example \"Green, dark\"");} else {colour = Palette.firstUnused(colours);}diff --git a/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/CalendarStoreTest.java b/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/CalendarStoreTest.javaindex cfb0ba6a5..454d64ade 100644--- a/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/CalendarStoreTest.java+++ b/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/CalendarStoreTest.java@@ -35,7 +35,7 @@ public class CalendarStoreTest {fail();} catch (CalendarStore.BadLine e) {assertEquals(1, e.line);- assertTrue(e.getMessage(), e.getMessage().contains("Basketbal"));+ assertTrue(e.getMessage(), e.getMessage().contains("first column"));assertTrue(e.getMessage(), e.getMessage().contains("Choose one of: American football"));}}@@ -61,6 +61,20 @@ public class CalendarStoreTest {}}+ @Test public void columnsInTheWrongOrderNeverQuoteTheLink() {+ assertNoLink("https://h.example/secret-token | Wild | Hockey");+ assertNoLink("Hockey | Wild | https://h.example/a.ics | https://h.example/secret-token");+ }++ private static void assertNoLink(String line) {+ try {+ CalendarStore.parseSetupFile(line);+ fail("accepted: " + line);+ } catch (CalendarStore.BadLine e) {+ assertTrue(e.getMessage(), !e.getMessage().contains("secret") && !e.getMessage().contains("://"));+ }+ }+@Test public void jsonRoundTrip() throws Exception {List<Calendar> c = CalendarStore.parseSetupFile("Hockey|Minnesota Wild|https://h.example/a.ics\nGolf|Majors|https://h.example/b.ics|Grey, dark");List<Calendar> back = CalendarStore.fromJson(CalendarStore.toJson(c));diff --git a/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/RepositoryTest.java b/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/RepositoryTest.javaindex 4230b45e5..9a1333c6b 100644--- a/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/RepositoryTest.java+++ b/addons/game-day/app/src/test/java/io/github/justinnewman/gameday/RepositoryTest.java@@ -107,10 +107,18 @@ public class RepositoryTest {assertEquals(2, repo.calendars().size());}+ @Test public void misorderedLineNeverPutsTheLinkInTheResult() {+ String result = repo.applySetupFile("https://h.example/secret-token.ics | Minnesota Wild | Hockey",+ NOW.toEpochMilli(), new Fetcher(300, 300), UTC);+ assertTrue(result, result.startsWith("error|1|"));+ assertFalse(result, result.contains("secret"));+ assertFalse(result, result.contains("://"));+ }+@Test public void badSetupFileLeavesTheListAlone() {repo.save(Arrays.asList(cal("Minnesota Wild", "Hockey", 16)));String result = repo.applySetupFile("Basketbal|Jazz|https://h.example/j.ics", NOW.toEpochMilli(), new Fetcher(300, 300), UTC);- assertTrue(result, result.startsWith("error|1|Line 1: unknown sport"));+ assertTrue(result, result.startsWith("error|1|Line 1: the first column is not a sport"));assertTrue(result.endsWith("done\n"));assertEquals(1, repo.calendars().size());assertEquals("Minnesota Wild", repo.calendars().get(0).name);