update: uniproxy

This commit is contained in:
tokumeikoi 2022-11-29 14:33:08 +08:00
parent 40e6400b9b
commit f781f22cde
2 changed files with 4 additions and 2 deletions

View File

@ -112,7 +112,9 @@ class UniProxyController extends Controller
'push_interval' => config('v2board.server_push_interval', 60),
'pull_interval' => config('v2board.server_pull_interval', 60)
];
$response['routes'] = $this->serverService->getRoutes($this->nodeInfo['route_id']);
if ($this->nodeInfo['route_id']) {
$response['routes'] = $this->serverService->getRoutes($this->nodeInfo['route_id']);
}
$eTag = sha1(json_encode($response));
if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
abort(304);

View File

@ -218,7 +218,7 @@ class ServerService
return $servers;
}
public function getRoutes($routeIds)
public function getRoutes(array $routeIds)
{
return ServerRoute::select(['id', 'match', 'action', 'action_value'])->whereIn('id', $routeIds)->get();
}