feat(webrtc): 完善前端会话恢复、设备绑定与开发代理配置
- 控制端新增页面刷新后自动恢复登录会话,并展示恢复中状态 - 支持被控端配对码绑定、设备在线状态标记及离线设备禁用连接 - 优化登录流程,支持双因子验证码输入 - 修复 API 客户端令牌刷新逻辑,增加认证失败统一回调 - 信令地址支持环境变量推导,ICE 服务器支持自定义配置 - 管理后台强制开发态走 Vite 代理,避免跨域和 IP 不可达问题 - 修复 tsconfig.node.json 产物干扰 vite 配置加载的构建问题 - 添加 .env.example 作为环境变量配置模板
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
},
|
||||
// 开发态默认把 /api 与 /ws/signal 代理到信令服务端,避免本地跨域;
|
||||
// 通过 .env 的 VITE_API_BASE 指向后端(如 http://localhost:8080),
|
||||
// 浏览器侧始终走同源相对路径 /api,无需在代码中写死后端地址。
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '');
|
||||
// VITE_API_BASE 为空(开发态推荐)时,回退到本机后端。
|
||||
const target = env.VITE_API_BASE || 'http://localhost:8080';
|
||||
const wsTarget = target.replace(/^http/, 'ws');
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': { target, changeOrigin: true, secure: false },
|
||||
'/ws/signal': { target: wsTarget, ws: true, changeOrigin: true, secure: false },
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user