From f70217003da1789c6fe8d8c40f23d06fec65b6f5 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:25:30 -0500 Subject: [PATCH] Adjust default view selection for auth state --- js/app.js | 5 ++++- js/index.js | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index ef0270f6..78039277 100644 --- a/js/app.js +++ b/js/app.js @@ -775,9 +775,12 @@ class Application { devLogger.log( "[app.init()] No #view= in the URL, loading default home view" ); + const defaultView = this.isUserLoggedIn() + ? "views/for-you.html" + : "views/most-recent-videos.html"; if (typeof this.loadView === "function") { await Promise.all([ - this.loadView("views/most-recent-videos.html"), + this.loadView(defaultView), watchHistoryInitPromise, ]); } else { diff --git a/js/index.js b/js/index.js index 9b6178fd..ab420c28 100644 --- a/js/index.js +++ b/js/index.js @@ -1392,9 +1392,11 @@ async function handleHashChange() { try { if (!match || !match[1]) { - // No valid "#view=..." => default to "most-recent-videos" - await loadView("views/most-recent-videos.html"); - const initFn = viewInitRegistry["most-recent-videos"]; + // No valid "#view=..." => default to "for-you" when logged in + const isLoggedIn = getApplication()?.isUserLoggedIn(); + const defaultViewName = isLoggedIn ? "for-you" : "most-recent-videos"; + await loadView(`views/${defaultViewName}.html`); + const initFn = viewInitRegistry[defaultViewName]; if (typeof initFn === "function") { await initFn(); }