-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-http-debug.bat
More file actions
48 lines (42 loc) · 1.41 KB
/
start-http-debug.bat
File metadata and controls
48 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@echo off
chcp 65001 >nul
echo ========================================
echo HTTP调试模式启动脚本
echo ========================================
echo.
echo [1/3] 启用HTTP调试模式...
node -e "const fs=require('fs'); const path='src/utils/constants.js'; let content=fs.readFileSync(path,'utf8'); content=content.replace('SKIP_HTTPS_CHECK: false','SKIP_HTTPS_CHECK: true'); fs.writeFileSync(path,content); console.log('✅ HTTP调试模式已启用');"
if %errorlevel% neq 0 (
echo ❌ 启用HTTP调试模式失败
pause
exit /b 1
)
echo.
echo [2/3] 检查依赖...
npx --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ 未找到npx,请先安装Node.js
pause
exit /b 1
)
echo ✅ Node.js环境检查通过
echo.
echo [3/3] 启动HTTP开发服务器...
echo.
echo 🌐 服务器将在以下地址启动:
echo http://localhost:8080/main.html
echo http://127.0.0.1:8080/main.html
echo.
echo ⚠️ 重要提示:
echo 1. 某些浏览器可能仍然限制HTTP环境下的摄像头访问
echo 2. 如果摄像头无法访问,请尝试以下方法:
echo - Chrome: 启动时添加参数 --unsafely-treat-insecure-origin-as-secure=http://localhost:8080
echo - Firefox: 在about:config中设置media.devices.insecure.enabled为true
echo 3. 按Ctrl+C停止服务器
echo.
echo 正在启动服务器...
echo.
npx http-server . -p 8080 -c-1 --cors
echo.
echo 服务器已停止
pause