feat(NetworkConfig): add network configuration routes and validation; integrate into server and frontend for managing IP, interfaces, and gateways
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:
@@ -393,6 +393,30 @@ const simpleFiltersRoutes = createJsonDataRoutes('filter-manager/simple-filters.
|
||||
app.get('/api/simple-filters', simpleFiltersRoutes.get);
|
||||
app.post('/api/simple-filters', simpleFiltersRoutes.post);
|
||||
|
||||
// Network Config (справочник IP, интерфейсов и gateway)
|
||||
const networkConfigRoutes = createJsonDataRoutes('network-config.json', (config) => {
|
||||
// Валидация структуры конфига
|
||||
if (typeof config !== 'object' || config === null) {
|
||||
return 'Network config must be an object';
|
||||
}
|
||||
// Валидация gateways
|
||||
if (config.gateways && !Array.isArray(config.gateways)) {
|
||||
return 'gateways must be an array';
|
||||
}
|
||||
// Валидация tunnelInterfaces
|
||||
if (config.tunnelInterfaces && !Array.isArray(config.tunnelInterfaces)) {
|
||||
return 'tunnelInterfaces must be an array';
|
||||
}
|
||||
// Валидация ipPools
|
||||
if (config.ipPools && !Array.isArray(config.ipPools)) {
|
||||
return 'ipPools must be an array';
|
||||
}
|
||||
return null;
|
||||
}, { singleObject: true });
|
||||
|
||||
app.get('/api/network-config', networkConfigRoutes.get);
|
||||
app.post('/api/network-config', networkConfigRoutes.post);
|
||||
|
||||
// === COMMUNITIES ROUTES ===
|
||||
app.get('/api/communities', communitiesRoutes.getCommunities);
|
||||
app.post('/api/communities', writeLimiter, communitiesRoutes.postCommunities);
|
||||
|
||||
Reference in New Issue
Block a user