another attempt

This commit is contained in:
Bojan Kucera 2025-06-06 22:37:18 -04:00
parent 117ff56d1e
commit a984733b9b
3 changed files with 25 additions and 4 deletions

View file

@ -240,7 +240,11 @@ export class ProxyService {
for (const proxy of proxies) {
const key = this.getProxyKey(proxy);
const data: ProxyData = {
...proxy,
protocol: proxy.protocol,
host: proxy.host,
port: proxy.port,
username: proxy.username,
password: proxy.password,
addedAt: new Date(),
lastChecked: null,
isWorking: null,

View file

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": [
"src/**/*"
],
"exclude": [
"dist",
"node_modules",
"**/*.test.ts",
"**/*.spec.ts"
],
}

View file

@ -95,9 +95,9 @@ export function validateProxyConfig(config: unknown): ProxyConfig {
const proxy = config as Record<string, unknown>;
// Validate type
if (!proxy.type || !['http', 'https', 'socks4', 'socks5'].includes(proxy.type as string)) {
throw new Error('Proxy type must be one of: http, https, socks4, socks5');
// Validate protocol
if (!proxy.protocol || !['http', 'https', 'socks4', 'socks5'].includes(proxy.protocol as string)) {
throw new Error('Proxy protocol must be one of: http, https, socks4, socks5');
}
// Validate host