Update atom feed, improve cache expiry and fix double encoding bug. Fixes #4121

This commit is contained in:
Daniel Supernault 2023-03-18 21:45:35 -06:00
parent 3c712a70d6
commit 467c9d754e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
4 changed files with 11 additions and 4 deletions

View file

@ -207,7 +207,7 @@ class ProfileController extends Controller
abort_if(!$profile || $profile['locked'] || !$profile['local'], 404);
$data = Cache::remember('pf:atom:user-feed:by-id:' . $profile['id'], 86400, function() use($pid, $profile) {
$data = Cache::remember('pf:atom:user-feed:by-id:' . $profile['id'], 43200, function() use($pid, $profile) {
$items = DB::table('statuses')
->whereProfileId($pid)
->whereVisibility('public')

View file

@ -2,7 +2,7 @@
namespace App\Jobs\StatusPipeline;
use DB, Storage;
use DB, Cache, Storage;
use App\{
AccountInterstitial,
Bookmark,
@ -81,6 +81,8 @@ class StatusDelete implements ShouldQueue
}
}
Cache::forget('pf:atom:user-feed:by-id:' . $status->profile_id);
if(config_cache('federation.activitypub.enabled') == true) {
return $this->fanoutDelete($status);
} else {

View file

@ -12,6 +12,7 @@ use App\Services\PublicTimelineService;
use App\Util\Lexer\Autolink;
use App\Util\Lexer\Extractor;
use App\Util\Sentiment\Bouncer;
use Cache;
use DB;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
@ -166,6 +167,8 @@ class StatusEntityLexer implements ShouldQueue
if(config_cache('pixelfed.bouncer.enabled')) {
Bouncer::get($status);
}
Cache::forget('pf:atom:user-feed:by-id:' . $status->profile_id);
$hideNsfw = config('instance.hide_nsfw_on_public_feeds');
if( $status->uri == null &&
$status->scope == 'public' &&

View file

@ -24,12 +24,14 @@
</author>
<content type="html">
<![CDATA[
<img id="rss_item_{{$loop->iteration}}" src="{{ $item['media_attachments'][0]['url'] }}" alt="{{ $item['media_attachments'][0]['description'] }}">
<p style="padding:10px;">{{ $item['content'] }}</p>
<img id="rss_item_{{$item['id']}}" src="{{ $item['media_attachments'][0]['url'] }}" alt="{{ $item['media_attachments'][0]['description'] }}">
<p style="padding:10px;">{!! $item['content'] !!}</p>
]]>
</content>
<link rel="alternate" href="{{ $item['url'] }}" />
@if($item['content'] && strlen($item['content']))
<summary type="html">{{ $item['content'] }}</summary>
@endif
<media:content url="{{ $item['media_attachments'][0]['url'] }}" type="{{ $item['media_attachments'][0]['mime'] }}" medium="image" />
</entry>
@endforeach