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) {
|
||||
$status = StatusService::getMastodon($like['status_id'], false);
|
||||
$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;
|
||||
})
|
||||
->filter(function($status) {
|
||||
|
@ -1250,8 +1250,8 @@ class ApiV1Controller extends Controller
|
|||
return [
|
||||
'uri' => config('pixelfed.domain.app'),
|
||||
'title' => config('app.name'),
|
||||
'short_description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||
'short_description' => config_cache('app.short_description'),
|
||||
'description' => config_cache('app.description'),
|
||||
'email' => config('instance.email'),
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
||||
'urls' => [
|
||||
|
@ -1259,7 +1259,7 @@ class ApiV1Controller extends Controller
|
|||
],
|
||||
'stats' => $stats,
|
||||
'thumbnail' => url('img/pixelfed-icon-color.png'),
|
||||
'languages' => ['en'],
|
||||
'languages' => [config('app.locale')],
|
||||
'registrations' => (bool) config_cache('pixelfed.open_registration'),
|
||||
'approval_required' => false,
|
||||
'contact_account' => $contact,
|
||||
|
|
|
@ -19,7 +19,7 @@ class InstanceApiController extends Controller {
|
|||
'acct' => $admin->username,
|
||||
'display_name' => e($admin->name),
|
||||
'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),
|
||||
'url' => $admin->url(),
|
||||
'avatar' => $admin->avatarUrl(),
|
||||
|
|
|
@ -326,7 +326,7 @@ class InternalApiController extends Controller
|
|||
if(!$status) {
|
||||
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) {
|
||||
BookmarkService::add($pid, $status['id']);
|
||||
|
|
|
@ -37,7 +37,7 @@ class AdminStatsService
|
|||
return Cache::remember('admin:dashboard:storage:stats', 120000, function() {
|
||||
$res = [];
|
||||
|
||||
$res['last_updated'] = now()->format('c');
|
||||
$res['last_updated'] = str_replace('+00:00', 'Z', now()->format(DATE_RFC3339_EXTENDED));
|
||||
|
||||
$avatars = Avatar::count();
|
||||
$avatarsLocal = Avatar::whereNull('cdn_url')->count();
|
||||
|
|
|
@ -20,7 +20,7 @@ class MarkerService
|
|||
$val = [
|
||||
'last_read_id' => (string) $entityId,
|
||||
'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);
|
||||
return $val;
|
||||
|
|
|
@ -19,7 +19,7 @@ class PollService
|
|||
$poll = Poll::whereStatusId($id)->firstOrFail();
|
||||
return [
|
||||
'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,
|
||||
'multiple' => $poll->multiple,
|
||||
'votes_count' => $poll->votes_count,
|
||||
|
|
|
@ -333,7 +333,7 @@ class Status extends Model
|
|||
'id' => $this->permalink(),
|
||||
'type' => 'Create',
|
||||
'actor' => $profile->permalink(),
|
||||
'published' => $this->created_at->format('c'),
|
||||
'published' => str_replace('+00:00', 'Z', $this->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||
'to' => $to,
|
||||
'cc' => $cc,
|
||||
'object' => [
|
||||
|
@ -341,7 +341,7 @@ class Status extends Model
|
|||
'type' => 'Note',
|
||||
'summary' => 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(),
|
||||
'attributedTo' => $this->profile->url(),
|
||||
'to' => $to,
|
||||
|
|
|
@ -16,7 +16,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
|||
$res = [
|
||||
'id' => (string) $notification->id,
|
||||
'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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
|||
'reblog' => null,
|
||||
'content' => $status->rendered ?? $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),
|
||||
'reblogs_count' => $status->reblogs_count ?? 0,
|
||||
'favourites_count' => $status->likes_count ?? 0,
|
||||
|
|
|
@ -38,7 +38,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'reblog' => null,
|
||||
'content' => $status->rendered ?? $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),
|
||||
'reblogs_count' => 0,
|
||||
'favourites_count' => $status->likes_count ?? 0,
|
||||
|
|
Loading…
Reference in a new issue