feat: Introduce server type management in ServerManager, enhancing server configuration with type selection and validation, and update example-servers.json to include server types for improved data consistency.
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m27s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m27s
This commit is contained in:
+10
-1
@@ -295,10 +295,19 @@ app.post('/api/ip-ranges', writeLimiter, ipRangesRoutes.post);
|
||||
// === JSON DATA ROUTES (используют фабрики) ===
|
||||
|
||||
// Servers
|
||||
const SERVER_TYPES = ['jumphost', 'exit'];
|
||||
const serversRoutes = createJsonDataRoutes('servers.json', (server, i) => {
|
||||
if (!server.ip || !server.dns || !server.country || !server.provider || !server.tunnel) {
|
||||
if (!server.ip || !server.dns || !server.country || !server.provider || !server.tunnel) {
|
||||
return `Server at index ${i} is missing required fields`;
|
||||
}
|
||||
|
||||
const normalizedType = String(server.type || '').toLowerCase();
|
||||
if (!SERVER_TYPES.includes(normalizedType)) {
|
||||
return `Server at index ${i} has invalid type (allowed: ${SERVER_TYPES.join(', ')})`;
|
||||
}
|
||||
|
||||
// Нормализуем тип, чтобы в S3 всегда лежали одинаковые значения
|
||||
server.type = normalizedType;
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user