Skip to content

Commit

Permalink
Update Timeline.vue, improve CHT pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Dec 8, 2023
1 parent 822e988 commit 9c43e7e
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions resources/assets/components/sections/Timeline.vue
Expand Up @@ -186,7 +186,8 @@
sharesModalPost: {},
forceUpdateIdx: 0,
showReblogBanner: false,
enablingReblogs: false
enablingReblogs: false,
baseApi: '/api/v1/pixelfed/timelines/',
}
},
Expand All @@ -201,6 +202,10 @@
return;
};
}
if(window.App.config.ab.hasOwnProperty('cached_home_timeline')) {
const cht = window.App.config.ab.cached_home_timeline == true;
this.baseApi = cht ? '/api/v1/timelines/' : '/api/pixelfed/v1/timelines/';
}
this.fetchSettings();
},
Expand Down Expand Up @@ -247,20 +252,25 @@
fetchTimeline(scrollToTop = false) {
let url, params;
if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) {
url = `/api/v1/timelines/home`;
url = this.baseApi + `home`;
params = {
'_pe': 1,
max_id: this.max_id,
limit: 6,
include_reblogs: true,
}
} else {
url = `/api/pixelfed/v1/timelines/${this.getScope()}`;
url = this.baseApi + this.getScope();
params = {
max_id: this.max_id,
limit: 6,
'_pe': 1,
}
}
if(this.getScope() === 'network') {
params.remote = true;
url = this.baseApi + `public`;
}
axios.get(url, {
params: params
}).then(res => {
Expand All @@ -278,7 +288,7 @@
this.max_id = Math.min(...ids);
this.feed = res.data;
if(res.data.length !== 6) {
if(res.data.length < 4) {
this.canLoadMore = false;
this.showLoadMore = true;
}
Expand Down Expand Up @@ -306,20 +316,27 @@
let url, params;
if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) {
url = `/api/v1/timelines/home`;
url = this.baseApi + `home`;
params = {
'_pe': 1,
max_id: this.max_id,
limit: 6,
include_reblogs: true,
}
} else {
url = `/api/pixelfed/v1/timelines/${this.getScope()}`;
url = this.baseApi + this.getScope();
params = {
max_id: this.max_id,
limit: 6,
'_pe': 1,
}
}
if(this.getScope() === 'network') {
params.remote = true;
url = this.baseApi + `public`;
}
axios.get(url, {
params: params
}).then(res => {
Expand Down

0 comments on commit 9c43e7e

Please sign in to comment.