feat: 后端: 在建立 SSH 连接时应用代理配置

This commit is contained in:
Baobhan Sith
2025-04-15 07:31:25 +08:00
parent 0e863456a2
commit 4f2f8b9f07
19 changed files with 1444 additions and 197 deletions
@@ -0,0 +1,24 @@
import express, { RequestHandler } from 'express'; // 引入 RequestHandler
import { isAuthenticated } from '../auth/auth.middleware';
import {
getAllProxies,
getProxyById,
createProxy,
updateProxy,
deleteProxy
} from './proxies.controller'; // 引入控制器函数
const router = express.Router();
// 应用认证中间件到所有代理路由
router.use(isAuthenticated);
// 定义代理 CRUD 路由
// 显式类型断言以解决潜在的类型不匹配问题
router.get('/', getAllProxies as RequestHandler);
router.get('/:id', getProxyById as RequestHandler);
router.post('/', createProxy as RequestHandler);
router.put('/:id', updateProxy as RequestHandler); // 类型断言
router.delete('/:id', deleteProxy as RequestHandler); // 类型断言
export default router;