更新 Speed/Convoy.php

This commit is contained in:
ste87 2026-03-14 14:38:39 +08:00
parent 5ec978f4cb
commit 43659ac4ee

View File

@ -22,7 +22,11 @@ class Convoy extends Server
if (!$response->successful()) {
$json = $response->json();
$message = $json['message'] ?? $json['error'] ?? 'Server Error';
if (is_array($json)) {
$message = $json['message'] ?? $json['error'] ?? $json['errors'][0]['message'] ?? 'Server Error';
} else {
$message = 'Server Error: ' . $response->status();
}
throw new Exception($message);
}
@ -30,7 +34,7 @@ class Convoy extends Server
}
/**
* Get all the configuration for the extension
* Get all configuration for extension
*
* @param array $values
*/
@ -150,10 +154,10 @@ class Convoy extends Server
$os = $this->request('nodes/' . $node . '/template-groups');
$options = [];
foreach ($os['data'] as $os) {
foreach ($os['templates'] as $template) {
foreach ($template as $template1) {
$options[$template1['uuid']] = $template1['name'];
foreach ($os['data'] as $osGroup) {
foreach ($osGroup['templates'] as $templateGroup) {
foreach ($templateGroup as $template) {
$options[$template['uuid']] = $template['name'];
}
}
}
@ -178,7 +182,7 @@ class Convoy extends Server
}
/**
* Check if currenct configuration is valid
* Check if current configuration is valid
*/
public function testConfig(): bool|string
{
@ -193,7 +197,7 @@ class Convoy extends Server
return true;
}
// Convoy is reallyy strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)
// Convoy is really strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)
private function createPassword()
{
$password = Str::password();