1
0
Fork 0
This commit is contained in:
Daniel Supernault 2024-06-11 22:57:52 -06:00
parent a75b89b239
commit 25d41901ec
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1
1 changed files with 8 additions and 8 deletions

View File

@ -38,13 +38,12 @@ class StatusController extends Controller
$status = StatusService::get($id, false); $status = StatusService::get($id, false);
abort_if( abort_if(
!$status || ! $status ||
!isset($status['account'], $status['account']['username']) || ! isset($status['account'], $status['account']['username']) ||
$status['account']['username'] != $username || $status['account']['username'] != $username ||
isset($status['reblog']) isset($status['reblog']), 404);
, 404);
abort_if($status['visibility'] != 'public' && !$request->user(), 403, 'Invalid permission'); abort_if($status['visibility'] != 'public' && ! $request->user(), 403, 'Invalid permission');
if ($request->wantsJson() && (bool) config_cache('federation.activitypub.enabled')) { if ($request->wantsJson() && (bool) config_cache('federation.activitypub.enabled')) {
return $this->showActivityPub($request, $status); return $this->showActivityPub($request, $status);
@ -172,7 +171,7 @@ class StatusController extends Controller
intval($status['account']['id']) !== intval($profile['id']) || intval($status['account']['id']) !== intval($profile['id']) ||
$status['sensitive'] || $status['sensitive'] ||
$status['visibility'] !== 'public' || $status['visibility'] !== 'public' ||
!in_array($status['pf_type'], ['photo', 'photo:album']) ! in_array($status['pf_type'], ['photo', 'photo:album'])
) { ) {
$content = view('status.embed-removed'); $content = view('status.embed-removed');
@ -349,8 +348,9 @@ class StatusController extends Controller
public function showActivityPub(Request $request, $status) public function showActivityPub(Request $request, $status)
{ {
$key = 'pf:status:ap:v1:sid:' . $status['id']; $key = 'pf:status:ap:v1:sid:'.$status['id'];
return Cache::remember($key, 3600, function() use($status) {
return Cache::remember($key, 3600, function () use ($status) {
$status = Status::findOrFail($status['id']); $status = Status::findOrFail($status['id']);
$object = $status->type == 'poll' ? new Question() : new Note(); $object = $status->type == 'poll' ? new Question() : new Note();
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager();