socialAccount; if (! $account || ! $postPlatform->platform_post_id) { return ['unsupported' => true, 'reason' => 'missing_post_id']; } $instance = data_get($account->meta, 'instance', config('trypost.platforms.mastodon.default_instance')); // Public posts: no auth needed. Our token only requests write scopes // (read:accounts + write:statuses + write:media), so attaching the // Bearer would 403 with "outside the authorized scopes". $response = $this->socialHttp() ->get("{$instance}/api/v1/statuses/{$postPlatform->platform_post_id}"); if ($response->failed()) { Log::warning('Mastodon post metrics fetch failed', [ 'body' => $this->redactResponseBody($response->body()), ]); return ['unsupported' => true, 'reason' => 'api_error']; } $status = $response->json(); return [ ['label' => __('analytics.metrics.favourites'), 'value' => data_get($status, 'favourites_count', 0)], ['label' => __('analytics.metrics.reblogs'), 'value' => data_get($status, 'reblogs_count', 0)], ['label' => __('analytics.metrics.replies'), 'value' => data_get($status, 'replies_count', 0)], ]; } }