holyterra commited on
Commit
25c8591
·
verified ·
1 Parent(s): f30f29d

Upload unified-server.js

Browse files
Files changed (1) hide show
  1. unified-server.js +8 -4
unified-server.js CHANGED
@@ -1175,9 +1175,7 @@ class ProxyServerSystem extends EventEmitter {
1175
  });
1176
  }
1177
 
1178
- // [可复制并覆盖]
1179
- // 请用此版本完整替换您文件中的 _createExpressApp 方法
1180
- _createExpressApp() {
1181
  const app = express();
1182
  app.use(express.json({ limit: '100mb' }));
1183
  app.use(express.raw({ type: '*/*', limit: '100mb' }));
@@ -1201,6 +1199,11 @@ class ProxyServerSystem extends EventEmitter {
1201
 
1202
  // --- 仪表盘和API端点 ---
1203
 
 
 
 
 
 
1204
  // 公开端点:提供仪表盘HTML
1205
  app.get('/dashboard', (req, res) => {
1206
  res.send(this._getDashboardHtml());
@@ -1390,7 +1393,8 @@ class ProxyServerSystem extends EventEmitter {
1390
  // 主API代理
1391
  app.use(this._createAuthMiddleware());
1392
  app.all(/(.*)/, (req, res) => {
1393
- if (req.path === '/favicon.ico' || req.path.startsWith('/dashboard')) {
 
1394
  return res.status(204).send();
1395
  }
1396
  this.requestHandler.processRequest(req, res);
 
1175
  });
1176
  }
1177
 
1178
+ _createExpressApp() {
 
 
1179
  const app = express();
1180
  app.use(express.json({ limit: '100mb' }));
1181
  app.use(express.raw({ type: '*/*', limit: '100mb' }));
 
1199
 
1200
  // --- 仪表盘和API端点 ---
1201
 
1202
+ // 新增: 将根目录重定向到仪表盘
1203
+ app.get('/', (req, res) => {
1204
+ res.redirect('/dashboard');
1205
+ });
1206
+
1207
  // 公开端点:提供仪表盘HTML
1208
  app.get('/dashboard', (req, res) => {
1209
  res.send(this._getDashboardHtml());
 
1393
  // 主API代理
1394
  app.use(this._createAuthMiddleware());
1395
  app.all(/(.*)/, (req, res) => {
1396
+ // 修改: 增加对根路径的判断,防止其被代理
1397
+ if (req.path === '/' || req.path === '/favicon.ico' || req.path.startsWith('/dashboard')) {
1398
  return res.status(204).send();
1399
  }
1400
  this.requestHandler.processRequest(req, res);