update: fix node status

This commit is contained in:
v2board 2023-01-04 22:52:34 +08:00
parent 908696a54d
commit 63566fbd2c
8 changed files with 7 additions and 9 deletions

View File

@ -5,9 +5,7 @@ namespace App\Http\Controllers\Client;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\ServerService; use App\Services\ServerService;
use App\Services\UserService; use App\Services\UserService;
use App\Utils\Clash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\ServerV2ray;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;

View File

@ -26,8 +26,7 @@ class ServerController extends Controller
$serverService = new ServerService(); $serverService = new ServerService();
$servers = $serverService->getAvailableServers($user); $servers = $serverService->getAvailableServers($user);
} }
$eTag = sha1(json_encode(array_column($servers, 'is_online', 'updated_at')));
$eTag = sha1(json_encode(array_column($servers, 'updated_at')));
if (strpos($request->header('If-None-Match'), $eTag) !== false ) { if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
abort(304); abort(304);
} }

View File

@ -103,6 +103,7 @@ class ServerService
array_multisort($tmp, SORT_ASC, $servers); array_multisort($tmp, SORT_ASC, $servers);
$servers = array_map(function ($server) { $servers = array_map(function ($server) {
$server['port'] = (int)$server['port']; $server['port'] = (int)$server['port'];
$server['is_online'] = (time() - 300 > $server['last_check_at']) ? 0 : 1;
return $server; return $server;
}, $servers); }, $servers);
return $servers; return $servers;

View File

@ -237,5 +237,5 @@ return [
| The only modification by laravel config | The only modification by laravel config
| |
*/ */
'version' => '1.7.2.1671471846226' 'version' => '1.7.3.1672843907081'
]; ];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long