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(); }