mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-20 13:31:28 +00:00
Merge pull request #3499 from fedibird/fix-mastodon-api-compatibility
Fix mastodon api compatibility
This commit is contained in:
commit
21d3a0f8b6
10 changed files with 14 additions and 14 deletions
|
@ -1008,7 +1008,7 @@ class ApiV1Controller extends Controller
|
||||||
->map(function($like) {
|
->map(function($like) {
|
||||||
$status = StatusService::getMastodon($like['status_id'], false);
|
$status = StatusService::getMastodon($like['status_id'], false);
|
||||||
$status['like_id'] = $like->id;
|
$status['like_id'] = $like->id;
|
||||||
$status['liked_at'] = $like->created_at->format('c');
|
$status['liked_at'] = str_replace('+00:00', 'Z', $like->created_at->format(DATE_RFC3339_EXTENDED));
|
||||||
return $status;
|
return $status;
|
||||||
})
|
})
|
||||||
->filter(function($status) {
|
->filter(function($status) {
|
||||||
|
@ -1250,8 +1250,8 @@ class ApiV1Controller extends Controller
|
||||||
return [
|
return [
|
||||||
'uri' => config('pixelfed.domain.app'),
|
'uri' => config('pixelfed.domain.app'),
|
||||||
'title' => config('app.name'),
|
'title' => config('app.name'),
|
||||||
'short_description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
'short_description' => config_cache('app.short_description'),
|
||||||
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
'description' => config_cache('app.description'),
|
||||||
'email' => config('instance.email'),
|
'email' => config('instance.email'),
|
||||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
||||||
'urls' => [
|
'urls' => [
|
||||||
|
@ -1259,7 +1259,7 @@ class ApiV1Controller extends Controller
|
||||||
],
|
],
|
||||||
'stats' => $stats,
|
'stats' => $stats,
|
||||||
'thumbnail' => url('img/pixelfed-icon-color.png'),
|
'thumbnail' => url('img/pixelfed-icon-color.png'),
|
||||||
'languages' => ['en'],
|
'languages' => [config('app.locale')],
|
||||||
'registrations' => (bool) config_cache('pixelfed.open_registration'),
|
'registrations' => (bool) config_cache('pixelfed.open_registration'),
|
||||||
'approval_required' => false,
|
'approval_required' => false,
|
||||||
'contact_account' => $contact,
|
'contact_account' => $contact,
|
||||||
|
|
|
@ -19,7 +19,7 @@ class InstanceApiController extends Controller {
|
||||||
'acct' => $admin->username,
|
'acct' => $admin->username,
|
||||||
'display_name' => e($admin->name),
|
'display_name' => e($admin->name),
|
||||||
'locked' => (bool) $admin->is_private,
|
'locked' => (bool) $admin->is_private,
|
||||||
'created_at' => $admin->created_at->format('c'),
|
'created_at' => str_replace('+00:00', 'Z', $admin->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'note' => e($admin->bio),
|
'note' => e($admin->bio),
|
||||||
'url' => $admin->url(),
|
'url' => $admin->url(),
|
||||||
'avatar' => $admin->avatarUrl(),
|
'avatar' => $admin->avatarUrl(),
|
||||||
|
|
|
@ -326,7 +326,7 @@ class InternalApiController extends Controller
|
||||||
if(!$status) {
|
if(!$status) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$status['bookmarked_at'] = $bookmark->created_at->format('c');
|
$status['bookmarked_at'] = str_replace('+00:00', 'Z', $bookmark->created_at->format(DATE_RFC3339_EXTENDED));
|
||||||
|
|
||||||
if($status) {
|
if($status) {
|
||||||
BookmarkService::add($pid, $status['id']);
|
BookmarkService::add($pid, $status['id']);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class AdminStatsService
|
||||||
return Cache::remember('admin:dashboard:storage:stats', 120000, function() {
|
return Cache::remember('admin:dashboard:storage:stats', 120000, function() {
|
||||||
$res = [];
|
$res = [];
|
||||||
|
|
||||||
$res['last_updated'] = now()->format('c');
|
$res['last_updated'] = str_replace('+00:00', 'Z', now()->format(DATE_RFC3339_EXTENDED));
|
||||||
|
|
||||||
$avatars = Avatar::count();
|
$avatars = Avatar::count();
|
||||||
$avatarsLocal = Avatar::whereNull('cdn_url')->count();
|
$avatarsLocal = Avatar::whereNull('cdn_url')->count();
|
||||||
|
|
|
@ -20,7 +20,7 @@ class MarkerService
|
||||||
$val = [
|
$val = [
|
||||||
'last_read_id' => (string) $entityId,
|
'last_read_id' => (string) $entityId,
|
||||||
'version' => $existing ? ($existing['version'] + 1) : 1,
|
'version' => $existing ? ($existing['version'] + 1) : 1,
|
||||||
'updated_at' => now()->format('c')
|
'updated_at' => str_replace('+00:00', 'Z', now()->format(DATE_RFC3339_EXTENDED))
|
||||||
];
|
];
|
||||||
Cache::put($key, $val, 2592000);
|
Cache::put($key, $val, 2592000);
|
||||||
return $val;
|
return $val;
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PollService
|
||||||
$poll = Poll::whereStatusId($id)->firstOrFail();
|
$poll = Poll::whereStatusId($id)->firstOrFail();
|
||||||
return [
|
return [
|
||||||
'id' => (string) $poll->id,
|
'id' => (string) $poll->id,
|
||||||
'expires_at' => $poll->expires_at->format('c'),
|
'expires_at' => str_replace('+00:00', 'Z', $poll->expires_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'expired' => null,
|
'expired' => null,
|
||||||
'multiple' => $poll->multiple,
|
'multiple' => $poll->multiple,
|
||||||
'votes_count' => $poll->votes_count,
|
'votes_count' => $poll->votes_count,
|
||||||
|
|
|
@ -333,7 +333,7 @@ class Status extends Model
|
||||||
'id' => $this->permalink(),
|
'id' => $this->permalink(),
|
||||||
'type' => 'Create',
|
'type' => 'Create',
|
||||||
'actor' => $profile->permalink(),
|
'actor' => $profile->permalink(),
|
||||||
'published' => $this->created_at->format('c'),
|
'published' => str_replace('+00:00', 'Z', $this->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
'cc' => $cc,
|
'cc' => $cc,
|
||||||
'object' => [
|
'object' => [
|
||||||
|
@ -341,7 +341,7 @@ class Status extends Model
|
||||||
'type' => 'Note',
|
'type' => 'Note',
|
||||||
'summary' => null,
|
'summary' => null,
|
||||||
'inReplyTo' => null,
|
'inReplyTo' => null,
|
||||||
'published' => $this->created_at->format('c'),
|
'published' => str_replace('+00:00', 'Z', $this->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'url' => $this->url(),
|
'url' => $this->url(),
|
||||||
'attributedTo' => $this->profile->url(),
|
'attributedTo' => $this->profile->url(),
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
|
|
|
@ -16,7 +16,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
$res = [
|
$res = [
|
||||||
'id' => (string) $notification->id,
|
'id' => (string) $notification->id,
|
||||||
'type' => $this->replaceTypeVerb($notification->action),
|
'type' => $this->replaceTypeVerb($notification->action),
|
||||||
'created_at' => (string) $notification->created_at->format('c'),
|
'created_at' => (string) str_replace('+00:00', 'Z', $notification->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
];
|
];
|
||||||
|
|
||||||
$n = $notification;
|
$n = $notification;
|
||||||
|
|
|
@ -35,7 +35,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
||||||
'reblog' => null,
|
'reblog' => null,
|
||||||
'content' => $status->rendered ?? $status->caption,
|
'content' => $status->rendered ?? $status->caption,
|
||||||
'content_text' => $status->caption,
|
'content_text' => $status->caption,
|
||||||
'created_at' => $status->created_at->format('c'),
|
'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'emojis' => CustomEmoji::scan($status->caption),
|
'emojis' => CustomEmoji::scan($status->caption),
|
||||||
'reblogs_count' => $status->reblogs_count ?? 0,
|
'reblogs_count' => $status->reblogs_count ?? 0,
|
||||||
'favourites_count' => $status->likes_count ?? 0,
|
'favourites_count' => $status->likes_count ?? 0,
|
||||||
|
|
|
@ -38,7 +38,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
'reblog' => null,
|
'reblog' => null,
|
||||||
'content' => $status->rendered ?? $status->caption,
|
'content' => $status->rendered ?? $status->caption,
|
||||||
'content_text' => $status->caption,
|
'content_text' => $status->caption,
|
||||||
'created_at' => $status->created_at->format('c'),
|
'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||||
'emojis' => CustomEmoji::scan($status->caption),
|
'emojis' => CustomEmoji::scan($status->caption),
|
||||||
'reblogs_count' => 0,
|
'reblogs_count' => 0,
|
||||||
'favourites_count' => $status->likes_count ?? 0,
|
'favourites_count' => $status->likes_count ?? 0,
|
||||||
|
|
Loading…
Reference in a new issue