Resolve Bluesky endpoints from config and import Throwable

Use the existing config('trypost.platforms.bluesky.public_appview') and
default_service keys for the handle-resolution fallbacks instead of hardcoding
the hosts, so a self-hosted override (BLUESKY_PUBLIC_APPVIEW) is honored here
like it already is in BlueskyAnalytics. Import Throwable instead of referencing
it inline.
This commit is contained in:
Paulo Castellano 2026-06-13 18:15:31 -03:00
parent 2641cc66fe
commit 5cafac34c1

View file

@ -13,6 +13,7 @@
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Throwable;
class BlueskyPublisher
{
@ -284,8 +285,8 @@ private function resolveHandleToDid(string $handle, ?string $service = null, ?So
$endpoints = array_values(array_unique(array_filter([
$service,
'https://public.api.bsky.app',
'https://bsky.social',
config('trypost.platforms.bluesky.public_appview'),
config('trypost.platforms.bluesky.default_service'),
])));
$lastError = null;
@ -306,7 +307,7 @@ private function resolveHandleToDid(string $handle, ?string $service = null, ?So
if (is_string($did) && str_starts_with($did, 'did:')) {
return $did;
}
} catch (\Throwable $e) {
} catch (Throwable $e) {
// Per-endpoint failures are expected during transient outages;
// keep them at debug to avoid noisy logs and surface a single
// warning below only when every endpoint has been exhausted.