mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
unauthenticated feed
This commit is contained in:
parent
e902c0b6e2
commit
5327a0ba58
3 changed files with 25 additions and 13 deletions
|
@ -45,13 +45,11 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.authenticated)
|
|
||||||
this.fetchFeed().then(videos => {
|
this.fetchFeed().then(videos => {
|
||||||
this.videosStore = videos;
|
this.videosStore = videos;
|
||||||
this.loadMoreVideos();
|
this.loadMoreVideos();
|
||||||
this.updateWatched(this.videos);
|
this.updateWatched(this.videos);
|
||||||
});
|
});
|
||||||
else this.$router.push("/login");
|
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
document.title = this.$t("titles.feed") + " - Piped";
|
document.title = this.$t("titles.feed") + " - Piped";
|
||||||
|
@ -66,9 +64,21 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchFeed() {
|
async fetchFeed() {
|
||||||
|
if (this.authenticated) {
|
||||||
return await this.fetchJson(this.authApiUrl() + "/feed", {
|
return await this.fetchJson(this.authApiUrl() + "/feed", {
|
||||||
authToken: this.getAuthToken(),
|
authToken: this.getAuthToken(),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
const localSubscriptions = this.getLocalSubscriptions();
|
||||||
|
var channels = "";
|
||||||
|
localSubscriptions.forEach((element, index) => {
|
||||||
|
channels += element;
|
||||||
|
if (localSubscriptions.size != index) channels += ",";
|
||||||
|
});
|
||||||
|
return await this.fetchJson(this.authApiUrl() + "/feed/unauthenticated", {
|
||||||
|
channels: channels,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
loadMoreVideos() {
|
loadMoreVideos() {
|
||||||
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
|
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<li v-if="authenticated">
|
<li v-if="authenticated">
|
||||||
<router-link v-t="'titles.playlists'" to="/playlists" />
|
<router-link v-t="'titles.playlists'" to="/playlists" />
|
||||||
</li>
|
</li>
|
||||||
<li v-if="authenticated && !shouldShowTrending">
|
<li v-if="!shouldShowTrending">
|
||||||
<router-link v-t="'titles.feed'" to="/feed" />
|
<router-link v-t="'titles.feed'" to="/feed" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<li v-if="authenticated">
|
<li v-if="authenticated">
|
||||||
<router-link v-t="'titles.playlists'" to="/playlists" />
|
<router-link v-t="'titles.playlists'" to="/playlists" />
|
||||||
</li>
|
</li>
|
||||||
<li v-if="authenticated && !shouldShowTrending">
|
<li v-if="!shouldShowTrending">
|
||||||
<router-link v-t="'titles.feed'" to="/feed" />
|
<router-link v-t="'titles.feed'" to="/feed" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -203,7 +203,9 @@ const mixin = {
|
||||||
return JSON.parse(localStorage.getItem("localSubscriptions"));
|
return JSON.parse(localStorage.getItem("localSubscriptions"));
|
||||||
},
|
},
|
||||||
isSubscribedLocally(channelId) {
|
isSubscribedLocally(channelId) {
|
||||||
return this.getLocalSubscriptions().includes(channelId);
|
const localSubscriptions = this.getLocalSubscriptions();
|
||||||
|
if (localSubscriptions == null) return false;
|
||||||
|
return localSubscriptions.includes(channelId);
|
||||||
},
|
},
|
||||||
handleLocalSubscriptions(channelId) {
|
handleLocalSubscriptions(channelId) {
|
||||||
var localSubscriptions = this.getLocalSubscriptions();
|
var localSubscriptions = this.getLocalSubscriptions();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue