diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php
index ea119d077..aaba0cc4d 100644
--- a/app/Http/Controllers/FederationController.php
+++ b/app/Http/Controllers/FederationController.php
@@ -167,7 +167,7 @@ XML;
public function userInbox(Request $request, $username)
{
- // todo
+ return;
}
public function userFollowing(Request $request, $username)
@@ -175,7 +175,10 @@ XML;
if (config('pixelfed.activitypub_enabled') == false) {
abort(403);
}
- $profile = Profile::whereNull('remote_url')->whereUsername($username)->firstOrFail();
+ $profile = Profile::whereNull('remote_url')
+ ->whereUsername($username)
+ ->whereIsPrivate(false)
+ ->firstOrFail();
$obj = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $request->getUri(),
@@ -193,7 +196,10 @@ XML;
if (config('pixelfed.activitypub_enabled') == false) {
abort(403);
}
- $profile = Profile::whereNull('remote_url')->whereUsername($username)->firstOrFail();
+ $profile = Profile::whereNull('remote_url')
+ ->whereUsername($username)
+ ->whereIsPrivate(false)
+ ->firstOrFail();
$obj = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $request->getUri(),
diff --git a/app/Media.php b/app/Media.php
index 131f70a06..fd507e7f1 100644
--- a/app/Media.php
+++ b/app/Media.php
@@ -46,7 +46,12 @@ class Media extends Model
{
$verb = 'Image';
switch ($this->mimeType()) {
+ case 'audio':
+ $verb = 'Audio';
+ break;
+
case 'image':
+ $verb = 'Image';
break;
case 'video':
diff --git a/app/Status.php b/app/Status.php
index de87c06d0..4769a733b 100644
--- a/app/Status.php
+++ b/app/Status.php
@@ -22,6 +22,7 @@ class Status extends Model
protected $fillable = ['profile_id', 'visibility', 'in_reply_to_id', 'reblog_of_id'];
const STATUS_TYPES = [
+ 'text',
'photo',
'photo:album',
'video',
diff --git a/app/Transformer/ActivityPub/ProfileOutbox.php b/app/Transformer/ActivityPub/ProfileOutbox.php
index 00e69de95..bd82d9b16 100644
--- a/app/Transformer/ActivityPub/ProfileOutbox.php
+++ b/app/Transformer/ActivityPub/ProfileOutbox.php
@@ -4,74 +4,33 @@ namespace App\Transformer\ActivityPub;
use App\Profile;
use League\Fractal;
+use App\Transformer\ActivityPub\Verb\CreateNote;
class ProfileOutbox extends Fractal\TransformerAbstract
{
+ protected $defaultIncludes = ['orderedItems'];
+
public function transform(Profile $profile)
{
- $count = $profile->statuses()->count();
- $statuses = $profile->statuses()->has('media')->orderBy('id', 'desc')->take(20)->get()->map(function ($i, $k) {
- $item = [
- 'id' => $i->permalink(),
- // TODO: handle other types
- 'type' => 'Create',
- 'actor' => $i->profile->url(),
- 'published' => $i->created_at->toISO8601String(),
- 'to' => [
- 'https://www.w3.org/ns/activitystreams#Public',
- ],
- 'cc' => [
- $i->profile->permalink('/followers'),
- ],
- 'object' => [
- 'id' => $i->url(),
-
- // TODO: handle other types
- 'type' => 'Note',
-
- // XXX: CW Title
- 'summary' => null,
- 'content' => $i->rendered ?? $i->caption,
- 'inReplyTo' => null,
-
- // TODO: fix date format
- 'published' => $i->created_at->toAtomString(),
- 'url' => $i->url(),
- 'attributedTo' => $i->profile->permalink(),
- 'to' => [
- // TODO: handle proper scope
- 'https://www.w3.org/ns/activitystreams#Public',
- ],
- 'cc' => [
- // TODO: add cc's
- //"{$notice->getProfile()->getUrl()}/subscribers",
- ],
- 'sensitive' => (bool) $i->is_nsfw,
- 'atomUri' => $i->url(),
- 'inReplyToAtomUri' => null,
- 'attachment' => [
-
- // TODO: support more than 1 attachment
- [
- 'type' => 'Document',
- 'mediaType' => $i->firstMedia()->mime,
- 'url' => $i->firstMedia()->url(),
- 'name' => null,
- ],
- ],
- 'tag' => [],
- ],
- ];
-
- return $item;
- });
+ $count = $profile->statuses()->whereHas('media')->count();
return [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $profile->permalink('/outbox'),
'type' => 'OrderedCollection',
'totalItems' => $count,
- 'orderedItems' => $statuses,
];
}
+
+ public function includeOrderedItems(Profile $profile)
+ {
+ $statuses = $profile
+ ->statuses()
+ ->with('media')
+ ->whereVisibility('public')
+ ->orderBy('created_at', 'desc')
+ ->paginate(10);
+
+ return $this->collection($statuses, new CreateNote);
+ }
}
diff --git a/app/Transformer/ActivityPub/ProfileTransformer.php b/app/Transformer/ActivityPub/ProfileTransformer.php
index d270e8c18..97617bdf0 100644
--- a/app/Transformer/ActivityPub/ProfileTransformer.php
+++ b/app/Transformer/ActivityPub/ProfileTransformer.php
@@ -15,9 +15,6 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'https://w3id.org/security/v1',
[
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
- 'featured' => [
- 'https://pixelfed.org/ns#featured' => ['@type' => '@id'],
- ],
],
],
'id' => $profile->permalink(),
@@ -26,7 +23,7 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'followers' => $profile->permalink('/followers'),
'inbox' => $profile->permalink('/inbox'),
'outbox' => $profile->permalink('/outbox'),
- 'featured' => $profile->permalink('/collections/featured'),
+ //'featured' => $profile->permalink('/collections/featured'),
'preferredUsername' => $profile->username,
'name' => $profile->name,
'summary' => $profile->bio,
diff --git a/app/Transformer/ActivityPub/Verb/CreateNote.php b/app/Transformer/ActivityPub/Verb/CreateNote.php
index b8d3a9a17..49aed880a 100644
--- a/app/Transformer/ActivityPub/Verb/CreateNote.php
+++ b/app/Transformer/ActivityPub/Verb/CreateNote.php
@@ -30,12 +30,6 @@ class CreateNote extends Fractal\TransformerAbstract
'@context' => [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
- [
- 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
- 'featured' => [
- 'https://pixelfed.org/ns#featured' => ['@type' => '@id'],
- ],
- ],
],
'id' => $status->permalink(),
'type' => 'Create',
@@ -57,7 +51,7 @@ class CreateNote extends Fractal\TransformerAbstract
'sensitive' => (bool) $status->is_nsfw,
'attachment' => $status->media->map(function ($media) {
return [
- 'type' => 'Document',
+ 'type' => $media->activityVerb(),
'mediaType' => $media->mime,
'url' => $media->url(),
'name' => null,
diff --git a/config/pixelfed.php b/config/pixelfed.php
index f5167a088..51e20bf4f 100644
--- a/config/pixelfed.php
+++ b/config/pixelfed.php
@@ -23,7 +23,7 @@ return [
| This value is the version of your PixelFed instance.
|
*/
- 'version' => '0.5.4',
+ 'version' => '0.5.5',
/*
|--------------------------------------------------------------------------
diff --git a/resources/assets/js/components/PostComments.vue b/resources/assets/js/components/PostComments.vue
index 5ac700c1e..cc57ad699 100644
--- a/resources/assets/js/components/PostComments.vue
+++ b/resources/assets/js/components/PostComments.vue
@@ -3,7 +3,6 @@
font-size: 14px;
}
.comment-text {
- word-break: break-all;
}
.comment-text p {
display: inline;
@@ -33,7 +32,7 @@
{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}
(click to show)
- +