refactor: 消除前端52处any类型+删除冗余requirements.txt+调试print改日志

- 删除 requirements.txt,pyproject.toml 为唯一依赖源(含 requests[socks] extra)
- core/geetest 下 5 处 print() 替换为 loguru logger.debug()
- api/modules.ts 新增 13 个响应接口,消除所有 api.xxx<any, any>
- 新建 utils/error.ts 提供 getErrorMessage(e: unknown) 安全取消息
- 11 个页面组件 catch (e: any) 改为 catch (e: unknown)
- useState<any[]>、columns: any[]、render 参数全部类型化
- TypeScript 类型检查零错误通过
This commit is contained in:
yml2213
2026-06-23 07:14:08 +08:00
parent 453a637480
commit 12c31c2e09
16 changed files with 305 additions and 189 deletions
+11 -10
View File
@@ -1,6 +1,7 @@
import { useEffect, useState, useRef } from 'react';
import { Form, Input, Switch, Button, Card, message, Row, Col, theme } from 'antd';
import { proxyApi } from '../api/modules';
import { proxyApi, type ProxyConfig } from '../api/modules';
import { getErrorMessage } from '../utils/error';
const WS_BASE = `${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${window.location.host}`;
@@ -26,8 +27,8 @@ export default function ProxyPage() {
whitelist_uid: data.whitelist_uid ?? '',
whitelist_ukey: data.whitelist_ukey ?? '',
});
} catch (e: any) {
message.error(e.message);
} catch (e: unknown) {
message.error(getErrorMessage(e));
} finally {
setConfigLoaded(true);
}
@@ -66,10 +67,10 @@ export default function ProxyPage() {
setLoading(true);
try {
const values = await form.validateFields();
await proxyApi.update(values);
await proxyApi.update(values as ProxyConfig);
message.success('已保存');
} catch (e: any) {
message.error(e.message);
} catch (e: unknown) {
message.error(getErrorMessage(e));
} finally {
setLoading(false);
}
@@ -81,8 +82,8 @@ export default function ProxyPage() {
try {
const result = await proxyApi.test();
if (result.test_id) connectWs(result.test_id);
} catch (e: any) {
message.error(e.message);
} catch (e: unknown) {
message.error(getErrorMessage(e));
setTesting(false);
}
};
@@ -93,8 +94,8 @@ export default function ProxyPage() {
try {
const result = await proxyApi.testWhitelist();
if (result.test_id) connectWs(result.test_id);
} catch (e: any) {
message.error(e.message);
} catch (e: unknown) {
message.error(getErrorMessage(e));
setTestingWl(false);
}
};