Skip to content
Merged

Sync #189

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\Admin;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Node;
use App\Chat\Server;
Expand Down Expand Up @@ -167,7 +168,8 @@ public function scanServer(Request $request): Response
$node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

// Create configuration
Expand Down Expand Up @@ -309,7 +311,8 @@ public function scanBatch(Request $request): Response
$node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

// Create scanner
Expand Down
4 changes: 3 additions & 1 deletion backend/app/Controllers/Admin/NodeStatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\Admin;

use App\Helpers\WingsUrlHelper;
use App\Chat\Node;
use App\Helpers\ApiResponse;
use App\Services\Wings\Wings;
Expand Down Expand Up @@ -100,7 +101,8 @@ public function getGlobalStatus(Request $request): Response
$node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
10 // Short timeout for status checks
10, // Short timeout for status checks
WingsUrlHelper::isBehindProxy($node)
);

$utilization = $wings->getSystem()->getSystemUtilization();
Expand Down
25 changes: 17 additions & 8 deletions backend/app/Controllers/Admin/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\Admin;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Node;
use App\Cache\Cache;
Expand Down Expand Up @@ -754,7 +755,8 @@ public function diagnostics(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

$diagnostics = $wings->getSystem()->getDiagnostics(
Expand Down Expand Up @@ -899,7 +901,8 @@ public function triggerSelfUpdate(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

$response = $wings->getSystem()->triggerSelfUpdate($cleanPayload, true);
Expand Down Expand Up @@ -1140,7 +1143,8 @@ public function executeTerminalCommand(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
($timeoutSeconds ?? 60) + 10 // Add 10s buffer for HTTP timeout
($timeoutSeconds ?? 60) + 10, // Add 10s buffer for HTTP timeout
WingsUrlHelper::isBehindProxy($node)
);

$result = $wings->getSystem()->executeCommand(
Expand Down Expand Up @@ -1231,7 +1235,8 @@ public function getConfig(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

$config = $wings->getConfig()->getConfig();
Expand Down Expand Up @@ -1313,7 +1318,8 @@ public function putConfig(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

// Wings API expects 'content' field, not 'config'
Expand Down Expand Up @@ -1433,7 +1439,8 @@ public function patchConfig(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

// Wings API expects 'updates' field in patchConfig, but we accept 'values' from frontend
Expand Down Expand Up @@ -1499,7 +1506,8 @@ public function getConfigSchema(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);

$schema = $wings->getConfig()->getConfigSchema();
Expand Down Expand Up @@ -1561,7 +1569,8 @@ public function getVersionStatus(Request $request, int $id): Response
(int) $node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
10 // Short timeout for version check
10, // Short timeout for version check
WingsUrlHelper::isBehindProxy($node)
);

// Get current Wings version
Expand Down
25 changes: 17 additions & 8 deletions backend/app/Controllers/Admin/ServersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\Admin;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Node;
use App\Chat\User;
Expand Down Expand Up @@ -1180,7 +1181,8 @@ public function create(Request $request): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($nodeInfo)
);

$wingsData = [
Expand Down Expand Up @@ -1764,7 +1766,8 @@ public function update(Request $request, int $id): Response
$nodeInfo['daemonListen'],
$nodeInfo['scheme'],
$nodeInfo['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($nodeInfo)
);

// Deauthorize old owner from Wings
Expand Down Expand Up @@ -1904,7 +1907,8 @@ public function update(Request $request, int $id): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($nodeInfo)
);

// If spell changed, trigger reinstall instead of just sync
Expand Down Expand Up @@ -2057,7 +2061,8 @@ public function delete(Request $request, int $id): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($nodeInfo)
);

$response = $wings->getServer()->deleteServer($server['uuid']);
Expand Down Expand Up @@ -2572,7 +2577,8 @@ public function suspend(Request $request, int $id): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($nodeInfo)
);

$response = $wings->getServer()->killServer($server['uuid']);
Expand Down Expand Up @@ -2916,7 +2922,8 @@ public function cancelTransfer(Request $request, int $id): Response
$sourceNode['daemonListen'],
$sourceNode['scheme'],
$sourceNode['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($sourceNode)
);
$wingsSource->getTransfer()->cancelTransfer($server['uuid']);
$logger->info('Cancelled transfer on source node for server ' . $server['uuid']);
Expand All @@ -2933,7 +2940,8 @@ public function cancelTransfer(Request $request, int $id): Response
$destinationNode['daemonListen'],
$destinationNode['scheme'],
$destinationNode['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($destinationNode)
);
// Destination node uses DELETE /api/transfer with server UUID in body
$wingsDest->getServer()->deleteServer($server['uuid']);
Expand Down Expand Up @@ -3018,7 +3026,8 @@ private function syncServerConfiguration(array $server): ?Response
$node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($node)
);
$response = $wings->getServer()->syncServer($server['uuid']);
if (!$response->isSuccessful()) {
Expand Down
4 changes: 3 additions & 1 deletion backend/app/Controllers/User/NodeStatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\User;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Node;
use App\Chat\Server;
Expand Down Expand Up @@ -149,7 +150,8 @@ public function getStatus(Request $request): Response
$node['daemonListen'],
$node['scheme'],
$node['daemon_token'],
10 // Short timeout for status checks
10, // Short timeout for status checks
WingsUrlHelper::isBehindProxy($node)
);

$utilization = $wings->getSystem()->getSystemUtilization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\User\Server\Logs;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Server;
use App\Helpers\LogHelper;
Expand Down Expand Up @@ -117,7 +118,8 @@ public function getLogs(Request $request, string $uuidShort): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

$response = $wings->getServer()->getServerLogs($server['uuid']);
Expand Down Expand Up @@ -215,7 +217,8 @@ public function getInstallLogs(Request $request, string $uuidShort): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

$response = $wings->getServer()->getServerInstallLogs($server['uuid']);
Expand Down Expand Up @@ -318,7 +321,8 @@ public function uploadLogs(Request $request, string $uuidShort): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

$response = $wings->getServer()->getServerLogs($server['uuid']);
Expand Down Expand Up @@ -450,7 +454,8 @@ public function uploadInstallLogs(Request $request, string $uuidShort): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

$response = $wings->getServer()->getServerInstallLogs($server['uuid']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\User\Server\Power;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Server;
use App\SubuserPermissions;
Expand Down Expand Up @@ -153,7 +154,8 @@ public function sendPowerAction(Request $request, string $uuidShort, string $act
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

if ($action === 'start') {
Expand Down
12 changes: 8 additions & 4 deletions backend/app/Controllers/User/Server/ServerBackupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ public function createBackup(Request $request, string $serverUuid): Response
(int) $nodeForEvict['daemonListen'],
$nodeForEvict['scheme'],
$nodeForEvict['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($nodeForEvict)
);
} catch (\Throwable $e) {
App::getInstance(true)->getLogger()->error('FIFO backup eviction: Wings client error: ' . $e->getMessage());
Expand Down Expand Up @@ -404,7 +405,8 @@ public function createBackup(Request $request, string $serverUuid): Response
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

// Initiate backup on Wings
Expand Down Expand Up @@ -575,7 +577,8 @@ public function restoreBackup(Request $request, string $serverUuid, string $back
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

// Initiate restore on Wings
Expand Down Expand Up @@ -926,7 +929,8 @@ public function deleteBackup(Request $request, string $serverUuid, string $backu
$port,
$scheme,
$token,
$timeout
$timeout,
WingsUrlHelper::isBehindProxy($node)
);

// Delete backup on Wings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Controllers\Wings\Transfer;

use App\Helpers\WingsUrlHelper;
use App\App;
use App\Chat\Node;
use App\Chat\Backup;
Expand Down Expand Up @@ -411,7 +412,8 @@ private function deleteServerFromOldNode(array $server, array $transfer, $logger
$oldNode['daemonListen'],
$oldNode['scheme'],
$oldNode['daemon_token'],
30
30,
WingsUrlHelper::isBehindProxy($oldNode)
);

// Delete the server from the old node
Expand Down
Loading
Loading