更新 Speed/Convoy.php

This commit is contained in:
ste87 2026-03-14 15:19:55 +08:00
parent 0ca7c9edab
commit bc5511fe52

View File

@ -13,7 +13,7 @@ class Convoy extends Server
{
public function request($url, $method = 'get', $data = []): array
{
// Trim any leading slashes from the base url and add the path URL to it
// Trim any leading slashes from the base url and add the path url to it
$req_url = rtrim($this->config('host'), '/') . '/api/application/' . $url;
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . $this->config('api_key'),
@ -22,11 +22,7 @@ class Convoy extends Server
if (!$response->successful()) {
$json = $response->json();
if (is_array($json)) {
$message = $json['message'] ?? $json['error'] ?? $json['errors'][0]['message'] ?? 'Server Error';
} else {
$message = 'Server Error: ' . $response->status();
}
$message = $json['message'] ?? $json['error'] ?? 'Server Error';
throw new Exception($message);
}
@ -193,8 +189,6 @@ class Convoy extends Server
} catch (Exception $e) {
return $e->getMessage();
}
return true;
}
// Convoy is really strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)