mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-03 10:30:51 +08:00
- Implement Workerman-based `xboard:ws-server` for real-time node synchronization. - Support custom routes, outbounds, and certificate configurations via JSON. - Optimize scheduled tasks with `lazyById` to minimize memory footprint. - Enhance reactivity using Observers for `Plan`, `Server`, and `ServerRoute`. - Expand protocol support for `httpupgrade`, `h2`, and `mieru`.
38 lines
841 B
PHP
38 lines
841 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\Server;
|
|
use App\Services\NodeSyncService;
|
|
|
|
class ServerObserver
|
|
{
|
|
public function updated(Server $server): void
|
|
{
|
|
if (
|
|
$server->isDirty([
|
|
'group_ids',
|
|
])
|
|
) {
|
|
NodeSyncService::notifyUsersUpdatedByGroup($server->id);
|
|
} else if (
|
|
$server->isDirty([
|
|
'server_port',
|
|
'protocol_settings',
|
|
'type',
|
|
'route_ids',
|
|
'custom_outbounds',
|
|
'custom_routes',
|
|
'cert_config',
|
|
])
|
|
) {
|
|
NodeSyncService::notifyConfigUpdated($server->id);
|
|
}
|
|
}
|
|
|
|
public function deleted(Server $server): void
|
|
{
|
|
NodeSyncService::notifyConfigUpdated($server->id);
|
|
}
|
|
}
|