YouTube 2.0.0: native client without ads
All checks were successful
release / release (push) Successful in 10m13s
All checks were successful
release / release (push) Successful in 10m13s
Replaces the web app (youtube.com/tv in Chromium) with a native Rust + Slint client on sf-ui, built on Netflex TV's page engine. - InnerTube: web client for public pages, the TV client with the account's OAuth token for personal ones, visionOS (direct URLs) for streams, the TV client with yt-dlp's ejs solver (QuickJS) as fallback. - One version, no ads: ad breaks are never requested, ad renderers are skipped in feeds. SponsorBlock skips sponsored parts. - Sign-in with a QR code / youtube.com/activate (OAuth device flow). - Signed out: subscriptions and history on the TV; a home filled with this week's popular Hungarian videos when YouTube's is empty. - Playback: one-quality DASH manifest for GStreamer, H.264 up to 1080p or AV1 up to 4K, captions, quality switching, up next, resume. - Release builds for x86-64 and the Raspberry Pi (aarch64). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
154
ui/app.slint
Normal file
154
ui/app.slint
Normal file
@@ -0,0 +1,154 @@
|
||||
// YouTube for Fennec OS: the root window.
|
||||
//
|
||||
// Screens: "page" (every browsing screen: a LinePage built by src/page.rs)
|
||||
// and "player". Over them: the QR sign-in and the toast.
|
||||
//
|
||||
// Rust owns state and focus: every key goes to the `key` callback, except
|
||||
// while the search keyboard has the focus.
|
||||
|
||||
import { TvWindow, Tv, SfText, GlassRect, MenuItem } from "@sf-ui/sf-ui.slint";
|
||||
import { Line, Chip, Card, Check } from "types.slint";
|
||||
import { LinePage } from "page.slint";
|
||||
import { PlayerScreen } from "player.slint";
|
||||
import { LinkScreen } from "link.slint";
|
||||
import { Toast } from "overlays.slint";
|
||||
|
||||
export { Tv, SfText, MenuItem, Line, Chip, Card, Check }
|
||||
|
||||
export component App inherits TvWindow {
|
||||
title: "YouTube";
|
||||
forward-focus: keys;
|
||||
|
||||
// "page", "player"
|
||||
in property <string> screen: "page";
|
||||
// The key text (Slint's Key codes) and whether it repeats; true = handled.
|
||||
callback key(string, bool) -> bool;
|
||||
|
||||
out property <float> page-t: self.screen == "page" ? 1 : 0;
|
||||
animate page-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> player-t: self.screen == "player" ? 1 : 0;
|
||||
animate player-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> link-t: self.link-open ? 1 : 0;
|
||||
animate link-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
// Whatever an overlay would cover goes away first.
|
||||
property <float> under: max(0, 1 - 1.6 * self.link-t);
|
||||
// The outgoing screen goes first, the incoming one follows.
|
||||
function vis(t: float) -> float {
|
||||
clamp(t * 2 - 1, 0, 1)
|
||||
}
|
||||
|
||||
keys := FocusScope {
|
||||
key-pressed(event) => {
|
||||
if root.screen == "page" && root.page-kb-focused && !root.link-open {
|
||||
return page.kb-key(event);
|
||||
}
|
||||
if root.key(event.text, event.repeat) {
|
||||
return accept;
|
||||
}
|
||||
reject
|
||||
}
|
||||
}
|
||||
|
||||
// ---- page ----
|
||||
in property <[Line]> page-lines <=> page.lines;
|
||||
in property <int> page-focus <=> page.focus-line;
|
||||
in property <float> page-scroll <=> page.scroll;
|
||||
in property <bool> page-show-nav <=> page.show-nav;
|
||||
in property <[string]> page-nav-items <=> page.nav-items;
|
||||
in property <int> page-nav-index <=> page.nav-index;
|
||||
in property <bool> page-nav-focused <=> page.nav-focused;
|
||||
in property <string> page-account-label <=> page.account-label;
|
||||
in property <bool> page-account-ok <=> page.account-ok;
|
||||
in property <string> page-side-title <=> page.side-title;
|
||||
in property <[string]> page-side-items <=> page.side-items;
|
||||
in property <int> page-side-index <=> page.side-index;
|
||||
in property <int> page-side-focus <=> page.side-focus;
|
||||
in property <float> page-kb-y <=> page.kb-y;
|
||||
in property <bool> page-kb-focused <=> page.kb-focused;
|
||||
in property <string> page-kb-placeholder <=> page.kb-placeholder;
|
||||
in-out property <string> page-query <=> page.query;
|
||||
callback search-submitted(string);
|
||||
callback search-changed(string);
|
||||
changed page-query => {
|
||||
root.search-changed(self.page-query);
|
||||
}
|
||||
callback search-exit-down();
|
||||
callback search-exit-up();
|
||||
callback search-cancelled();
|
||||
public function page-kb-reset() {
|
||||
page.kb-reset();
|
||||
}
|
||||
page := LinePage {
|
||||
alpha: root.vis(root.page-t) * root.under;
|
||||
visible: root.page-t > 0.001;
|
||||
search-submitted(t) => { root.search-submitted(t); }
|
||||
search-exit-down => { root.search-exit-down(); }
|
||||
search-exit-up => { root.search-exit-up(); }
|
||||
search-cancelled => { root.search-cancelled(); }
|
||||
}
|
||||
|
||||
// ---- player ----
|
||||
in property <string> player-stage <=> player.stage;
|
||||
in property <string> player-title <=> player.title;
|
||||
in property <string> player-heading <=> player.heading;
|
||||
in property <string> player-info <=> player.info;
|
||||
in property <string> player-caption <=> player.caption;
|
||||
in property <string> player-stage-text <=> player.stage-text;
|
||||
in property <string> player-detail-text <=> player.detail-text;
|
||||
in property <string> player-error-text <=> player.error-text;
|
||||
in property <bool> player-osd <=> player.osd;
|
||||
in property <bool> player-paused <=> player.paused;
|
||||
in property <bool> player-buffering <=> player.buffering;
|
||||
in property <string> player-buffer-text <=> player.buffer-text;
|
||||
in property <float> player-progress <=> player.progress;
|
||||
in property <float> player-buffered <=> player.buffered;
|
||||
in property <string> player-time-text <=> player.time-text;
|
||||
in property <string> player-remaining-text <=> player.remaining-text;
|
||||
in property <bool> player-seeking <=> player.seeking;
|
||||
in property <string> player-seek-text <=> player.seek-text;
|
||||
in property <string> player-seek-delta <=> player.seek-delta;
|
||||
in property <bool> player-seek-back <=> player.seek-back;
|
||||
in property <int> player-osd-area <=> player.osd-area;
|
||||
in property <int> player-osd-button <=> player.osd-button;
|
||||
in property <bool> player-has-next <=> player.has-next;
|
||||
in property <bool> player-has-channel <=> player.has-channel;
|
||||
in property <int> player-panel <=> player.panel;
|
||||
in property <[MenuItem]> player-subs <=> player.subs;
|
||||
in property <[MenuItem]> player-quality <=> player.quality;
|
||||
in property <int> player-subs-focus <=> player.subs-focus;
|
||||
in property <int> player-quality-focus <=> player.quality-focus;
|
||||
in property <string> player-skip-label <=> player.skip-label;
|
||||
in property <string> player-next-label <=> player.next-label;
|
||||
in property <string> player-next-text <=> player.next-text;
|
||||
player := PlayerScreen {
|
||||
alpha: root.vis(root.player-t) * root.under;
|
||||
visible: root.player-t > 0.001;
|
||||
stage-text: "Betöltés…";
|
||||
}
|
||||
|
||||
// ---- QR sign-in ----
|
||||
in property <bool> link-open;
|
||||
in property <image> link-qr <=> link.qr;
|
||||
in property <string> link-code <=> link.code;
|
||||
in property <string> link-url <=> link.url;
|
||||
in property <string> link-status <=> link.status;
|
||||
in-out property <bool> link-busy <=> link.busy;
|
||||
link := LinkScreen {
|
||||
alpha: root.vis(root.link-t);
|
||||
visible: root.link-t > 0.001;
|
||||
}
|
||||
|
||||
// ---- toast ----
|
||||
in property <string> toast-text <=> toast.text;
|
||||
in property <bool> toast-bad <=> toast.bad;
|
||||
toast := Toast { }
|
||||
|
||||
// ---- glass, in drawing order (listed by src/main.rs) ----
|
||||
out property <[GlassRect]> glass-page: page.glass;
|
||||
out property <[GlassRect]> glass-page-keyboard: page.glass-keyboard;
|
||||
out property <[GlassRect]> glass-player: player.glass;
|
||||
out property <[GlassRect]> glass-player-subs: player.glass-subs;
|
||||
out property <[GlassRect]> glass-player-quality: player.glass-quality;
|
||||
out property <[GlassRect]> glass-link: link.glass;
|
||||
out property <[GlassRect]> glass-toast: toast.glass;
|
||||
}
|
||||
Reference in New Issue
Block a user