mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
Update DiscoverComponent, allow unathenicated if enabled
This commit is contained in:
parent
e6e76e809d
commit
a1059a6e12
1 changed files with 22 additions and 11 deletions
|
@ -4,7 +4,7 @@
|
||||||
<img src="/img/pixelfed-icon-grey.svg">
|
<img src="/img/pixelfed-icon-grey.svg">
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="d-block d-md-none border-top-0 pt-3">
|
<div v-if="authenticated" class="d-block d-md-none border-top-0 pt-3">
|
||||||
<input class="form-control rounded-pill shadow-sm" placeholder="Search" v-model="searchTerm" v-on:keyup.enter="searchSubmit">
|
<input class="form-control rounded-pill shadow-sm" placeholder="Search" v-model="searchTerm" v-on:keyup.enter="searchSubmit">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="pt-5 mb-5 section-explore">
|
<section v-if="authenticated" class="pt-5 mb-5 section-explore">
|
||||||
<div class="profile-timeline pt-3">
|
<div class="profile-timeline pt-3">
|
||||||
<div class="row p-0 mt-5">
|
<div class="row p-0 mt-5">
|
||||||
<div class="col-12 mb-3 d-flex justify-content-between align-items-center">
|
<div class="col-12 mb-3 d-flex justify-content-between align-items-center">
|
||||||
|
@ -151,6 +151,7 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
authenticated: false,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
config: window.App.config,
|
config: window.App.config,
|
||||||
posts: {},
|
posts: {},
|
||||||
|
@ -163,14 +164,21 @@
|
||||||
recommendedLoading: true
|
recommendedLoading: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeMount() {
|
||||||
|
this.authenticated = $('body').hasClass('loggedIn');
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
this.loadTrending();
|
this.loadTrending();
|
||||||
|
if($('body').hasClass('loggedIn') == true) {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
window._sharedData.curUser = res.data;
|
window._sharedData.curUser = res.data;
|
||||||
window.App.util.navatar();
|
window.App.util.navatar();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -180,7 +188,7 @@
|
||||||
}
|
}
|
||||||
axios.get('/api/pixelfed/v2/discover/posts')
|
axios.get('/api/pixelfed/v2/discover/posts')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.posts = res.data.posts;
|
this.posts = res.data.posts.filter(r => r != null);
|
||||||
this.recommendedLoading = false;
|
this.recommendedLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -206,13 +214,16 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
let data = res.data.filter(r => {
|
||||||
|
return r !== null;
|
||||||
|
});
|
||||||
if(this.trendingRange == 'daily') {
|
if(this.trendingRange == 'daily') {
|
||||||
this.trendingDaily = res.data.filter(t => t.sensitive == false);
|
this.trendingDaily = data.filter(t => t.sensitive == false);
|
||||||
}
|
}
|
||||||
if(this.trendingRange == 'monthly') {
|
if(this.trendingRange == 'monthly') {
|
||||||
this.trendingMonthly = res.data.filter(t => t.sensitive == false);
|
this.trendingMonthly = data.filter(t => t.sensitive == false);
|
||||||
}
|
}
|
||||||
this.trending = res.data;
|
this.trending = data;
|
||||||
this.trendingLoading = false;
|
this.trendingLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue