mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-23 19:37:35 +08:00
feat: introduce WebSocket sync for XBoard nodes
- 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`.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user