From 52d2f603afc7bd7cf3c8162cb944ea19d4c6fd04 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 12 Jun 2019 13:21:41 -0600 Subject: [PATCH] Update AP Helpers --- app/Util/ActivityPub/Helpers.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index 03e4cfdcd..28c370734 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -55,8 +55,8 @@ class Helpers { $activity = $data['object']; - $mediaTypes = ['Document', 'Image', 'Video']; - $mimeTypes = ['image/jpeg', 'image/png', 'video/mp4']; + $mimeTypes = explode(',', config('pixelfed.media_types')); + $mediaTypes = in_array('video/mp4', $mimeTypes) ? ['Document', 'Image', 'Video'] : ['Document', 'Image']; if(!isset($activity['attachment']) || empty($activity['attachment'])) { return false; @@ -249,7 +249,6 @@ class Helpers { } if(isset($res['cc']) == true) { - $scope = 'unlisted'; if(is_array($res['cc']) && in_array('https://www.w3.org/ns/activitystreams#Public', $res['cc'])) { $scope = 'unlisted'; } @@ -339,6 +338,7 @@ class Helpers { $userHash = hash('sha1', $user->id.(string) $user->created_at); $storagePath = "public/m/{$monthHash}/{$userHash}"; $allowed = explode(',', config('pixelfed.media_types')); + foreach($attachments as $media) { $type = $media['mediaType']; $url = $media['url']; @@ -370,6 +370,8 @@ class Helpers { ImageOptimize::dispatch($media); unlink($file); } + + $status->viewType(); return; }