This commit is contained in:
jack ning
2025-10-21 11:05:17 +08:00
parent a64896a796
commit 26d2053a40
3 changed files with 324 additions and 1 deletions

View File

@@ -153,7 +153,7 @@ bytedesk/
- [desktop](https://github.com/Bytedesk/bytedesk-desktop)
- [mobile](https://github.com/Bytedesk/bytedesk-mobile)
- [phone](https://github.com/Bytedesk/bytedesk-phone)
- [siphone](https://github.com/Bytedesk/bytedesk-phone)
- [conference](https://github.com/Bytedesk/bytedesk-conference)
## Open Source Demo + SDK

View File

@@ -0,0 +1,312 @@
#
# HTTPS server for meet.weiyuai.cn - proxy to Jitsi server
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/weiyuai.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/weiyuai.cn/privkey.pem;
server_name meet.weiyuai.cn;
# SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Enforce HTTPS on this subdomain
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# meet HTTP API
location /meet {
proxy_pass http://121.36.247.120:8088;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffering off;
# CORS headers
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
}
# meet Admin HTTP API - more specific path first
location /admin/ {
proxy_pass http://121.36.247.120:7088/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffering off;
# CORS headers
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
}
# meet Admin HTTP API - exact path
location = /admin {
proxy_pass http://121.36.247.120:7088;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffering off;
# CORS headers
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
}
# meet WebSocket API (both WS and WSS use same backend)
location /meet/ {
proxy_pass http://121.36.247.120:8188/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
proxy_connect_timeout 60s;
proxy_buffering off;
# CORS headers
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
}
# meet Admin WebSocket API (port 7188)
location /admin-ws/ {
proxy_pass http://121.36.247.120:7188/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
proxy_connect_timeout 60s;
proxy_buffering off;
# CORS headers
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
}
# Static file serving for meet demos
location /demos {
alias /var/www/html/meet;
index index.html index.htm;
# Enable directory listing (optional)
autoindex on;
autoindex_format html;
autoindex_exact_size off;
autoindex_localtime on;
# CORS headers for demos
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always;
# Handle preflight requests
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin "https://meet.weiyuai.cn" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
add_header Access-Control-Max-Age 1728000;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
# Try to serve file directly, fallback to index.html
try_files $uri $uri/ /demos/index.html;
}
# Health check
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# 默认根路径:返回服务说明页
location / {
default_type text/html;
return 200 '<!DOCTYPE html>
<html>
<head>
<title>meet WebRTC Gateway</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, sans-serif;
max-width: 900px;
margin: 50px auto;
padding: 20px;
background: #f5f5f5;
}
.container {
background: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 { color: #333; }
h2 { color: #666; margin-top: 24px; }
.info {
background: #e3f2fd;
padding: 15px;
border-radius: 6px;
margin: 16px 0;
border-left: 4px solid #2196f3;
}
.warning {
background: #fff3e0;
padding: 15px;
border-radius: 6px;
margin: 16px 0;
border-left: 4px solid #ff9800;
}
code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
pre {
background: #263238;
color: #aed581;
padding: 15px;
border-radius: 6px;
overflow-x: auto;
}
a { color: #2196f3; text-decoration: none; }
a:hover { text-decoration: underline; }
ul { line-height: 1.8; }
</style>
</head>
<body>
<div class="container">
<h1>🚪 meet WebRTC Gateway</h1>
<div class="warning">
<strong>提示:</strong> 这是反向代理到 meet 的 HTTPS 入口。媒体传输使用 UDP/TCP 端口,由 meet/插件直接处理,非通过本页面。
</div>
<h2>可用端点</h2>
<div class="info">
<ul>
<li>HTTP API<code>https://meet.weiyuai.cn/meet</code></li>
<li>Admin API<code>https://meet.weiyuai.cn/admin</code></li>
<li>WebSocket API<code>wss://meet.weiyuai.cn/meet/</code></li>
<li>Admin WebSocket<code>wss://meet.weiyuai.cn/admin-ws/</code></li>
<li>Demos<a href="/demos/" target="_blank">/demos/</a></li>
<li>健康检查:<a href="/health" target="_blank">/health</a></li>
</ul>
</div>
<h2>快速测试WebSocket</h2>
<pre>const ws = new WebSocket("wss://meet.weiyuai.cn/meet/");
ws.onopen = () => {
// 发送创建会话请求示例实际需生成唯一事务ID
ws.send(JSON.stringify({
meet: "create",
transaction: "tx-123456"
}));
};
ws.onmessage = (evt) => console.log("meet:", evt.data);
ws.onerror = (e) => console.error("WS error", e);
</pre>
<h2>参考</h2>
<ul>
<li><a href="https://meet.conf.meetecho.com/" target="_blank">meet 官方站点</a></li>
<li><a href="https://github.com/meetecho/meet-gateway" target="_blank">GitHub - meet-gateway</a></li>
<li><a href="/demos/" target="_blank">本机 Demos 集合</a></li>
</ul>
</div>
</body>
</html>';
}
}

View File

@@ -0,0 +1,11 @@
#
# HTTP server for meet.weiyuai.cn - redirect to HTTPS
server {
listen 80;
listen [::]:80;
server_name meet.weiyuai.cn;
# Redirect all HTTP requests to HTTPS
return 301 https://$server_name$request_uri;
}