mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 08:09:10 +08:00
update: fix node etag
This commit is contained in:
parent
63566fbd2c
commit
0c935c5e3e
@ -26,7 +26,7 @@ class ServerController extends Controller
|
||||
$serverService = new ServerService();
|
||||
$servers = $serverService->getAvailableServers($user);
|
||||
}
|
||||
$eTag = sha1(json_encode(array_column($servers, 'is_online', 'updated_at')));
|
||||
$eTag = sha1(json_encode(array_column($servers, 'cache_key')));
|
||||
if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
|
||||
abort(304);
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ class ServerService
|
||||
$servers = array_map(function ($server) {
|
||||
$server['port'] = (int)$server['port'];
|
||||
$server['is_online'] = (time() - 300 > $server['last_check_at']) ? 0 : 1;
|
||||
$server['cache_key'] = "{$server['type']}-{$server['id']}-{$server['updated_at']}-{$server['is_online']}";
|
||||
return $server;
|
||||
}, $servers);
|
||||
return $servers;
|
||||
|
Loading…
Reference in New Issue
Block a user