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
tools: accept UTF-8 BOM in theme configs
SlivenReddefd5d272e96
diff --git a/tests/test_theme_paths.py b/tests/test_theme_paths.pyindex a16a1213d..65556e86f 100644--- a/tests/test_theme_paths.py+++ b/tests/test_theme_paths.py@@ -31,6 +31,40 @@ class ThemePathsTest(unittest.TestCase):self.assertIn(f"no config.json in {missing}", result.stderr)self.assertNotIn("not valid JSON", result.stderr)+ def test_utf8_config_is_pushed_unchanged(self):+ # Config.read accepts UTF-8 with an optional BOM, including files saved by Windows editors.+ text = json.dumps({"columns": 6, "greeting_name": "Trịnh"}, ensure_ascii=False) + "\n"+ for encoding in ("utf-8", "utf-8-sig"):+ for newline in ("\n", "\r\n"):+ with self.subTest(encoding=encoding, newline=newline), tempfile.TemporaryDirectory() as tmp:+ base = Path(tmp)+ tools = self.prepare(base / "repo")+ theme = base / "mytheme"+ theme.mkdir()+ config = theme / "config.json"+ data = text.replace("\n", newline).encode(encoding)+ config.write_bytes(data)+ result, capture = self.run_theme(tools, self.bash_path(theme), cwd=base)+ self.assertEqual(result.returncode, 0, result.stderr)+ push = next(line for line in capture.read_text().splitlines()+ if line.startswith("tv.py --push "))+ self.assertEqual(Path(push.split()[2]).resolve(), config.resolve())+ self.assertEqual(Path(str(capture) + ".push").read_bytes(), data)+ self.assertEqual(config.read_bytes(), data)++ def test_malformed_config_is_refused_before_transfer(self):+ for encoding in ("utf-8", "utf-8-sig"):+ with self.subTest(encoding=encoding), tempfile.TemporaryDirectory() as tmp:+ base = Path(tmp)+ tools = self.prepare(base / "repo")+ theme = base / "mytheme"+ theme.mkdir()+ (theme / "config.json").write_bytes('{"greeting_name":"Trịnh",'.encode(encoding))+ result, capture = self.run_theme(tools, self.bash_path(theme), cwd=base)+ self.assertNotEqual(result.returncode, 0)+ self.assertIn("not valid JSON", result.stderr)+ self.assertFalse(capture.exists(), "invalid JSON must not reach the TV transport")+def prepare(self, repo):"""Copy theme.sh and stand in for tools/venv/bin/python.@@ -49,6 +83,7 @@ class ThemePathsTest(unittest.TestCase):f' exec "{Path(sys.executable).as_posix()}" "$@"\n''fi\n''shift\n'+ 'if [ "$1" = "tv.py" ] && [ "$2" = "--push" ]; then cp "$3" "$CAPTURE.push"; fi\n''printf "%s\\n" "$*" >> "$CAPTURE"\n''echo applied\n')diff --git a/tools/theme.sh b/tools/theme.shindex 96b7f22eb..22de036ab 100755--- a/tools/theme.sh+++ b/tools/theme.sh@@ -72,7 +72,7 @@ if [ "${1:-}" = --reset ]; thenfiTHEME="${THEME_ARG:?usage: theme.sh <theme folder> | --reset}"[ -f "$THEME/config.json" ] || { echo "no config.json in $THEME" >&2; exit 1; }-"$PY" -I -c 'import json,sys; json.load(open(sys.argv[1]))' "$THEME/config.json" 2>/dev/null \+"$PY" -I -c 'import json,sys; json.load(open(sys.argv[1], encoding="utf-8-sig"))' "$THEME/config.json" 2>/dev/null \|| { echo "$THEME/config.json is not valid JSON" >&2; exit 1; }tv "mkdir -p $DIR" >/dev/null 2>&1 || true