From 584f1854e22b5f13f680869c97ef966e25340cb7 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 19 Jul 2021 01:50:35 +0530 Subject: [PATCH] Add support for setting a default homepage. --- src/App.vue | 12 ++++++++++++ src/components/Preferences.vue | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/App.vue b/src/App.vue index 78841e34..4e74b80b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,6 +30,18 @@ export default { components: { Navigation, }, + mounted() { + if (window.location.pathname === "/" || window.location.pathname.length == 0) + switch (this.getPreferenceString("homepage", "trending")) { + case "trending": + break; + case "feed": + this.$router.push("/feed"); + return; + default: + break; + } + }, }; diff --git a/src/components/Preferences.vue b/src/components/Preferences.vue index f3ce7c81..76c6f3fb 100644 --- a/src/components/Preferences.vue +++ b/src/components/Preferences.vue @@ -67,6 +67,13 @@ +
+ Default Homepage +
+

Instances List

@@ -123,6 +130,7 @@ export default { bufferingGoal: 10, countryMap: CountryMap.COUNTRIES, country: "US", + defaultHomepage: "trending", }; }, mounted() { @@ -193,6 +201,7 @@ export default { this.defaultQuality = Number(localStorage.getItem("quality")); this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10); this.country = this.getPreferenceString("region", "US"); + this.defaultHomepage = this.getPreferenceString("homepage", "trending"); } }, methods: { @@ -221,6 +230,7 @@ export default { localStorage.setItem("quality", this.defaultQuality); localStorage.setItem("bufferGoal", this.bufferingGoal); localStorage.setItem("region", this.country); + localStorage.setItem("homepage", this.defaultHomepage); if (shouldReload) window.location.reload(); }