2021-07-16 22:56:41 +00:00
|
|
|
<template>
|
|
|
|
<h1 class="uk-text-bold uk-text-center">Feed</h1>
|
|
|
|
|
|
|
|
<small>You can import subscriptions from <router-link to="/import">here</router-link>.</small>
|
|
|
|
|
2021-07-22 20:05:48 +00:00
|
|
|
<br />
|
|
|
|
<router-link to="/subscriptions" class="uk-text-center">View Subscriptions</router-link>
|
|
|
|
|
2021-07-27 18:04:27 +00:00
|
|
|
<br />
|
|
|
|
Sort by:
|
|
|
|
<select class="uk-select uk-width-auto" v-model="selectedSort" @change="onChange()">
|
|
|
|
<option value="descending">Most Recent</option>
|
|
|
|
<option value="ascending">Least Recent</option>
|
|
|
|
<option value="channel_ascending">Channel Name (A-Z)</option>
|
|
|
|
<option value="channel_descending">Channel Name (Z-A)</option>
|
|
|
|
</select>
|
|
|
|
|
2021-07-19 19:44:55 +00:00
|
|
|
<div class="uk-align-right">
|
|
|
|
<a :href="getRssUrl"><font-awesome-icon icon="rss"></font-awesome-icon></a>
|
|
|
|
</div>
|
|
|
|
|
2021-07-16 22:56:41 +00:00
|
|
|
<hr />
|
|
|
|
|
|
|
|
<div class="uk-grid-xl" uk-grid="parallax: 0">
|
|
|
|
<div
|
|
|
|
:style="[{ background: backgroundColor }]"
|
|
|
|
class="uk-width-1-2 uk-width-1-3@s uk-width-1-4@m uk-width-1-5@l uk-width-1-6@xl"
|
|
|
|
v-bind:key="video.url"
|
|
|
|
v-for="video in videos"
|
|
|
|
>
|
2021-07-21 12:32:17 +00:00
|
|
|
<VideoItem :video="video" />
|
2021-07-16 22:56:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-07-21 12:32:17 +00:00
|
|
|
import VideoItem from "@/components/VideoItem.vue";
|
|
|
|
|
2021-07-16 22:56:41 +00:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
videos: [],
|
2021-07-27 18:04:27 +00:00
|
|
|
selectedSort: "descending",
|
2021-07-16 22:56:41 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchFeed().then(videos => (this.videos = videos));
|
|
|
|
},
|
2021-07-21 10:59:53 +00:00
|
|
|
activated() {
|
|
|
|
document.title = "Feed - Piped";
|
|
|
|
},
|
2021-07-16 22:56:41 +00:00
|
|
|
methods: {
|
|
|
|
async fetchFeed() {
|
|
|
|
return await this.fetchJson(this.apiUrl() + "/feed", {
|
|
|
|
authToken: this.getAuthToken(),
|
|
|
|
});
|
|
|
|
},
|
2021-07-27 18:04:27 +00:00
|
|
|
onChange() {
|
|
|
|
switch (this.selectedSort) {
|
|
|
|
case "ascending":
|
|
|
|
this.videos.sort((a, b) => a.uploaded - b.uploaded);
|
|
|
|
break;
|
|
|
|
case "descending":
|
|
|
|
this.videos.sort((a, b) => b.uploaded - a.uploaded);
|
|
|
|
break;
|
|
|
|
case "channel_ascending":
|
|
|
|
this.videos.sort((a, b) => a.uploaderName.localeCompare(b.uploaderName));
|
|
|
|
break;
|
|
|
|
case "channel_descending":
|
|
|
|
this.videos.sort((a, b) => b.uploaderName.localeCompare(a.uploaderName));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
2021-07-16 22:56:41 +00:00
|
|
|
},
|
2021-07-19 19:44:55 +00:00
|
|
|
computed: {
|
|
|
|
getRssUrl(_this) {
|
|
|
|
return _this.apiUrl() + "/feed/rss?authToken=" + _this.getAuthToken();
|
|
|
|
},
|
|
|
|
},
|
2021-07-21 12:32:17 +00:00
|
|
|
components: {
|
|
|
|
VideoItem,
|
|
|
|
},
|
2021-07-16 22:56:41 +00:00
|
|
|
};
|
|
|
|
</script>
|