mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update Timeline.vue, improve CHT pagination
This commit is contained in:
parent
822e9888bb
commit
9c43e7e265
1 changed files with 23 additions and 6 deletions
|
@ -186,7 +186,8 @@
|
||||||
sharesModalPost: {},
|
sharesModalPost: {},
|
||||||
forceUpdateIdx: 0,
|
forceUpdateIdx: 0,
|
||||||
showReblogBanner: false,
|
showReblogBanner: false,
|
||||||
enablingReblogs: false
|
enablingReblogs: false,
|
||||||
|
baseApi: '/api/v1/pixelfed/timelines/',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -201,6 +202,10 @@
|
||||||
return;
|
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();
|
this.fetchSettings();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -247,7 +252,7 @@
|
||||||
fetchTimeline(scrollToTop = false) {
|
fetchTimeline(scrollToTop = false) {
|
||||||
let url, params;
|
let url, params;
|
||||||
if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) {
|
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 = {
|
params = {
|
||||||
'_pe': 1,
|
'_pe': 1,
|
||||||
max_id: this.max_id,
|
max_id: this.max_id,
|
||||||
|
@ -255,12 +260,17 @@
|
||||||
include_reblogs: true,
|
include_reblogs: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url = `/api/pixelfed/v1/timelines/${this.getScope()}`;
|
url = this.baseApi + this.getScope();
|
||||||
params = {
|
params = {
|
||||||
max_id: this.max_id,
|
max_id: this.max_id,
|
||||||
limit: 6,
|
limit: 6,
|
||||||
|
'_pe': 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.getScope() === 'network') {
|
||||||
|
params.remote = true;
|
||||||
|
url = this.baseApi + `public`;
|
||||||
|
}
|
||||||
axios.get(url, {
|
axios.get(url, {
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
@ -278,7 +288,7 @@
|
||||||
this.max_id = Math.min(...ids);
|
this.max_id = Math.min(...ids);
|
||||||
this.feed = res.data;
|
this.feed = res.data;
|
||||||
|
|
||||||
if(res.data.length !== 6) {
|
if(res.data.length < 4) {
|
||||||
this.canLoadMore = false;
|
this.canLoadMore = false;
|
||||||
this.showLoadMore = true;
|
this.showLoadMore = true;
|
||||||
}
|
}
|
||||||
|
@ -306,7 +316,8 @@
|
||||||
|
|
||||||
let url, params;
|
let url, params;
|
||||||
if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) {
|
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 = {
|
params = {
|
||||||
'_pe': 1,
|
'_pe': 1,
|
||||||
max_id: this.max_id,
|
max_id: this.max_id,
|
||||||
|
@ -314,12 +325,18 @@
|
||||||
include_reblogs: true,
|
include_reblogs: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url = `/api/pixelfed/v1/timelines/${this.getScope()}`;
|
url = this.baseApi + this.getScope();
|
||||||
params = {
|
params = {
|
||||||
max_id: this.max_id,
|
max_id: this.max_id,
|
||||||
limit: 6,
|
limit: 6,
|
||||||
|
'_pe': 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.getScope() === 'network') {
|
||||||
|
params.remote = true;
|
||||||
|
url = this.baseApi + `public`;
|
||||||
|
|
||||||
|
}
|
||||||
axios.get(url, {
|
axios.get(url, {
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
Loading…
Reference in a new issue