No description
- Kotlin 60.7%
- JavaScript 39.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
After an account switch, something poked past the screen edge, Chromium widened the layout viewport (1175x661 instead of 960x540) and YouTube laid itself out for that, so the page stayed zoomed in. innerWidth and innerHeight now never exceed the visible viewport, and html/body are clipped to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Eq42wAsUv6LRiJasoPsAXZ |
||
| app | ||
| gradle/wrapper | ||
| preload | ||
| upstream | ||
| .gitignore | ||
| .gitmodules | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle.kts | ||
VacuumTube for Android TV
VacuumTube (YouTube's TV interface, youtube.com/tv, with ad blocking, SponsorBlock, DeArrow and VacuumTube's settings overlay) as an Android TV app, meant to behave like the Linux flatpak on a TV with a remote.
How it works
VacuumTube is an Electron app. Its preload script, which does nearly everything, is reused unchanged; the Electron main process is replaced:
| Upstream (Electron) | Here |
|---|---|
src/preload/** |
Bundled as-is by preload/build.mjs (esbuild), injected with WebViewCompat.addDocumentStartJavaScript |
require('electron'), fs, os, crypto |
Shims in preload/src/shims/, backed by VtBridge (@JavascriptInterface) |
webRequest.onHeadersReceived CSP rewrite |
RequestInterceptor re-fetches the /tv document with OkHttp and applies CspRewriter |
User agent + client hints (src/ua.js) |
Evaluated at build time into upstream.json; client hints via WebSettingsCompat.setUserAgentMetadata |
config.json |
ConfigStore (SharedPreferences), edited through VacuumTube's own settings overlay |
| DIAL casting server | Stubbed (preload/src/dial/); use YouTube's "Link with TV code" instead |
Upstream lives in upstream/VacuumTube as a git submodule and is never edited; the few text patches in build.mjs fail the build if their anchors stop matching. Window-only settings (fullscreen, always on top, auto-update, userstyles, touch overlay…) are hidden.
TV specifics:
- DRM: Widevine (
RESOURCE_PROTECTED_MEDIA_ID) is granted to youtube.com, so purchases and Primetime Channels can play. The WebView only exposes the device's L3 level on the TCL tested, which YouTube may cap at SD/720p for paid titles. - 4K: Leanback picks its top quality from the screen size, which WebView reports in CSS pixels; the panel's real resolution is passed in instead.
- Back becomes Escape, which is back for Leanback and the settings overlay; on Home it brings up Leanback's exit dialog.
- WebView Safe Browsing, metrics and autofill are off, so the app talks to nothing but YouTube.
Build
Needs JDK 17+ and Node/npm (the preload bundle is built by Gradle).
git submodule update --init
./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk
Release builds are signed with the debug key for now.