mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Add support for setting a default homepage.
This commit is contained in:
parent
18eb12688a
commit
584f1854e2
2 changed files with 22 additions and 0 deletions
12
src/App.vue
12
src/App.vue
|
@ -30,6 +30,18 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Navigation,
|
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;
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,13 @@
|
||||||
<select class="uk-select uk-width-auto" v-model="country" @change="onChange($event)">
|
<select class="uk-select uk-width-auto" v-model="country" @change="onChange($event)">
|
||||||
<option :key="country.code" v-for="country in countryMap" :value="country.code">{{ country.name }}</option>
|
<option :key="country.code" v-for="country in countryMap" :value="country.code">{{ country.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<br />
|
||||||
|
<b>Default Homepage</b>
|
||||||
|
<br />
|
||||||
|
<select class="uk-select uk-width-auto" v-model="defaultHomepage" @change="onChange($event)">
|
||||||
|
<option value="trending">Trending</option>
|
||||||
|
<option value="feed">Feed</option>
|
||||||
|
</select>
|
||||||
<h2>Instances List</h2>
|
<h2>Instances List</h2>
|
||||||
<table class="uk-table">
|
<table class="uk-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -123,6 +130,7 @@ export default {
|
||||||
bufferingGoal: 10,
|
bufferingGoal: 10,
|
||||||
countryMap: CountryMap.COUNTRIES,
|
countryMap: CountryMap.COUNTRIES,
|
||||||
country: "US",
|
country: "US",
|
||||||
|
defaultHomepage: "trending",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -193,6 +201,7 @@ export default {
|
||||||
this.defaultQuality = Number(localStorage.getItem("quality"));
|
this.defaultQuality = Number(localStorage.getItem("quality"));
|
||||||
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
|
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
|
||||||
this.country = this.getPreferenceString("region", "US");
|
this.country = this.getPreferenceString("region", "US");
|
||||||
|
this.defaultHomepage = this.getPreferenceString("homepage", "trending");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -221,6 +230,7 @@ export default {
|
||||||
localStorage.setItem("quality", this.defaultQuality);
|
localStorage.setItem("quality", this.defaultQuality);
|
||||||
localStorage.setItem("bufferGoal", this.bufferingGoal);
|
localStorage.setItem("bufferGoal", this.bufferingGoal);
|
||||||
localStorage.setItem("region", this.country);
|
localStorage.setItem("region", this.country);
|
||||||
|
localStorage.setItem("homepage", this.defaultHomepage);
|
||||||
|
|
||||||
if (shouldReload) window.location.reload();
|
if (shouldReload) window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue