mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Merge pull request #4924 from pixelfed/staging
Update public/network timelines, fix non-redis response and fix reblo…
This commit is contained in:
commit
b10c60584b
11 changed files with 96 additions and 29 deletions
|
@ -5,6 +5,7 @@
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
- Update ApiV1Controller, fix network timeline ([0faf59e3](https://github.com/pixelfed/pixelfed/commit/0faf59e3))
|
- Update ApiV1Controller, fix network timeline ([0faf59e3](https://github.com/pixelfed/pixelfed/commit/0faf59e3))
|
||||||
|
- Update public/network timelines, fix non-redis response and fix reblogs in home feed ([8b4ac5cc](https://github.com/pixelfed/pixelfed/commit/8b4ac5cc))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.11 (2024-02-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.10...v0.11.11)
|
## [v0.11.11 (2024-02-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.10...v0.11.11)
|
||||||
|
|
|
@ -2523,6 +2523,7 @@ class ApiV1Controller extends Controller
|
||||||
$napi = $request->has(self::PF_API_ENTITY_KEY);
|
$napi = $request->has(self::PF_API_ENTITY_KEY);
|
||||||
$min = $request->input('min_id');
|
$min = $request->input('min_id');
|
||||||
$max = $request->input('max_id');
|
$max = $request->input('max_id');
|
||||||
|
$minOrMax = $request->anyFilled(['max_id', 'min_id']);
|
||||||
$limit = $request->input('limit') ?? 20;
|
$limit = $request->input('limit') ?? 20;
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
|
@ -2535,6 +2536,8 @@ class ApiV1Controller extends Controller
|
||||||
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
||||||
AccountService::setLastActive($user->id);
|
AccountService::setLastActive($user->id);
|
||||||
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
||||||
|
$hideNsfw = config('instance.hide_nsfw_on_public_feeds');
|
||||||
|
$amin = SnowflakeService::byDate(now()->subDays(config('federation.network_timeline_days_falloff')));
|
||||||
|
|
||||||
if($remote) {
|
if($remote) {
|
||||||
if(config('instance.timeline.network.cached')) {
|
if(config('instance.timeline.network.cached')) {
|
||||||
|
@ -2554,23 +2557,36 @@ class ApiV1Controller extends Controller
|
||||||
} else {
|
} else {
|
||||||
$feed = Status::select(
|
$feed = Status::select(
|
||||||
'id',
|
'id',
|
||||||
'profile_id',
|
'uri',
|
||||||
'type',
|
'type',
|
||||||
'visibility',
|
'scope',
|
||||||
|
'local',
|
||||||
|
'created_at',
|
||||||
|
'profile_id',
|
||||||
'in_reply_to_id',
|
'in_reply_to_id',
|
||||||
'reblog_of_id'
|
'reblog_of_id'
|
||||||
)
|
)
|
||||||
|
->when($minOrMax, function($q, $minOrMax) use($min, $max) {
|
||||||
|
$dir = $min ? '>' : '<';
|
||||||
|
$id = $min ?? $max;
|
||||||
|
return $q->where('id', $dir, $id);
|
||||||
|
})
|
||||||
|
->whereNull(['in_reply_to_id', 'reblog_of_id'])
|
||||||
|
->when($hideNsfw, function($q, $hideNsfw) {
|
||||||
|
return $q->where('is_nsfw', false);
|
||||||
|
})
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
->where('visibility', 'public')
|
|
||||||
->whereLocal(false)
|
->whereLocal(false)
|
||||||
|
->whereScope('public')
|
||||||
|
->where('id', '>', $amin)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->take(($limit * 2))
|
->limit(($limit * 2))
|
||||||
->pluck('id');
|
->pluck('id')
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
if(config('instance.timeline.local.cached')) {
|
||||||
|
|
||||||
if($local || !$remote && !$local) {
|
|
||||||
Cache::remember('api:v1:timelines:public:cache_check', 10368000, function() {
|
Cache::remember('api:v1:timelines:public:cache_check', 10368000, function() {
|
||||||
if(PublicTimelineService::count() == 0) {
|
if(PublicTimelineService::count() == 0) {
|
||||||
PublicTimelineService::warmCache(true, 400);
|
PublicTimelineService::warmCache(true, 400);
|
||||||
|
@ -2584,6 +2600,37 @@ class ApiV1Controller extends Controller
|
||||||
} else {
|
} else {
|
||||||
$feed = PublicTimelineService::get(0, $limit + 5);
|
$feed = PublicTimelineService::get(0, $limit + 5);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$feed = Status::select(
|
||||||
|
'id',
|
||||||
|
'uri',
|
||||||
|
'type',
|
||||||
|
'scope',
|
||||||
|
'local',
|
||||||
|
'created_at',
|
||||||
|
'profile_id',
|
||||||
|
'in_reply_to_id',
|
||||||
|
'reblog_of_id'
|
||||||
|
)
|
||||||
|
->when($minOrMax, function($q, $minOrMax) use($min, $max) {
|
||||||
|
$dir = $min ? '>' : '<';
|
||||||
|
$id = $min ?? $max;
|
||||||
|
return $q->where('id', $dir, $id);
|
||||||
|
})
|
||||||
|
->whereNull(['in_reply_to_id', 'reblog_of_id'])
|
||||||
|
->when($hideNsfw, function($q, $hideNsfw) {
|
||||||
|
return $q->where('is_nsfw', false);
|
||||||
|
})
|
||||||
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
|
->whereLocal(true)
|
||||||
|
->whereScope('public')
|
||||||
|
->where('id', '>', $amin)
|
||||||
|
->orderByDesc('id')
|
||||||
|
->limit(($limit * 2))
|
||||||
|
->pluck('id')
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = collect($feed)
|
$res = collect($feed)
|
||||||
|
|
|
@ -29,6 +29,7 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'local' => [
|
'local' => [
|
||||||
|
'cached' => env('INSTANCE_PUBLIC_TIMELINE_CACHED', false),
|
||||||
'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false)
|
'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false)
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
BIN
public/js/account-import.js
vendored
BIN
public/js/account-import.js
vendored
Binary file not shown.
BIN
public/js/home.chunk.ada2cbf0ec3271bd.js
vendored
Normal file
BIN
public/js/home.chunk.ada2cbf0ec3271bd.js
vendored
Normal file
Binary file not shown.
BIN
public/js/home.chunk.f3f4f632025b560f.js
vendored
BIN
public/js/home.chunk.f3f4f632025b560f.js
vendored
Binary file not shown.
BIN
public/js/manifest.js
vendored
BIN
public/js/manifest.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -197,8 +197,17 @@
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<div class="list-group-item d-flex justify-content-between align-items-center">
|
<div class="list-group-item d-flex justify-content-between align-items-center">
|
||||||
<p class="text-center font-weight-bold mb-0">Media #{{idx + 1}}</p>
|
<p class="text-center font-weight-bold mb-0">Media #{{idx + 1}}</p>
|
||||||
|
<template v-if="media.uri.endsWith('.jpg') || media.uri.endsWith('.png')">
|
||||||
<img :src="getFileNameUrl(media.uri)" width="30" height="30" style="object-fit: cover; border-radius: 5px;">
|
<img :src="getFileNameUrl(media.uri)" width="30" height="30" style="object-fit: cover; border-radius: 5px;">
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
<template v-if="media.uri.endsWith('.mp4')">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<div class="embed-responsive embed-responsive-4by3">
|
||||||
|
<video :src="getFileNameUrl(media.uri)" controls></video>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
<p class="small text-muted">Caption</p>
|
<p class="small text-muted">Caption</p>
|
||||||
<p class="mb-0 small read-more" style="font-size: 12px;overflow-y: hidden;">{{ media.title ? media.title : modalData.title }}</p>
|
<p class="mb-0 small read-more" style="font-size: 12px;overflow-y: hidden;">{{ media.title ? media.title : modalData.title }}</p>
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
forceUpdateIdx: 0,
|
forceUpdateIdx: 0,
|
||||||
showReblogBanner: false,
|
showReblogBanner: false,
|
||||||
enablingReblogs: false,
|
enablingReblogs: false,
|
||||||
baseApi: '/api/v1/pixelfed/timelines/',
|
baseApi: '/api/v1/timelines/',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@
|
||||||
}
|
}
|
||||||
if(window.App.config.ab.hasOwnProperty('cached_home_timeline')) {
|
if(window.App.config.ab.hasOwnProperty('cached_home_timeline')) {
|
||||||
const cht = window.App.config.ab.cached_home_timeline == true;
|
const cht = window.App.config.ab.cached_home_timeline == true;
|
||||||
this.baseApi = cht ? '/api/v1/timelines/' : '/api/pixelfed/v1/timelines/';
|
this.baseApi = cht ? '/api/v1/timelines/' : '/api/v1/timelines/';
|
||||||
}
|
}
|
||||||
this.fetchSettings();
|
this.fetchSettings();
|
||||||
},
|
},
|
||||||
|
@ -261,12 +261,21 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url = this.baseApi + this.getScope();
|
url = this.baseApi + this.getScope();
|
||||||
|
|
||||||
|
if(this.max_id === 0) {
|
||||||
|
params = {
|
||||||
|
min_id: 1,
|
||||||
|
limit: 6,
|
||||||
|
'_pe': 1,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
params = {
|
params = {
|
||||||
max_id: this.max_id,
|
max_id: this.max_id,
|
||||||
limit: 6,
|
limit: 6,
|
||||||
'_pe': 1,
|
'_pe': 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(this.getScope() === 'network') {
|
if(this.getScope() === 'network') {
|
||||||
params.remote = true;
|
params.remote = true;
|
||||||
url = this.baseApi + `public`;
|
url = this.baseApi + `public`;
|
||||||
|
|
Loading…
Reference in a new issue