Files
zyt/admin/setup-https-dev.bat
2026-03-04 15:32:30 +08:00

33 lines
791 B
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
REM 为开发环境生成自签名 HTTPS 证书(Windows
REM 用于测试 WebRTC 功能
echo === 生成开发环境 HTTPS 证书 ===
echo.
REM 创建证书目录
if not exist ".cert" mkdir .cert
REM 生成自签名证书
openssl req -x509 -newkey rsa:4096 ^
-keyout .cert/key.pem ^
-out .cert/cert.pem ^
-days 365 ^
-nodes ^
-subj "/C=CN/ST=State/L=City/O=Organization/CN=localhost"
echo.
echo ✅ 证书生成成功!
echo.
echo 证书位置:
echo - 私钥: .cert/key.pem
echo - 证书: .cert/cert.pem
echo.
echo 下一步:
echo 1. 修改 vite.config.ts,添加 HTTPS 配置
echo 2. 运行 npm run dev
echo 3. 浏览器访问 https://localhost:5173/admin/
echo 4. 信任自签名证书(浏览器会提示不安全,点击继续访问)
echo.
pause