mirror of
https://github.com/samanhappy/mcphub.git
synced 2026-01-06 22:58:11 -05:00
fix: add localnet configuration for Proxychains4 (#547)
This commit is contained in:
@@ -84,9 +84,7 @@ const generateProxychainsConfig = (
|
||||
if (fs.existsSync(proxyConfig.configPath)) {
|
||||
return proxyConfig.configPath;
|
||||
}
|
||||
console.warn(
|
||||
`[${serverName}] Custom proxychains config not found: ${proxyConfig.configPath}`,
|
||||
);
|
||||
console.warn(`[${serverName}] Custom proxychains config not found: ${proxyConfig.configPath}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -97,13 +95,19 @@ const generateProxychainsConfig = (
|
||||
}
|
||||
|
||||
const proxyType = proxyConfig.type || 'socks5';
|
||||
const proxyLine = proxyConfig.username && proxyConfig.password
|
||||
? `${proxyType} ${proxyConfig.host} ${proxyConfig.port} ${proxyConfig.username} ${proxyConfig.password}`
|
||||
: `${proxyType} ${proxyConfig.host} ${proxyConfig.port}`;
|
||||
const proxyLine =
|
||||
proxyConfig.username && proxyConfig.password
|
||||
? `${proxyType} ${proxyConfig.host} ${proxyConfig.port} ${proxyConfig.username} ${proxyConfig.password}`
|
||||
: `${proxyType} ${proxyConfig.host} ${proxyConfig.port}`;
|
||||
|
||||
const configContent = `# Proxychains4 configuration for MCP server: ${serverName}
|
||||
# Generated by MCPHub
|
||||
|
||||
localnet 127.0.0.0/255.0.0.0
|
||||
localnet 10.0.0.0/255.0.0.0
|
||||
localnet 172.16.0.0/255.240.0.0
|
||||
localnet 192.168.0.0/255.255.0.0
|
||||
|
||||
strict_chain
|
||||
proxy_dns
|
||||
remote_dns_subnet 224
|
||||
@@ -778,7 +782,7 @@ export const getServersInfo = async (
|
||||
user?: any,
|
||||
): Promise<Omit<ServerInfo, 'client' | 'transport'>[]> => {
|
||||
const dataService = getDataService();
|
||||
|
||||
|
||||
// Get paginated or all server configurations from DAO
|
||||
// If pagination is used with a non-admin user, filtering is already done at DAO level
|
||||
const isPaginated = limit !== undefined && page !== undefined;
|
||||
@@ -824,9 +828,10 @@ export const getServersInfo = async (
|
||||
// Apply user filtering only when NOT using pagination (pagination already filtered at DAO level)
|
||||
// Or when no pagination parameters provided (backward compatibility)
|
||||
const shouldApplyUserFilter = !isPaginated;
|
||||
const filterServerInfos: ServerInfo[] = shouldApplyUserFilter && dataService.filterData
|
||||
? dataService.filterData(filteredServerInfos, user)
|
||||
: filteredServerInfos;
|
||||
const filterServerInfos: ServerInfo[] =
|
||||
shouldApplyUserFilter && dataService.filterData
|
||||
? dataService.filterData(filteredServerInfos, user)
|
||||
: filteredServerInfos;
|
||||
|
||||
const infos = filterServerInfos
|
||||
.filter((info) => requestedServerNames.has(info.name)) // Only include requested servers
|
||||
|
||||
Reference in New Issue
Block a user