Merge branch 'master' into feature-zebur-deployment-socket

This commit is contained in:
https://blog.iamtsm.cn
2023-08-11 14:11:26 +08:00
parent e40499c1c7
commit b38c5c699d
75 changed files with 2309 additions and 1471 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
.git
svr/node_modules/
client/packages/rtc-web/
docker/mysql/data/

6
.gitignore vendored
View File

@@ -47,11 +47,9 @@ svr/res/css/*.min.*
dist/
svr/res/dist
svr/dist
client/dist
package-lock.json
docker/mysql/data/*

View File

@@ -8,7 +8,7 @@ RUN npm config set registry https://registry.npmmirror.com; \
npm install -g pm2; \
npm install;
ENV WS_HOST="ws://127.0.0.1"
ENV tl_rtc_file_ws_host="ws://127.0.0.1"
EXPOSE 8444

413
README.md
View File

@@ -1,4 +1,4 @@
# tl-rtc-file-tool 【始于文件传输,不止于文件传输】
# tl-rtc-file-tool【始于文件传输不止于文件传输】
[![](https://img.shields.io/badge/webrtc-p2p-blue)](https://webrtc.org.cn/)
[![](https://img.shields.io/badge/code-simple-green)](https://github.com/iamtsm/tl-rtc-file/)
@@ -14,6 +14,27 @@
<p align="center">QQ群: <a href="https://jq.qq.com/?_wv=1027&k=TKCwMBjN" target="_blank">624214498 </a></p>
## 目录
- [背景](#背景)
- [简介](#简介)
- [优点](#优点)
- [扩展](#扩展)
- [准备 (必须步骤)](#准备-必须步骤)
- [配置websocket (必须步骤)](#配置websocket-必须步骤)
- [启动 (必须步骤)](#启动-必须步骤)
- [配置数据库 (非必须步骤)](#配置数据库-非必须步骤)
- [管理后台 (非必须步骤)](#管理后台-非必须步骤)
- [企微通知 (非必须步骤)](#企微通知-非必须步骤)
- [OSS云存储 (非必须步骤)](#oss云存储-非必须步骤)
- [Chat-GPT (非必须步骤)](#chat-gpt-非必须步骤)
- [配置turnserver (局域网非必须步骤,公网必须步骤)](#配置turnserver-局域网非必须步骤公网必须步骤)
- [Docker](#docker)
- [其他形式部署](#其他形式部署)
- [概述图](#概述图)
- [License](#license)
- [免责声明](#免责声明)
#### 背景 20年毕设的题目相关整理出来的
#### 简介 tl webrtc datachannel filetools用webrt在web端传输文件支持传输超大文件。
@@ -22,63 +43,129 @@
#### 扩展 扩展了许多丰富的小功能,如本地屏幕录制,远程屏幕共享(无延迟),远程音视频通话(无延迟),直播(无延迟)密码房间oss云存储中继服务设置webrtc检测webrtc统计文字传输(群聊,私聊)公共聊天远程画板AI聊天框丰富的后台管理实时执行日志展示机器人告警通知等功能... 等等
## 准备 (必须步骤)
安装node-14.21.x或14.21.x以上npm后进入项目目录运行下面命令
1.安装node-14.21.x或14.21.x以上npm后进入项目目录运行下面命令
```
cd svr/
npm install
```
2.首次运行/自行开发页面,用下面两个命令之一即可
`cd svr/`
`npm run build:dev` (如果你需要自己开发/修改前端页面,用这个命令)
`npm run build:pro` (不需要开发/修改前端页面,用这个命令)
`npm install`
首次运行/自行开发页面,用下面两个命令之一即可
`npm run build:dev` (如果你需要自己开发/修改前端页面,用这个命令)
`npm run build:pro` (不需要开发/修改前端页面,用这个命令)
3.修改 `tlrtcfile.env` 配置文件
## 配置websocket (必须步骤)
修改cfg.json中相应ws配置或者wss配置
修改 `tlrtcfile.env` 中相应websocket配置
"ws": {
"port": 8444, #socket 端口
"host": "ws://域名 或者 ip:port 或者 域名:port", #socket ip 填局域网ip/公网ip, 局域网ip只能在局域网访问公网ip可在公网访问
},
"wss" : {
"port": 8444, #socket 端口
"host": "wss://域名 或者 ip:port 或者 域名:port", #socket ip 填局域网ip/公网ip, 局域网ip只能在局域网访问公网ip可在公网访问
},
## websocket服务端口
tl_rtc_file_ws_port=8444
常见情况示例 :
## websocket服务地址
## "ws://域名 或者 ip:port 或者 域名:port"
## socket ip 填局域网ip/公网ip, 局域网ip只能在局域网访问公网ip可在公网访问
tl_rtc_file_ws_host=ws://127.0.0.1:8444
比如你是用ip(10.1.2.3)的形式部署socket服务那么host就为
ws://10.1.2.3:8444 或者 wss://10.1.2.3:8444
如果你有域名并且配置了代理比如a.test.com转发到本地socket服务的8444端口那么host就为
ws://a.test.com 或者 wss://a.test.com
如果你有域名但是没有转发到具体的端口比如有b.test.com:8444访问的是socket服务的8444端口那么host就为
ws://b.test.com:8444 或者 wss://b.test.com:8444
## 启动 (必须步骤)
启动以下两个服务, 选一种模式启动即可
启动以下两个服务, 选一种模式启动即可两者的区别就是https环境启动才可以使用音视频,直播,屏幕共享功能,其他功能不影响
http模式启动后访问 http://你的机器ip:9092 即可
api服务: `npm run lapi`
socket服务 : `npm run lsocket`
- api服务: `npm run http-api`
- socket服务 : `npm run http-socket`
https模式启动后访问 https://你的机器ip:9092 即可
api服务: `npm run sapi`
- api服务: `npm run https-api`
- socket服务 : `npm run https-socket`
socket服务 : `npm run ssocket`
## 配置数据库 (非必须步骤)
修改 `tlrtcfile.env` 中的数据库相关配置即可
## 是否开启数据库
tl_rtc_file_db_open=false
## 数据库地址
tl_rtc_file_db_mysql_host=mysql
## 数据库端口
tl_rtc_file_db_mysql_port=3306
## 数据库名称
tl_rtc_file_db_mysql_dbName=webchat
## 数据库用户名
tl_rtc_file_db_mysql_user=tlrtcfile
## 数据库密码
tl_rtc_file_db_mysql_password=tlrtcfile
## 管理后台 (非必须步骤)
前提 : 需要开启数据库配置
修改 `tlrtcfile.env` 中的管理后台相关配置即可, 启动后,输入配置的房间号,输入密码,即可进入管理后台
## 管理后台房间号
tl_rtc_file_manage_room=tlrtcfile
## 管理后台密码
tl_rtc_file_manage_password=tlrtcfile
## 企微通知 (非必须步骤)
修改 `tlrtcfile.env` 中的企业微信通知相关配置即可
# ## 企业微信通知开关
tl_rtc_file_notify_open=false
## 企业微信通知机器人KEY正常通知如果有多个key逗号分隔
tl_rtc_file_notify_qiwei_normal=
## 企业微信通知机器人KEY错误通知如果有多个key逗号分隔
tl_rtc_file_notify_qiwei_error=
## OSS云存储 (非必须步骤)
修改 `tlrtcfile.env` 中的OSS存储相关配置即可
## oss-seafile存储库ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile地址
tl_rtc_file_oss_seafile_host=
## oss-seafile用户名
tl_rtc_file_oss_seafile_username=
## oss-seafile密码
tl_rtc_file_oss_seafile_password=
## oss-alyun存储accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-aly存储SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-aly存储bucket
tl_rtc_file_oss_alyun_bucket=
## oss-txyun存储accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyunt存储SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun存储bucket
tl_rtc_file_oss_txyun_bucket=
## oss-qiniuyun存储accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyunt存储SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey==
## oss-qiniuyun存储bucket
tl_rtc_file_oss_qiniuyun_bucket=
## Chat-GPT (非必须步骤)
修改 `tlrtcfile.env` 中的openai相关配置即可
## openai-key如果有多个key逗号分隔
tl_rtc_file_openai_keys=
## 配置turnserver (局域网非必须步骤,公网必须步骤)
@@ -86,224 +173,112 @@ https模式启动后访问 https://你的机器ip:9092 即可
ubuntu示例:
安装coturn `sudo apt-get install coturn`
- 安装coturn `sudo apt-get install coturn`
有效帐号密码 : `docker/coturn/turnserver-with-secret-user.conf`
1. 修改 `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, `realm` 几个字段即可
2. 启动turnserver
1. 修改 `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, `realm` 几个字段即可
2. 启动turnserver
`turnserver -c /这个地方路径填完整/conf/turn/turnserver-with-secret-user.conf`
固定帐号密码 : `docker/coturn/turnserver-with-fixed-user.conf`
1. 修改 `listening-device`, `listening-ip`, `external-ip`, `user`, `realm` 几个字段即可
2. 生成用户
1. 修改 `listening-device`, `listening-ip`, `external-ip`, `user`, `realm` 几个字段即可
2. 生成用户
`turnadmin -a -u 帐号 -p 密码 -r 这个地方填配置文件中的relam`
3. 启动turnserver
3. 启动turnserver
`turnserver -c /这个地方路径填完整/docker/coturn/turnserver-with-secret-user.conf`
部署好coturn后在对应的 `tlrtcfile.env` 配置中设置好webrtc相关信息即可
## 配置数据库 (非必须步骤)
## webrtc-stun中继服务地址
tl_rtc_file_webrtc_stun_host=
## webrtc-turn中继服务地址
tl_rtc_file_webrtc_turn_host=
## webrtc中继服务用户名
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc中继服务密码
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc中继服务Secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc中继服务帐号过期时间 (毫秒)
tl_rtc_file_webrtc_turn_expire=86400000
修改cfg.json中相应数据库配置
"db": {
"open": false, #是否开启数据库, 默认关闭
"mysql": {
"host": "host地址",
"port": 3306,
"dbName": "数据库名称",
"user": "用户名",
"password": "密码",
"other": {
"sequelize": {
"dialect": "mysql",
"host": "host地址",
"port": 3306,
"logging": false,
"pool": {
"max": 5,
"min": 0,
"acquire": 30000,
"idle": 10000
},
"timezone": "+08:00",
"define": {
"freezeTableName": true,
"underscored": true,
"charset": "utf8",
"collate": "utf8_general_ci",
"timestamps": false,
"paranoid": true
}
}
}
}
}
## Docker
## 管理后台 (非必须步骤)
目前支持 `官方镜像``自行打包镜像`,使用官方镜像目前支持两种操作方式 `docker脚本启动``docker-compose启动`
前提 : 需要开启数据库配置
和自行在 `服务器/电脑部署` 不同的是docke环境默认开启数据库coturn服务无须过多额外操作启动即可用。
修改cfg.json中的manage的room和password默认房间号和密码都是tlrtcfile
### 使用官方镜像(docker脚本启动) :
访问 : http://localhost:9092 或者 http://本机ip:9092
按需修改好 `tlrtcfile.env` 配置 (或使用默认配置也可) 后,进入 `bin/` 目录执行脚本 `auto-pull-and-start-docker.sh`
输入配置的房间号,输入密码,即可进入管理后台
```
chmod +x ./auto-pull-and-start-docker.sh
./auto-pull-and-start-docker.sh
```
"manage": {
"room": "tlrtcfile",
"password": "tlrtcfile"
},
### 使用官方镜像(docker-compose启动) :
## 企微通知 (非必须步骤)
按需修改好 `tlrtcfile.env` 配置 (或使用默认配置也可) 后,根据你的`Docker Compose`版本在主目录执行如下对应的命令
修改cfg.json中的notify的qiwei数组填入企业微信机器人的key即可
normal : 正常通知, error : 系统报错通知
"notify": {
"open": true, #是否开启企业微信通知
"qiwei": {
"normal" : [
"key1",
"key2"
],
"error" : [
"key3",
"key4"
]
}
},
## OSS云存储 (非必须步骤)
修改cfg.json中的oss
"oss": {
"seafile": {
"repoid": "",
"host": "",
"username": "帐号",
"password": "密码"
},
"alyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
},
"txyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
},
"qiniuyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
}
},
## Chat-GPT (非必须步骤)
修改cfg.json中的openai.apiKeys填写你自己openai账号生成的apiKey
"openai": {
"apiKeys": [
]
},
## Docker (非必须步骤)
### 使用官方镜像 :
两种镜像模式选一种即可, 注意 127.0.0.1:8444 可以按需调整具体参考上面文档的websocket配置说明部分
http模式镜像:
docker pull iamtsm/tl-rtc-file-api-local
docker run --name=api-local -p 9092:9092 -e "WS_HOST=ws://127.0.0.1:8444" -d iamtsm/tl-rtc-file-api-local localapi
docker pull iamtsm/tl-rtc-file-socket-local
docker run --name=socket-local -p 8444:8444 -e "WS_HOST=ws://127.0.0.1:8444" -d iamtsm/tl-rtc-file-socket-local localsocket
https模式镜像:
docker pull iamtsm/tl-rtc-file-api-server
docker run --name=api-server -p 9092:9092 -e "WSS_HOST=wss://127.0.0.1:8444" -d iamtsm/tl-rtc-file-api-server serverapi
docker pull iamtsm/tl-rtc-file-socket-server
docker run --name=socket-server -p 8444:8444 -e "WSS_HOST=wss://127.0.0.1:8444" -d iamtsm/tl-rtc-file-socket-server serversocket
### 使用官方镜像(docker-compose) :
两种镜像模式选一种即可
http模式镜像:
修改 `docker/local.env`
docker-compose --profile=local up -d
https模式镜像:
修改 `docker/server.env`
docker-compose --profile=server up -d
### 打包自己的镜像 :
进入docker目录后两种模式选一种操作即可
打包http模式镜像:
修改 `docker/local.env` 中的配置信息或者按需配置conf.json中的ws, 或者wss (需要填容器的ip端口信息)
- 对于`Docker Compose V1`
```
docker-compose --profile=http up -d
```
docker-compose -f docker-compose-build-code.yml --profile=local build
- 对于`Docker Compose V2`
```
docker compose --profile=http up -d
```
访问 : http://localhost:9092 或者 http://本机ip:9092
### 自行打包启动镜像(docker-compose打包启动) :
打包https模式镜像:
确认修改好 `tlrtcfile.env` 配置文件 (或使用默认配置也可) 后, 进入 `docker/` 目录后根据你的`Docker Compose`版本在主目录执行如下对应的命令
修改 `docker/server.env` 中的配置信息或者按需配置conf.json中的ws, 或者wss (需要填容器的ip端口信息)
- 对于`Docker Compose V1`
```
docker-compose -f docker-compose-build-code.yml up -d
```
docker-compose -f docker-compose-build-code.yml --profile=server build
访问 : https://localhost:9092 或者 https://本机ip:9092
- 对于`Docker Compose V2`
```
docker compose -f docker-compose-build-code.yml up -d
```
## 其他形式部署
除了上面的手动安装docker官方镜像docker自己打包镜像之外还支持自动脚本下载项目后可以进入bin/目录,选择对应的系统脚本,直接执行即可
除了上面的手动安装docker官方镜像docker自己打包镜像之外还支持自动脚本托管平台一键部署等
如果linux脚本没权限可以先修改一下脚本的可执行权限 `chmod +x bin/linux/*.sh`
下载项目后,可以进入 `bin/` 目录,选择对应的系统脚本,直接执行即可
### linux自动脚本
### ubuntu自动脚本
选一种模式启动即可
- `auto-check-install-local.sh` : 自动检查安装node环境并自动运行启动http模式服务
- `auto-check-install-server.sh` : 自动检查安装node环境并自动运行启动https模式服务
```
chmod +x ./ubuntu/*.sh
cd ubuntu/
./auto-check-install-http.sh
```
使用https方式则是执行这个脚本
```
./auto-check-install-https.sh
```
### windows自动脚本
选一种模式启动即可
```
windows/auto-check-install-http.bat
```
或者使用https方式则是执行这个脚本
```
windows/auto-check-install-https.bat
```
- `auto-check-install-local.bat` : 自动检查安装node环境并自动运行启动http模式服务
### zeabur平台一键部署
- `auto-check-install-server.bat` : 自动检查安装node环境并自动运行启动https模式服务
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/898TLE?referralCode=iamtsm)
## 概述图
@@ -316,4 +291,4 @@ https模式镜像:
## 免责声明
[免责声明](DISCLAIMER.md)
[免责声明](DISCLAIMER.md)

View File

@@ -0,0 +1,42 @@
#!/bin/bash
#########################
# 一键推送dockerhub的脚本
# @auther: iamtsm
# @version: v1.1.0
#########################
######################################## start ######################################
latest_version=latest
######################################## build ######################################
## build by docker-compose-build-code.yml
docker-compose -f ../docker/docker-compose-build-code.yml build
######################################## tag ########################################
# tag latest version
docker tag docker-api:$latest_version iamtsm/tl-rtc-file-api:$latest_version
docker tag docker-socket:$latest_version iamtsm/tl-rtc-file-socket:$latest_version
docker tag docker-mysql:$latest_version iamtsm/tl-rtc-file-mysql:$latest_version
docker tag docker-coturn:$latest_version iamtsm/tl-rtc-file-coturn:$latest_version
######################################## push #######################################
# push latest version
docker push iamtsm/tl-rtc-file-api:$latest_version
docker push iamtsm/tl-rtc-file-socket:$latest_version
docker push iamtsm/tl-rtc-file-mysql:$latest_version
docker push iamtsm/tl-rtc-file-coturn:$latest_version
######################################## del ########################################
## del build version
docker rmi docker-api:$latest_version
docker rmi docker-socket:$latest_version
docker rmi docker-mysql:$latest_version
docker rmi docker-coturn:$latest_version
# # del tag build version
docker rmi iamtsm/tl-rtc-file-api:$latest_version
docker rmi iamtsm/tl-rtc-file-socket:$latest_version
docker rmi iamtsm/tl-rtc-file-mysql:$latest_version
docker rmi iamtsm/tl-rtc-file-coturn:$latest_version
######################################## done #######################################

View File

@@ -1,23 +0,0 @@
#!/bin/bash
build_version=latest
hub_version=v1.0.0
## build by docker-compose-build-code.yml
docker-compose -f ../docker/docker-compose-build-code.yml --profile=local build
## tag
docker tag docker-tl-rtc-file-api-local:$build_version iamtsm/tl-rtc-file-api-local:$hub_version
docker tag docker-tl-rtc-file-socket-local:$build_version iamtsm/tl-rtc-file-socket-local:$hub_version
## push to hub version and latest
docker push iamtsm/tl-rtc-file-api-local:$hub_version
docker push iamtsm/tl-rtc-file-socket-local:$hub_version
docker push iamtsm/tl-rtc-file-api-local:latest
docker push iamtsm/tl-rtc-file-socket-local:latest
## remove local images
docker rmi docker-tl-rtc-file-api-local:$build_version
docker rmi docker-tl-rtc-file-socket-local:$build_version
docker rmi iamtsm/tl-rtc-file-api-local:$hub_version
docker rmi iamtsm/tl-rtc-file-socket-local:$hub_version

View File

@@ -1,23 +0,0 @@
#!/bin/bash
build_version=latest
hub_version=v1.0.0
## build by docker-compose-build-code.yml
docker-compose -f ../docker/docker-compose-build-code.yml --profile=server build
## tag
docker tag docker-tl-rtc-file-api-server:$build_version iamtsm/tl-rtc-file-api-server:$hub_version
docker tag docker-tl-rtc-file-socket-server:$build_version iamtsm/tl-rtc-file-socket-server:$hub_version
## push to hub version and latest
docker push iamtsm/tl-rtc-file-api-server:$hub_version
docker push iamtsm/tl-rtc-file-socket-server:$hub_version
docker push iamtsm/tl-rtc-file-api-server:latest
docker push iamtsm/tl-rtc-file-socket-server:latest
## remove server images
docker rmi docker-tl-rtc-file-api-server:$build_version
docker rmi docker-tl-rtc-file-socket-server:$build_version
docker rmi iamtsm/tl-rtc-file-api-server:$hub_version
docker rmi iamtsm/tl-rtc-file-socket-server:$hub_version

179
bin/auto-pull-and-start-docker.sh Executable file
View File

@@ -0,0 +1,179 @@
#!/bin/bash
#########################
# 提供一键部署docker的脚本
# @auther: iamtsm
# @version: v1.1.0
#########################
# 检查Docker是否启动
docker info > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "======> Docker is not running. Exiting."
exit 1
fi
# 读取配置文件中的每一行
while IFS= read -r line; do
# 忽略注释和空行
if [[ $line == \#* || -z $line ]]; then
continue
fi
# 将每一行拆分成键和值
IFS== read -r key value <<< "$line"
# 去除空白字符
key=$(echo "$key" | tr -d '[:space:]')
value=$(echo "$value" | tr -d '[:space:]')
# 设置环境变量
export "$key"="$value"
echo "======> " $key=$value
done < ./../tlrtcfile.env
# docker启动 默认开启数据库
export tl_rtc_file_db_open=true
# 从dockerhub拉取镜像
docker pull iamtsm/tl-rtc-file-api
docker pull iamtsm/tl-rtc-file-socket
docker pull iamtsm/tl-rtc-file-mysql
docker pull iamtsm/tl-rtc-file-coturn
if docker images | grep -q "iamtsm/tl-rtc-file-api"; then
echo "======> check image iamtsm/tl-rtc-file-api exists ok..."
else
echo "======> Image iamtsm/tl-rtc-file-api does not exist. Exiting."
exit 1
fi
if docker images | grep -q "iamtsm/tl-rtc-file-socket"; then
echo "======> check image iamtsm/tl-rtc-file-socket exists ok..."
else
echo "======> Image iamtsm/tl-rtc-file-socket does not exist. Exiting."
exit 1
fi
if docker images | grep -q "iamtsm/tl-rtc-file-mysql"; then
echo "======> check image iamtsm/tl-rtc-file-mysql exists ok..."
else
echo "Image iamtsm/tl-rtc-file-mysql does not exist. Exiting."
exit 1
fi
if docker images | grep -q "iamtsm/tl-rtc-file-coturn"; then
echo "======> check image iamtsm/tl-rtc-file-coturn exists ok..."
else
echo "Image iamtsm/tl-rtc-file-coturn does not exist. Exiting."
exit 1
fi
echo "======> start run docker..."
# 启动mysql容器
docker run \
--name=mysql \
-p $tl_rtc_file_db_mysql_port:$tl_rtc_file_db_mysql_port \
-e MYSQL_ROOT_PASSWORD=tlrtcfile \
-e MYSQL_DATABASE=webchat \
-e MYSQL_USER=tlrtcfile \
-e MYSQL_PASSWORD=tlrtcfile \
-v ./../docker/mysql/data/mysql.env:/tlrtcfile/docker/mysql/mysql.env \
-v ./../docker/mysql/data/db:/var/lib/mysql \
-v ./../docker/mysql/data/my.cnf:/etc/mysql/conf.d/my.cnf \
-v ./../docker/mysql/data/log:/var/log/mysql \
-v ./../docker/mysql/data/init.sql:/docker-entrypoint-initdb.d/init.sql \
--restart=always \
-d iamtsm/tl-rtc-file-mysql
# 启动coturn容器
docker run \
--name=coturn \
-p 3478:3478/udp \
-p 3478:3478/tcp \
-v ./../docker/coturn/turnserver-with-secret-user.conf:/etc/coturn/turnserver.conf \
-d iamtsm/tl-rtc-file-coturn
# 启动api容器
docker run \
--name=api \
-p $tl_rtc_file_api_port:$tl_rtc_file_api_port \
-e "tl_rtc_file_env_mode=http" \
-e tl_rtc_file_api_port \
-e tl_rtc_file_ws_port \
-e tl_rtc_file_ws_host \
-e tl_rtc_file_webrtc_stun_host \
-e tl_rtc_file_webrtc_turn_host \
-e tl_rtc_file_webrtc_turn_username \
-e tl_rtc_file_webrtc_turn_credential \
-e tl_rtc_file_webrtc_turn_secret \
-e tl_rtc_file_webrtc_turn_expire \
-e tl_rtc_file_db_open \
-e tl_rtc_file_db_mysql_host \
-e tl_rtc_file_db_mysql_port \
-e tl_rtc_file_db_mysql_dbName \
-e tl_rtc_file_db_mysql_user \
-e tl_rtc_file_db_mysql_password \
-e tl_rtc_file_oss_seafile_repoid \
-e tl_rtc_file_oss_seafile_host \
-e tl_rtc_file_oss_seafile_username \
-e tl_rtc_file_oss_seafile_password \
-e tl_rtc_file_oss_alyun_AccessKey \
-e tl_rtc_file_oss_alyun_Secretkey \
-e tl_rtc_file_oss_alyun_bucket \
-e tl_rtc_file_oss_txyun_AccessKey \
-e tl_rtc_file_oss_txyun_Secretkey \
-e tl_rtc_file_oss_txyun_bucket \
-e tl_rtc_file_oss_qiniuyun_AccessKey \
-e tl_rtc_file_oss_qiniuyun_Secretkey \
-e tl_rtc_file_oss_qiniuyun_bucket \
-e tl_rtc_file_manage_room \
-e tl_rtc_file_manage_password \
-e tl_rtc_file_notify_open \
-e tl_rtc_file_notify_qiwei_normal \
-e tl_rtc_file_notify_qiwei_error \
-v ../tlrtcfile.env:/tlrtcfile/tlrtcfile.env \
--link mysql \
-d iamtsm/tl-rtc-file-api tlapi
# 启动socket容器
docker run \
--name=socket \
-p $tl_rtc_file_ws_port:$tl_rtc_file_ws_port \
-e "tl_rtc_file_env_mode=http" \
-e tl_rtc_file_api_port \
-e tl_rtc_file_ws_port \
-e tl_rtc_file_ws_host \
-e tl_rtc_file_webrtc_stun_host \
-e tl_rtc_file_webrtc_turn_host \
-e tl_rtc_file_webrtc_turn_username \
-e tl_rtc_file_webrtc_turn_credential \
-e tl_rtc_file_webrtc_turn_secret \
-e tl_rtc_file_webrtc_turn_expire \
-e tl_rtc_file_db_open \
-e tl_rtc_file_db_mysql_host \
-e tl_rtc_file_db_mysql_port \
-e tl_rtc_file_db_mysql_dbName \
-e tl_rtc_file_db_mysql_user \
-e tl_rtc_file_db_mysql_password \
-e tl_rtc_file_oss_seafile_repoid \
-e tl_rtc_file_oss_seafile_host \
-e tl_rtc_file_oss_seafile_username \
-e tl_rtc_file_oss_seafile_password \
-e tl_rtc_file_oss_alyun_AccessKey \
-e tl_rtc_file_oss_alyun_Secretkey \
-e tl_rtc_file_oss_alyun_bucket \
-e tl_rtc_file_oss_txyun_AccessKey \
-e tl_rtc_file_oss_txyun_Secretkey \
-e tl_rtc_file_oss_txyun_bucket \
-e tl_rtc_file_oss_qiniuyun_AccessKey \
-e tl_rtc_file_oss_qiniuyun_Secretkey \
-e tl_rtc_file_oss_qiniuyun_bucket \
-e tl_rtc_file_manage_room \
-e tl_rtc_file_manage_password \
-e tl_rtc_file_notify_open \
-e tl_rtc_file_notify_qiwei_normal \
-e tl_rtc_file_notify_qiwei_error \
-v ../tlrtcfile.env:/tlrtcfile/tlrtcfile.env \
--link mysql \
-d iamtsm/tl-rtc-file-socket tlsocket

View File

@@ -1,46 +0,0 @@
#!/bin/bash
# Step 1: Check if Node.js is installed and install Node.js 18 if not
if ! command -v node &> /dev/null; then
echo "Node.js is not installed. Installing Node.js 18..."
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
# Step 2: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "Node.js version: $node_version"
echo "npm version: $npm_version"
sleep 1
# Step 3: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
echo "pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
fi
# Step 4: Output pm2 version
pm2_version=$(pm2 -v)
echo "pm2 version: $pm2_version"
sleep 1
# Step 5: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "Port 9092 or 8444 is already in use."
exit 1
fi
# Step 6: install npm packages
echo "ready to install npm packages"
cd ../../svr/
npm install --registry=https://registry.npmmirror.com
cd ../bin/linux/
# Step 7: Run start-local.sh script to start the service
echo "ready to run auto-start-local.sh"
sleep 1
./auto-start-local.sh

View File

@@ -1,46 +0,0 @@
#!/bin/bash
# Step 1: Check if Node.js is installed and install Node.js 18 if not
if ! command -v node &> /dev/null; then
echo "Node.js is not installed. Installing Node.js 18..."
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
# Step 2: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "Node.js version: $node_version"
echo "npm version: $npm_version"
sleep 1
# Step 3: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
echo "pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
fi
# Step 4: Output pm2 version
pm2_version=$(pm2 -v)
echo "pm2 version: $pm2_version"
sleep 1
# Step 5: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "Port 9092 or 8444 is already in use."
exit 1
fi
# Step 6: install npm packages
echo "ready to install npm packages"
cd ../../svr/
npm install --registry=https://registry.npmmirror.com
cd ../bin/linux/
# Step 7: Run start-server.sh script to start the service
echo "ready to run auto-start-server.sh"
sleep 1
./auto-start-server.sh

View File

@@ -1,13 +0,0 @@
#!/bin/bash
cd ../../svr/
pm2 start npm --name=tl-rtc-file-api-local -- run lapi
sleep 1
pm2 start npm --name=tl-rtc-file-socket-local -- run lsocket
sleep 1
npm run build:pro

View File

@@ -1,13 +0,0 @@
#!/bin/bash
cd ../../svr/
pm2 start npm --name=tl-rtc-file-api-server -- run sapi
sleep 1
pm2 start npm --name=tl-rtc-file-socket-server -- run ssocket
sleep 1
npm run build:pro

View File

@@ -1,5 +0,0 @@
#!/bin/bash
pm2 stop all
echo "stop all pm2 processes ok"

View File

@@ -0,0 +1,101 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-http.sh script to start the service
echo "Ready to run auto-start-http.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-http.sh

View File

@@ -0,0 +1,99 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "======>Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-https.sh script to start the service
echo "======>Ready to run auto-start-https.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-https.sh

11
bin/ubuntu16/auto-start-http.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run http-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
sleep 1
npm run build:pro

View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run https-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
sleep 1
npm run build:pro

7
bin/ubuntu16/auto-stop.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
pm2 del tl-rtc-file-api
pm2 del tl-rtc-file-socket
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"

View File

@@ -0,0 +1,101 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-http.sh script to start the service
echo "Ready to run auto-start-http.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-http.sh

View File

@@ -0,0 +1,99 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "======>Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-https.sh script to start the service
echo "======>Ready to run auto-start-https.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-https.sh

11
bin/ubuntu18/auto-start-http.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run http-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
sleep 1
npm run build:pro

View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run https-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
sleep 1
npm run build:pro

7
bin/ubuntu18/auto-stop.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
pm2 del tl-rtc-file-api
pm2 del tl-rtc-file-socket
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"

View File

@@ -0,0 +1,101 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-http.sh script to start the service
echo "Ready to run auto-start-http.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-http.sh

View File

@@ -0,0 +1,99 @@
#!/bin/bash
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo apt-get update
sudo apt-get install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
apt-get update
apt-get install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "======>Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-https.sh script to start the service
echo "======>Ready to run auto-start-https.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-https.sh

11
bin/ubuntu20/auto-start-http.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run http-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
sleep 1
npm run build:pro

View File

@@ -0,0 +1,11 @@
#!/bin/bash
pm2 start npm --name=tl-rtc-file-api -- run https-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
sleep 1
npm run build:pro

7
bin/ubuntu20/auto-stop.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
pm2 del tl-rtc-file-api
pm2 del tl-rtc-file-socket
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"

View File

@@ -0,0 +1,104 @@
@echo off
:: Function to install Node.js 16
:install_node
echo ======>Node.js is not installed. Installing Node.js 16...
curl -sL https://deb.nodesource.com/setup_16.x | bash -
msiexec /i nodejs-installer.msi /qn
echo ======>Node.js 16 installed
goto :eof
:: Function to install pm2 globally
:install_pm2
echo ======>pm2 is not installed. Installing pm2 globally...
npm install -g pm2
echo ======>pm2 installed
goto :eof
:: Function to install lsof
:install_lsof
echo ======>lsof is not installed. Installing lsof...
:: Assuming lsof equivalent is not available on Windows by default
echo ======>lsof installed
goto :eof
:: Wait for a command to become available
:wait_for_command
setlocal
set "command=%~1"
set "timeout=10"
:loop
timeout /t %timeout% /nobreak >nul
where %command% >nul 2>&1 || goto :loop
endlocal
goto :eof
:: Step 1: Check if sudo is installed and install if not
where sudo >nul 2>&1 || (
echo ======>sudo is not installed. Installing sudo...
REM Install a sudo equivalent for Windows (e.g., Chocolatey's sudo)
choco install sudo
)
:: Step 2: Check if curl is installed
where curl >nul 2>&1 || (
echo ======>curl is not installed. Installing curl...
REM Install curl using Chocolatey or other means
)
:: Step 3: Check if Node.js is installed and install Node.js 16 if not
where node >nul 2>&1 || (
call :install_node
) else (
echo ======>Node.js is already installed
)
:: Wait for Node.js to be installed
call :wait_for_command node
:: Step 4: Output Node.js and npm versions
for /f %%i in ('node -v') do set "node_version=%%i"
for /f %%i in ('npm -v') do set "npm_version=%%i"
echo ======>Node.js version: %node_version%
echo ======>npm version: %npm_version%
:: Step 5: Check if pm2 is installed and install it globally if not
where pm2 >nul 2>&1 || (
call :install_pm2
) else (
echo ======>pm2 is already installed
)
:: Wait for pm2 to be installed
call :wait_for_command pm2
:: Step 6: Check if lsof is installed and install if not
where lsof >nul 2>&1 || (
call :install_lsof
) else (
echo ======>lsof is already installed
)
:: Step 7: Check if ports 9092 and 8444 are occupied
REM Equivalent check for port occupancy on Windows
netstat -an | find "9092" >nul && (
echo ======>Port 9092 is already in use.
exit /b 1
)
netstat -an | find "8444" >nul && (
echo ======>Port 8444 is already in use.
exit /b 1
)
:: Step 8: install npm packages
echo Ready to install npm packages
cd ..\..\svr\
del package-lock.json
npm install --registry=https://registry.npmmirror.com
:: Step 9: Run start-http.bat script to start the service
echo Ready to run auto-start-http.bat
timeout /t 1 >nul
call ..\bin\windows\auto-start-http.bat
:eof

View File

@@ -0,0 +1,104 @@
@echo off
:: Function to install Node.js 16
:install_node
echo ======>Node.js is not installed. Installing Node.js 16...
curl -sL https://deb.nodesource.com/setup_16.x | bash -
msiexec /i nodejs-installer.msi /qn
echo ======>Node.js 16 installed
goto :eof
:: Function to install pm2 globally
:install_pm2
echo ======>pm2 is not installed. Installing pm2 globally...
npm install -g pm2
echo ======>pm2 installed
goto :eof
:: Function to install lsof
:install_lsof
echo ======>lsof is not installed. Installing lsof...
:: Assuming lsof equivalent is not available on Windows by default
echo ======>lsof installed
goto :eof
:: Wait for a command to become available
:wait_for_command
setlocal
set "command=%~1"
set "timeout=10"
:loop
timeout /t %timeout% /nobreak >nul
where %command% >nul 2>&1 || goto :loop
endlocal
goto :eof
:: Step 1: Check if sudo is installed and install if not
where sudo >nul 2>&1 || (
echo ======>sudo is not installed. Installing sudo...
REM Install a sudo equivalent for Windows (e.g., Chocolatey's sudo)
choco install sudo
)
:: Step 2: Check if curl is installed
where curl >nul 2>&1 || (
echo ======>curl is not installed. Installing curl...
REM Install curl using Chocolatey or other means
)
:: Step 3: Check if Node.js is installed and install Node.js 16 if not
where node >nul 2>&1 || (
call :install_node
) else (
echo ======>Node.js is already installed
)
:: Wait for Node.js to be installed
call :wait_for_command node
:: Step 4: Output Node.js and npm versions
for /f %%i in ('node -v') do set "node_version=%%i"
for /f %%i in ('npm -v') do set "npm_version=%%i"
echo ======>Node.js version: %node_version%
echo ======>npm version: %npm_version%
:: Step 5: Check if pm2 is installed and install it globally if not
where pm2 >nul 2>&1 || (
call :install_pm2
) else (
echo ======>pm2 is already installed
)
:: Wait for pm2 to be installed
call :wait_for_command pm2
:: Step 6: Check if lsof is installed and install if not
where lsof >nul 2>&1 || (
call :install_lsof
) else (
echo ======>lsof is already installed
)
:: Step 7: Check if ports 9092 and 8444 are occupied
REM Equivalent check for port occupancy on Windows
netstat -an | find "9092" >nul && (
echo ======>Port 9092 is already in use.
exit /b 1
)
netstat -an | find "8444" >nul && (
echo ======>Port 8444 is already in use.
exit /b 1
)
:: Step 8: install npm packages
echo Ready to install npm packages
cd ..\..\svr\
del package-lock.json
npm install --registry=https://registry.npmmirror.com
:: Step 9: Run start-https.bat script to start the service
echo Ready to run auto-start-https.bat
timeout /t 1 >nul
call ..\bin\windows\auto-start-https.bat
:eof

View File

@@ -1,51 +0,0 @@
@echo off
setlocal
REM Step 1: Check if Node.js is installed and install Node.js 18 if not
where /q node
if %ERRORLEVEL% NEQ 0 (
echo Node.js is not installed. Installing Node.js 18...
REM Modify the Node.js installer URL if needed
curl -o node_installer.msi https://nodejs.org/dist/v18.0.0/node-v18.0.0-x64.msi
start /wait msiexec /i node_installer.msi /qn
del node_installer.msi
)
REM Step 2: Output Node.js and npm versions
node -v
npm -v
REM Step 3: Check if pm2 is installed and install it globally if not
where /q pm2
if %ERRORLEVEL% NEQ 0 (
echo pm2 is not installed. Installing pm2 globally...
npm install -g pm2
)
REM Step 4: Output pm2 version
pm2 -v
REM Step 5: Check if ports 9092 and 8444 are occupied
netstat -ano | findstr ":9092"
if %ERRORLEVEL% EQU 0 (
echo Port 9092 is already in use.
exit /b 1
)
netstat -ano | findstr ":8444"
if %ERRORLEVEL% EQU 0 (
echo Port 8444 is already in use.
exit /b 1
)
REM Step 6: Output installation successful message
echo env Installation successful.
@echo off
echo "ready to install npm packages"
cd "..\..\svr\"
npm install --registry=https://registry.npmmirror.com
cd "..\bin\windows\"
REM Step 7: Run start-local.bat script to start the service
auto-start-local.bat

View File

@@ -1,51 +0,0 @@
@echo off
setlocal
REM Step 1: Check if Node.js is installed and install Node.js 18 if not
where /q node
if %ERRORLEVEL% NEQ 0 (
echo Node.js is not installed. Installing Node.js 18...
REM Modify the Node.js installer URL if needed
curl -o node_installer.msi https://nodejs.org/dist/v18.0.0/node-v18.0.0-x64.msi
start /wait msiexec /i node_installer.msi /qn
del node_installer.msi
)
REM Step 2: Output Node.js and npm versions
node -v
npm -v
REM Step 3: Check if pm2 is installed and install it globally if not
where /q pm2
if %ERRORLEVEL% NEQ 0 (
echo pm2 is not installed. Installing pm2 globally...
npm install -g pm2
)
REM Step 4: Output pm2 version
pm2 -v
REM Step 5: Check if ports 9092 and 8444 are occupied
netstat -ano | findstr ":9092"
if %ERRORLEVEL% EQU 0 (
echo Port 9092 is already in use.
exit /b 1
)
netstat -ano | findstr ":8444"
if %ERRORLEVEL% EQU 0 (
echo Port 8444 is already in use.
exit /b 1
)
REM Step 6: Output installation successful message
echo env Installation successful.
@echo off
echo "ready to install npm packages"
cd "..\..\svr\"
npm install --registry=https://registry.npmmirror.com
cd "..\bin\windows\"
REM Step 7: Run start-local.bat script to start the service
auto-start-local.bat

View File

@@ -1,13 +1,11 @@
cd "..\..\svr\"
@echo off
REM Start the first process
start "" pm2 start npm --name=tl-rtc-file-api-local -- run lapi
start "" pm2 start npm --name=tl-rtc-file-api -- run http-api
timeout /t 1 /nobreak
REM Start the second process
start "" pm2 start npm --name=tl-rtc-file-socket-local -- run lsocket
start "" pm2 start npm --name=tl-rtc-file-socket -- run http-socket
timeout /t 1 /nobreak
REM Run npm build command

View File

@@ -1,13 +1,11 @@
cd "..\..\svr\"
@echo off
REM Start the first process
start "" pm2 start npm --name=tl-rtc-file-api-local -- run sapi
start "" pm2 start npm --name=tl-rtc-file-api -- run https-api
timeout /t 1 /nobreak
REM Start the second process
start "" pm2 start npm --name=tl-rtc-file-socket-local -- run ssocket
start "" pm2 start npm --name=tl-rtc-file-socket -- run https-socket
timeout /t 1 /nobreak
REM Run npm build command

View File

@@ -1,4 +1,4 @@
# tl-rtc-file-tool [From File Transfer to Beyond]
# tl-rtc-file-toolFrom File Transfer, Beyond File Transfer】
[![](https://img.shields.io/badge/webrtc-p2p-blue)](https://webrtc.org.cn/)
[![](https://img.shields.io/badge/code-simple-green)](https://github.com/iamtsm/tl-rtc-file/)
@@ -9,275 +9,279 @@
<p align="center">
<a href="https://im.iamtsm.cn/file" target="_blank">Demo</a>
<a href="https://hub.docker.com/repositories/iamtsm" target="_blank">DockerHub</a>
<a href="https://github.com/tl-open-source/tl-rtc-file/blob/master/README.md" target="_blank">中文-DOC</a>
<a href="https://github.com/tl-open-source/tl-rtc-file/blob/master/doc/README_EN.md" target="_blank">EN-DOC</a>
</p>
<p align="center">QQ-Group: <a href="https://jq.qq.com/?_wv=1027&k=TKCwMBjN" target="_blank">624214498 </a></p>
<p align="center">QQ Group: <a href="https://jq.qq.com/?_wv=1027&k=TKCwMBjN" target="_blank">624214498 </a></p>
#### Background: Collated from the topic of my graduation project in 2020.
## Table of Contents
#### Introduction: (tl webrtc datachannel filetools) transfers files using WebRTC on the web, supporting transmission of large files.
- [Background](#background)
- [Introduction](#introduction)
- [Advantages](#advantages)
- [Extensions](#extensions)
- [Preparation (Mandatory Steps)](#preparation-mandatory-steps)
- [Configure Websocket (Mandatory Steps)](#configure-websocket-mandatory-steps)
- [Startup (Mandatory Steps)](#startup-mandatory-steps)
- [Configure Database (Optional)](#configure-database-optional)
- [Admin Panel (Optional)](#admin-panel-optional)
- [Enterprise WeChat Notifications (Optional)](#enterprise-wechat-notifications-optional)
- [OSS Cloud Storage (Optional)](#oss-cloud-storage-optional)
- [Chat-GPT Integration (Optional)](#chat-gpt-integration-optional)
- [Configure TURN Server (LAN-Optional, WAN-Mandatory)](#configure-turn-server-lan-optional-wan-mandatory)
- [Docker](#docker)
- [Other Deployment Methods](#other-deployment-methods)
- [Overview Diagram](#overview-diagram)
- [License](#license)
- [Disclaimer](#disclaimer)
#### Advantages: Fragmented transmission, cross-platform, platform-independent, easy to use, no speed restrictions on the local network (up to 70+ MB/s in the LAN), supports private deployment, supports drag-and-drop sending of multiple files, and web-based file preview.
#### Background: Developed from the topic of 2020 graduation project
#### Extensions: Provides various additional features such as local screen recording, remote screen sharing (no delay), remote audio/video calls (no delay), live streaming (no delay), password-protected rooms, cloud storage via OSS, relay service settings, WebRTC detection, WebRTC statistics, text transmission (group chat, private chat), public chat, remote drawing board, AI chat box, feature-rich backend management, real-time execution log display, robot alert notifications, and more.
#### Introduction: (tl webrtc datachannel filetools) Transferring files through WebRTC on the web, supporting transfer of large files.
#### Advantages: Fragmented transfer, cross-platform, platform-independent, easy to use, no internal network speed limit (up to 70+ MB/s in LAN), supports private deployment, supports multi-file drag-and-drop sending, web file preview.
#### Extensions: Extended with many rich features, such as local screen recording, remote screen sharing (zero-latency), remote audio-video calling (zero-latency), live streaming (zero-latency), password-protected rooms, OSS cloud storage, relay service settings, WebRTC testing, WebRTC statistics, text messaging (group, private), public chat, remote whiteboard, AI chatbot, comprehensive admin dashboard, real-time execution log display, robot alert notifications, etc.
## Preparation (Mandatory Steps)
Install node 14.21.x or above, and npm. Then, navigate to the project directory and run the following commands:
1. Install Node.js 14.21.x or above and npm. Then navigate to the project directory and run the following command:
```bash
cd svr/
npm install
```
For the first run or when developing your own frontend, use either of the following commands:
2. For the first run or self-developed pages, you can use one of the following commands:
npm run build:dev (If you need to develop/modify the frontend)
npm run build:pro (If you don't need to develop/modify the frontend)
```bash
npm run build:dev # If you need to develop or modify frontend pages
npm run build:pro # If you don't need to develop or modify frontend pages
```
## Configure WebSocket (Mandatory Step)
3. Modify the `tlrtcfile.env` configuration file.
Modify the respective ws or wss configurations in cfg.json:
## Configure Websocket (Mandatory Steps)
"ws": {
"port": 8444, #socket port
"host": "ws://domain or ip:port or domain:port", #socket ip, use LAN IP for the local network, and public IP for the internet
},
"wss" : {
"port": 8444, #socket port
"host": "wss://domain or ip:port or domain:port", #socket ip, use LAN IP for the local network, and public IP for the internet
},
Modify the corresponding websocket configuration in `tlrtcfile.env`:
Common examples:
```ini
## Websocket server port
tl_rtc_file_ws_port=8444
If you are deploying the socket service using the IP (10.1.2.3), the host will be:
## Websocket server address
## "ws://domain or ip:port or domain:port"
## For socket ip, use LAN IP for LAN access and public IP for public access
tl_rtc_file_ws_host=ws://127.0.0.1:8444
```
ws://10.1.2.3:8444 or wss://10.1.2.3:8444
## Startup (Mandatory Steps)
If you have a domain and configured a proxy, for example, a.test.com forwarding to the local socket service on port 8444, the host will be:
Start the following two services, choose either mode, the difference between them is that the HTTPS environment is required for audio-video functions, live streaming, and screen sharing, but it won't affect other functionalities.
ws://a.test.com or wss://a.test.com
After starting in HTTP mode, access http://your_machine_ip:9092.
If you have a domain but it's not forwarded to a specific port, for example, accessing b.test.com:8444 accesses the socket service on port 8444, the host will be:
API service: `npm run http-api`
ws://b.test.com:8444 or wss://b.test.com:8444
Socket service: `npm run http-socket`
## Startup (Mandatory Step)
After starting in HTTPS mode, access https://your_machine_ip:9092.
Start the following two services, choose one mode to start:
API service: `npm run https-api`
HTTP mode: After starting, access http://your-machine-ip:9092
Socket service: `npm run https-socket`
API service: npm run lapi
Socket service: npm run lsocket
## Configure Database (Optional)
HTTPS mode: After starting, access https://your-machine-ip:9092
Modify the database-related configuration in `tlrtcfile.env`:
API service: npm run sapi
Socket service: npm run ssocket
```ini
## Enable database
tl_rtc_file_db_open=false
## Database address
tl_rtc_file_db_mysql_host=mysql
## Database port
tl_rtc_file_db_mysql_port=3306
## Database name
tl_rtc_file_db_mysql_dbName=webchat
## Database username
tl_rtc_file_db_mysql_user=tlrtcfile
## Database password
tl_rtc_file_db_mysql_password=tlrtcfile
```
## Configure TURN server (Not mandatory for LAN deployment, mandatory for internet deployment)
## Admin Panel (Optional)
Currently, there are two ways to generate account and password for using TURN service: fixed credentials (recommended) and time-limited credentials. **Choose one method**.
Prerequisite: Database configuration needs to be enabled.
Modify the admin panel-related configuration in `tlrtcfile.env`. After starting, enter the configured room number and password to access the admin panel:
```ini
## Admin panel room number
tl_rtc_file_manage_room=tlrtcfile
## Admin panel password
tl_rtc_file_manage_password=tlrtcfile
```
## Enterprise WeChat Notifications (Optional)
Modify the Enterprise WeChat notification-related configuration in `tlrtcfile.env`:
```ini
## Enterprise WeChat notification switch
tl_rtc_file_notify_open=false
## Enterprise WeChat notification robot key for normal notifications (comma-separated if multiple keys)
tl_rtc_file_notify_qiwei_normal=
## Enterprise WeChat notification robot key for error notifications (comma-separated if multiple keys)
tl_rtc_file_notify_qiwei_error=
```
## OSS Cloud Storage (Optional)
Modify the OSS storage-related configuration in `tlrtcfile.env`:
```ini
## oss-seafile storage repository ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile address
tl
_rtc_file_oss_seafile_host=
## oss-seafile username
tl_rtc_file_oss_seafile_username=
## oss-seafile password
tl_rtc_file_oss_seafile_password=
## oss-alyun storage accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-alyun storage SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-alyun storage bucket
tl_rtc_file_oss_alyun_bucket=
## oss-txyun storage accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyun storage SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun storage bucket
tl_rtc_file_oss_txyun_bucket=
## oss-qiniuyun storage accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyun storage SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey==
## oss-qiniuyun storage bucket
tl_rtc_file_oss_qiniuyun_bucket=
```
## Chat-GPT Integration (Optional)
Modify the OpenAI-related configuration in `tlrtcfile.env`:
```ini
## OpenAI keys (comma-separated if multiple keys)
tl_rtc_file_openai_keys=
```
## Configure TURN Server (LAN-Optional, WAN-Mandatory)
Currently, two ways are available to generate and use TURN service credentials: fixed credentials (recommended) and temporary credentials with expiration. **Choose one method**.
Example for Ubuntu:
Install coturn: `sudo apt-get install coturn`
Time-limited credentials: `docker/coturn/turnserver-with-secret-user.conf`
Fixed credentials: `docker/coturn/turnserver-with-secret-user.conf`
1. Modify `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, `realm` fields accordingly.
1. Modify fields like `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, `realm`.
2. Start turnserver: `turnserver -c /complete-path/conf/turn/turnserver-with-secret-user.conf`
Fixed credentials: `docker/coturn/turnserver-with-fixed-user.conf`
1. Modify `listening-device`, `listening-ip`, `external-ip`, `user`, `realm` fields accordingly.
2. Generate user: `turnadmin -a -u username -p password -r realm-from-config`
3. Start turnserver: `turnserver -c /complete-path/docker/coturn/turnserver-with-secret-user.conf`
## Configure Database (Not mandatory step)
Modify the corresponding database configuration in cfg.json:
"db": {
"open": false, # Whether to enable the database, defaults to off
"mysql": {
"host": "host-address",
"port": 3306,
"dbName": "database-name",
"user": "username",
"password": "password",
"other": {
"sequelize": {
"dialect": "mysql",
"host": "host-address",
"port": 3306,
"logging": false,
"pool": {
"max": 5,
"min": 0,
"acquire": 30000,
"idle": 10000
},
"timezone": "+08:00",
"define": {
"freezeTableName": true,
"underscored": true,
"charset": "utf8",
"collate": "utf8_general_ci",
"timestamps": false,
"paranoid": true
}
}
}
}
}
## Management Dashboard (Not mandatory step)
Prerequisite: Enable the database configuration.
Modify the room and password for the manage section in cfg.json (default room number and password are "tlrtcfile"):
"manage": {
"room": "tlrtcfile",
"password": "tlrtcfile"
}
Access: http://localhost:9092 or http://your-machine-ip:9092
Enter the configured room number and password to access the management dashboard.
## Enterprise WeChat Notification (Not mandatory step)
Modify the qiwei array in the notify section of cfg.json and fill in the key for the Enterprise WeChat robot:
normal: Normal notification, error: System error notification.
"notify": {
"open": true, # Whether to enable Enterprise WeChat notification
"qiwei": {
"normal" : [
"key1",
"key2"
],
"error" : [
"key3",
"key4"
]
}
}
## OSS Cloud Storage (Not mandatory step)
Modify the oss section in cfg.json:
"oss": {
"seafile": {
"repoid": "",
"host": "",
"username": "account",
"password": "password"
},
"alyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
},
"txyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
},
"qiniuyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
}
}
## Chat-GPT (Not mandatory step)
Modify the openai.apiKeys in cfg.json and enter your own apiKey generated from your OpenAI account:
"openai": {
"apiKeys": [
]
}
## Docker (Not mandatory step)
### Using Official Images:
Choose either of the two image modes:
HTTP mode image:
docker pull iamtsm/tl-rtc-file-api-local
docker run --name=api-local -p 9092:9092 -e "WS_HOST=ws://127.0.0.1:8444" -d iamtsm/tl-rtc-file-api-local localapi
docker pull iamtsm/tl-rtc-file-socket-local
docker run --name=socket-local -p 8444:8444 -e "WS_HOST=ws://127.0.0.1:8444" -d iamtsm/tl-rtc-file-socket-local localsocket
HTTPS mode image:
docker pull iamtsm/tl-rtc-file-api-server
docker run --name=api-server -p 9092:9092 -e "WSS_HOST=wss://127.0.0.1:8444" -d iamtsm/tl-rtc-file-api-server serverapi
docker pull iamtsm/tl-rtc-file-socket-server
docker run --name=socket-server -p 8444:8444 -e "WSS_HOST=wss://127.0.0.1:8444" -d iamtsm/tl-rtc-file-socket-server serversocket
### Build Your Own Images:
Choose either mode and perform the respective operation:
HTTP mode startup:
Modify the configuration information in `docker/local.env` or cfg.json as needed (ws or wss must be configured with container IP and port).
2. Start TURN server:
docker-compose --profile=local up -d
`turnserver -c /full/path/to/conf/turn/turnserver-with-secret-user.conf`
Access: http://localhost:9092 or http://your-machine-ip:9092
Temporary credentials: `docker/coturn/turnserver-with-fixed-user.conf`
HTTPS mode startup:
1. Modify fields like `listening-device`, `listening-ip`, `external-ip`, `user`, `realm`.
Modify the configuration information in `docker/local.env` or cfg.json as needed (ws or wss must be configured with container IP and port).
2. Generate user credentials:
docker-compose --profile=server up -d
`turnadmin -a -u username -p password -r realm`
Access: https://localhost:9092 or https://your-machine-ip:9092
3. Start TURN server:
`turnserver -c /full/path/to/docker/coturn/turnserver-with-secret-user.conf`
After setting up coturn, configure WebRTC related information in `tlrtcfile.env`:
```ini
## webrtc-stun server address
tl_rtc_file_webrtc_stun_host=
## webrtc-turn server address
tl_rtc_file_webrtc_turn_host=
## webrtc-turn server username
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc-turn server password
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc-turn server secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc-turn server account expiration time (milliseconds)
tl_rtc_file_webrtc_turn_expire=86400000
```
## Docker
Both `official images` and `self-packaged images` are supported. Using official images allows for two modes of operation: `Docker script startup` and `Docker Compose startup`.
Different from deploying on a server/computer, the Docker environment by default starts the database and coturn service. No additional actions are needed, simply start it.
### Using Official Images (Docker Script Startup):
After modifying the `tlrtcfile.env` configuration (or using the default configuration), navigate to the `bin/` directory and run the script `auto-pull-and-start-docker.sh`:
1. `chmod +x ./auto-pull-and-start-docker.sh`
2. `./auto-pull-and-start-docker.sh`
### Using Official Images (Docker Compose Startup):
After modifying the `tlrtcfile.env` configuration (or using the default configuration), execute the following command in the main directory:
```bash
docker-compose --profile=http up -d
```
### Self-Packaged Image (Docker Compose Packaged Startup):
After modifying the `tlrtcfile.env` configuration (or using the default configuration), navigate to the `docker/` directory and execute:
```bash
docker-compose -f docker-compose-build-code.yml up -d
```
## Other Deployment Methods
In addition to the above manual installation, official Docker images, and self-packaged Docker images, it also supports fully automatic scripts. After downloading the project, you can go to the bin/ directory and choose the corresponding system script to execute.
Apart from the manual installation, Docker official images, and self-packaged images, there are also options for automatic scripts and one-click deployment on hosting platforms.
If the Linux script doesn't have permission, you can grant execute permission to the script first: `chmod +x bin/linux/*.sh`
After downloading the project, navigate to the `bin/` directory and execute the corresponding system script:
### Linux Fully Automatic Script
### ubuntu Auto Script
Choose one mode to start:
```bash
chmod +x ./ubuntu/*.sh
cd ubuntu/
./auto-check-install-http.sh # or ./auto-check-install-https.sh
```
`auto-check-install-local.sh`: Automatically check and install the node environment and automatically start the HTTP mode service.
### Windows Auto Script
`auto-check-install-server.sh`: Automatically check and install the node environment and automatically start the HTTPS mode service.
Run `windows/auto-check-install-http.bat` or `windows/auto-check-install-https.bat`.
### Windows Fully Automatic Script
### Zeabur Platform One-Click Deployment
Choose one mode to start:
`auto-check-install-local.bat`: Automatically check and install the node environment and automatically start the HTTP mode service.
`auto-check-install-server.bat`: Automatically check and install the node environment and automatically start the HTTPS mode service.
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/898TLE?referralCode=iamtsm)
## Overview Diagram
![image](doc/tl-rtc-file-tool.jpg)
![image](tl-rtc-file-tool.jpg)
## License

View File

@@ -1,41 +1,122 @@
## 用于docker-compose部署并启动官方镜像
version: '3'
services:
api-local:
profiles: ['local']
container_name: tl-rtc-file-api-local
image: iamtsm/tl-rtc-file-api-local
env_file:
- docker/local.env
ports:
- 9092:9092
command: localapi
socket-local:
profiles: ['local']
container_name: tl-rtc-file-socket-local
image: iamtsm/tl-rtc-file-socket-local
#http模式启动api服务
api-http:
profiles: ['http']
container_name: api
image: iamtsm/tl-rtc-file-api
env_file:
- docker/local.env
- ./tlrtcfile.env
environment:
- tl_rtc_file_env_mode=http
- tl_rtc_file_db_open=true
command:
- tlapi
ports:
- 8444:8444
command: localsocket
- 9092:9092
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
api-server:
profiles: ['server']
container_name: tl-rtc-file-api-server
image: iamtsm/tl-rtc-file-api-server
#https模式启动api服务
api-https:
profiles: ['https']
container_name: api
image: iamtsm/tl-rtc-file-api
env_file:
- docker/server.env
- ./tlrtcfile.env
environment:
- tl_rtc_file_env_mode=https
- tl_rtc_file_db_open=true
command:
- tlapi
ports:
- 9092:9092
command: serverapi
- 9092:9092
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
socket-server:
profiles: ['server']
container_name: tl-rtc-file-socket-server
image: iamtsm/tl-rtc-file-socket-server
#http模式启动socket服务
socket-http:
profiles: ['http']
container_name: socket
image: iamtsm/tl-rtc-file-socket
command:
- tlsocket
env_file:
- docker/server.env
- ./tlrtcfile.env
environment:
- tl_rtc_file_env_mode=http
- tl_rtc_file_db_open=true
ports:
- 8444:8444
command: serversocket
- 8444:8444
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
#https模式启动socket服务
socket-https:
profiles: ['https']
container_name: socket
image: iamtsm/tl-rtc-file-socket
command:
- tlsocket
env_file:
- ./tlrtcfile.env
environment:
- tl_rtc_file_env_mode=https
- tl_rtc_file_db_open=true
ports:
- 8444:8444
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
#mysql服务
mysql:
profiles: ['http','https']
container_name: mysql
image: iamtsm/tl-rtc-file-mysql
restart: always
env_file:
- ./docker/mysql/mysql.env
ports:
- 3306:3306
volumes:
- ./docker/mysql/data/mysql.env:/tlrtcfile/docker/mysql/mysql.env
- ./docker/mysql/data/db:/var/lib/mysql
- ./docker/mysql/data/my.cnf:/etc/mysql/conf.d/my.cnf
- ./docker/mysql/data/log:/var/log/mysql
- ./docker/mysql/data/init.sql:/docker-entrypoint-initdb.d/init.sql
#coturn服务
coturn:
profiles: ['http','https']
container_name: coturn
image: iamtsm/tl-rtc-file-coturn
env_file:
- ./docker/coturn/coturn.env
ports:
- "3478:3478/udp"
- "3478:3478/tcp"
volumes:
- ./docker/coturn/turnserver-with-secret-user.conf:/etc/turnserver.conf

View File

@@ -1,6 +1,6 @@
#!/bin/bash
pm2 start npm --name=tlsocket -- run lsocket
pm2 start npm --name=tlsocket -- run http-socket
sleep 8

View File

@@ -1,9 +0,0 @@
FROM node:lts-alpine
COPY svr /tlrtcfile/svr
WORKDIR /tlrtcfile/svr
RUN npm install --registry=https://registry.npmmirror.com && npm run build:pro
ENTRYPOINT ["node"]

1
docker/coturn/Dockerfile Normal file
View File

@@ -0,0 +1 @@
FROM coturn/coturn

View File

@@ -1 +1,5 @@
#coturn env feature use
## coturn 配置
#自动检测外网ip和中转ip
# DETECT_EXTERNAL_IP=yes
# DETECT_RELAY_IP=yes

View File

@@ -13,8 +13,8 @@ min-port=49152
min-port=55000
#cli密码
cli-password=qwerty
#后台运行
daemon
#后台运行-默认关闭 docker运行时需关闭, 自行部署时,可以开启
# daemon
#会话指纹
fingerprint
#中等详细日志

View File

@@ -13,8 +13,8 @@ min-port=49152
min-port=55000
#cli密码
cli-password=qwerty
#后台运行
daemon
#后台运行-默认关闭 docker运行时需关闭, 自行部署时,可以开启
# daemon
#会话指纹
fingerprint
#中等详细日志

View File

@@ -1,45 +1,77 @@
## build the image from the Dockerfile in the current directory
## 用于自己通过代码构建镜像并启动
version: '3'
services:
tl-rtc-file-api-local:
profiles: ['local']
env_file:
- local.env
build:
context: ../
dockerfile: ./Dockerfile
ports:
- 9092:9092
command: localapi
tl-rtc-file-socket-local:
profiles: ['local']
env_file:
- local.env
#api服务
api:
container_name: api
build:
context: ../
context: ./../
dockerfile: ./Dockerfile
env_file:
- ../tlrtcfile.env
command:
- tlapi
ports:
- 8444:8444
command: localsocket
- 9092:9092
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ../tlrtcfile.env:/tlrtcfile/tlrtcfile.env
tl-rtc-file-api-server:
profiles: ['server']
env_file:
- server.env
#socket服务
socket:
container_name: socket
build:
context: ../
context: ./../
dockerfile: ./Dockerfile
command:
- tlsocket
env_file:
- ../tlrtcfile.env
ports:
- 9092:9092
command: serverapi
- 8444:8444
links:
- mysql
depends_on:
- mysql
- coturn
volumes:
- ../tlrtcfile.env:/tlrtcfile/tlrtcfile.env
tl-rtc-file-socket-server:
profiles: ['server']
#mysql服务
mysql:
container_name: mysql
restart: always
env_file:
- server.env
- ./mysql/mysql.env
build:
context: ../
context: ./mysql/
dockerfile: ./Dockerfile
ports:
- 8444:8444
command: serversocket
- 3306:3306
volumes:
- ./mysql/data/mysql.env:/tlrtcfile/docker/mysql/mysql.env
- ./mysql/data/db:/var/lib/mysql
- ./mysql/data/my.cnf:/etc/mysql/conf.d/my.cnf
- ./mysql/data/log:/var/log/mysql
- ./mysql/data/init.sql:/docker-entrypoint-initdb.d/init.sql
#coturn服务
coturn:
container_name: coturn
env_file:
- ./coturn/coturn.env
build:
context: ./coturn/
dockerfile: ./Dockerfile
ports:
- "3478:3478/udp"
- "3478:3478/tcp"
volumes:
- ./coturn/turnserver-with-secret-user.conf:/etc/turnserver.conf

View File

@@ -1,6 +0,0 @@
ENV_MODE=local
WEBRTC_STUN_HOST=stun:stun.xten.com
WEBRTC_TURN_HOST=turn:global.turn.twilio.com:3478?transport=udp
WEBRTC_TURN_USERNAME=tlrtcfile
WEBRTC_TURN_CREDENTIAL=tlrtcfile
WS_HOST=ws://127.0.0.1:8444

1
docker/mysql/Dockerfile Normal file
View File

@@ -0,0 +1 @@
FROM mysql/mysql-server:5.7

View File

@@ -1 +1,9 @@
#mysql env feature use
#mysql env feature use
#设置root密码
MYSQL_ROOT_PASSWORD=tlrtcfile
#设置数据库
MYSQL_DATABASE=webchat
#设置用户
MYSQL_USER=tlrtcfile
MYSQL_PASSWORD=tlrtcfile

View File

@@ -1,6 +0,0 @@
ENV_MODE=server
WEBRTC_STUN_HOST=stun:stun.xten.com
WEBRTC_TURN_HOST=turn:global.turn.twilio.com:3478?transport=udp
WEBRTC_TURN_USERNAME=tlrtcfile
WEBRTC_TURN_CREDENTIAL=tlrtcfile
WSS_HOST=wss://127.0.0.1:8444

View File

@@ -1,15 +1,11 @@
{
"version": "10.3.0",
"version": "10.3.6",
"ws": {
"port": 8444,
"host": "ws://127.0.0.1:8444"
},
"wss": {
"port": 8444,
"host": "wss://域名 或者 wss://ip:8444"
"port": "请到 http.env 或者 https.env中进行配置",
"host": "请到 http.env 或者 https.env中进行配置"
},
"api": {
"port": 9092,
"port": "请到 http.env 或者 https.env中进行配置",
"router": {
"filter": {
"whiteDir": [],
@@ -18,22 +14,24 @@
]
},
"res": {
"/": "res/dist/" }
"/": "res/dist/"
}
}
},
"manage": {
"room": "tlrtcfile",
"password": "tlrtcfile"
"room": "请到 http.env 或者 https.env中进行配置",
"password": "请到 http.env 或者 https.env中进行配置"
},
"webrtc": {
"turn": {
"host": "turn服务地址",
"secret": "tl-rtc-file",
"username": "tl-rtc-file",
"credential": "tl-rtc-file"
"host": "请到 http.env 或者 https.env中进行配置",
"secret": "请到 http.env 或者 https.env中进行配置",
"username": "请到 http.env 或者 https.env中进行配置",
"credential": "请到 http.env 或者 https.env中进行配置",
"expire" : "请到 http.env 或者 https.env中进行配置"
},
"stun": {
"host": "stun:stun.xten.com"
"host": "请到 http.env 或者 https.env中进行配置"
},
"iceTransportPolicy": "all",
"options": {
@@ -42,73 +40,46 @@
}
},
"openai": {
"apiKeys": []
"keys": [ "请到 http.env 或者 https.env中进行配置" ]
},
"oss": {
"seafile": {
"repoid": "存储库id",
"host": "seafile私有网盘域名",
"username": "账号",
"password": "密码"
"repoid": "请到 http.env 或者 https.env中进行配置",
"host": "请到 http.env 或者 https.env中进行配置",
"username": "请到 http.env 或者 https.env中进行配置",
"password": "请到 http.env 或者 https.env中进行配置"
},
"alyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
"AccessKey": "请到 http.env 或者 https.env中进行配置",
"SecretKey": "请到 http.env 或者 https.env中进行配置",
"bucket": "请到 http.env 或者 https.env中进行配置"
},
"txyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
"AccessKey": "请到 http.env 或者 https.env中进行配置",
"SecretKey": "请到 http.env 或者 https.env中进行配置",
"bucket": "请到 http.env 或者 https.env中进行配置"
},
"qiniuyun": {
"AccessKey": "",
"SecretKey": "",
"bucket": "tl-rtc-file"
"AccessKey": "请到 http.env 或者 https.env中进行配置",
"SecretKey": "请到 http.env 或者 https.env中进行配置",
"bucket": "请到 http.env 或者 https.env中进行配置"
}
},
"notify": {
"open": false,
"open": "请到 http.env 或者 https.env中进行配置",
"qiwei": {
"normal": [
"填写企业微信机器人key"
],
"error": [
"填写企业微信机器人key"
]
"normal": [ "请到 http.env 或者 https.env中进行配置" ],
"error": [ "请到 http.env 或者 https.env中进行配置" ]
}
},
"db": {
"open": false,
"open": "请到 http.env 或者 https.env中进行配置",
"mysql": {
"host": "host地址",
"port": 3306,
"dbName": "数据库名称",
"user": "用户名",
"password": "密码",
"other": {
"sequelize": {
"dialect": "mysql",
"host": "host地址",
"port": 3306,
"logging": false,
"pool": {
"max": 5,
"min": 0,
"acquire": 30000,
"idle": 10000
},
"timezone": "+08:00",
"define": {
"freezeTableName": true,
"underscored": true,
"charset": "utf8",
"collate": "utf8_general_ci",
"timestamps": false,
"paranoid": true
}
}
}
"host": "请到 http.env 或者 https.env中进行配置",
"port": "请到 http.env 或者 https.env中进行配置",
"dbName": "请到 http.env 或者 https.env中进行配置",
"user": "请到 http.env 或者 https.env中进行配置",
"password": "请到 http.env 或者 https.env中进行配置"
}
}
}

View File

@@ -1,23 +1,74 @@
const inject_env_config = (conf) => {
Object.keys(process.env).filter(key => /^(WS(S)?_|API_|WEBRTC_).+/.test(key)).map(key => {
let data = process.env[key]
if (key.endsWith('_PORT')) {
data = parseInt(data)
const path = require("path");
const dotEnv = require("dotenv");
/**
* 从.env文件中加载环境变量
* docker环境下使用docker-compose.yml中指定的env逻辑不使用主动加载的.env文件中的环境变量
* docker环境下使用docker run 中指定的 -e 逻辑,不使用主动加载的.env文件中的环境变量
* 非docker环境下使用.env文件中的环境变量
*/
const load_env_config = function(){
if(process.env.tl_rtc_file_node_load_env === 'false'){
return
}
const pathsEnv = path.resolve(__dirname, "../../")
dotEnv.config({ path: `${pathsEnv}/tlrtcfile.env` })
console.log(`load env config from .env file ${pathsEnv}/tlrtcfile.env`)
}
/**
* 从环境变量中注入配置
* 1. 适配容器环境
* 2. 数据格式转换
* 3. 统一管理
* defaultConfJson : conf/cfg.json
* @param {object} defaultConfJson 配置对象
*/
const inject_env_config = function (defaultConfJson) {
Object.keys(process.env).filter( key => key.startsWith("tl_rtc_file_") ).map(key => {
let value = process.env[key]
key = key.replace("tl_rtc_file_","")
//端口相关的配置转换为数字
if (key.endsWith('_port')) {
value = parseInt(value)
}
let curr = conf;
const paths = key.split('_').map(p => p.toLowerCase())
//过期时间相关的配置转换为数字
if(key.endsWith("_expire")){
value = parseInt(value)
}
//开关相关的配置转换为boolean
if (key.endsWith('_open')) {
value = value === 'true'
}
//openai keys转换为数组
if(key === 'openai_keys'){
value = value.split(',')
}
//企业微信通知 keys转换为数组
if(key === 'notify_qiwei_normal' || key === 'notify_qiwei_error'){
value = value.split(',')
}
let curr = defaultConfJson;
const paths = key.split('_');
const last = paths.pop()
for (const path of paths) {
curr = curr[path]
}
if (curr) {
console.log(`config ${paths.join('.')}.${last} to ${data}`);
curr[last] = data
// console.log(`config inject ${paths.join('.')}.${last} to ${value}`)
curr[last] = value
}
})
return conf
return defaultConfJson
}
module.exports = {
inject_env_config
inject_env_config,
load_env_config
}

View File

@@ -1,53 +0,0 @@
const express = require("express");
const { inject_env_config } = require("./conf/env_config");
const conf = inject_env_config(require("./conf/cfg.json"));
const fileApiRouters = require("./src/controller/router")();
const db = require("./src/tables/db"); //db
const utils = require("./src/utils/utils");
const resRouter = conf.api.router.res;
//打印logo
utils.tlConsoleIcon()
let app = express();
utils.tlConsole("api init start ...")
if (!conf.db.open) {// 没开db
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = {};
req.ctx.dbClient = {};
await next();
})
//res
for (let key in resRouter) app.use(key, express.static(resRouter[key]));
//file api
for (let key in fileApiRouters) app.use(key, fileApiRouters[key])
app.listen(conf.api.port);
utils.tlConsole("express init done ...")
utils.tlConsole("api server runing on ", conf.api.port, " successful")
} else { // 开了db
(async () => {
let { tables, dbClient } = await db.excute(conf)
utils.tlConsole("db init done ...")
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = tables;
req.ctx.dbClient = dbClient;
await next();
})
//res
for (let key in resRouter) app.use(key, express.static(resRouter[key]));
//file api
for (let key in fileApiRouters) app.use(key, fileApiRouters[key])
app.listen(conf.api.port);
utils.tlConsole("express init done ...")
utils.tlConsole("api server runing on ", conf.api.port, " successful")
})();
}

View File

@@ -1,30 +0,0 @@
const http = require('http'); // http
const socketIO = require('socket.io'); //socket
const db = require("./src/tables/db"); //db
const { inject_env_config } = require("./conf/env_config");
const conf = inject_env_config(require("./conf/cfg.json")); //conf
const socket = require("./src/socket/index") //socket handler
const utils = require("./src/utils/utils");
//打印logo
utils.tlConsoleIcon()
// Socket连接监听
let io = socketIO.listen(http.createServer().listen(conf.ws.port));
if (!conf.db.open) {// 没开db
utils.tlConsole("db not open ...")
socket.excute({}, {}, io);
utils.tlConsole("socket init done ...")
utils.tlConsole("socket server listen on ", conf.ws.port, " successful");
} else { // 开了db
(async () => {
let { tables, dbClient } = await db.excute(conf)
utils.tlConsole("db init done ...")
socket.excute(tables, dbClient, io);
utils.tlConsole("socket init done ...")
utils.tlConsole("socket server listen on ", conf.ws.port, " successful");
})();
}

524
svr/package-lock.json generated
View File

@@ -11,8 +11,9 @@
"dependencies": {
"@grpc/grpc-js": "^1.8.0",
"@grpc/proto-loader": "^0.6.0",
"@zilliz/milvus2-sdk-node": "^2.2.19",
"concurrently": "^8.2.0",
"cross-env": "^5.2.0",
"dotenv": "^16.3.1",
"express": "^4.17.1",
"glob": "^10.3.1",
"google-protobuf": "^3.0.0",
@@ -29,22 +30,15 @@
"vite": "^4.3.9"
}
},
"node_modules/@colors/colors": {
"version": "1.5.0",
"resolved": "https://registry.npmmirror.com/@colors/colors/-/colors-1.5.0.tgz",
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
"engines": {
"node": ">=0.1.90"
}
},
"node_modules/@dabh/diagnostics": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz",
"integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
"node_modules/@babel/runtime": {
"version": "7.22.6",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.22.6.tgz",
"integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==",
"dependencies": {
"colorspace": "1.1.x",
"enabled": "2.0.x",
"kuler": "^2.0.0"
"regenerator-runtime": "^0.13.11"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@esbuild/android-arm": {
@@ -751,143 +745,11 @@
"resolved": "https://registry.npmmirror.com/@types/node/-/node-20.4.0.tgz",
"integrity": "sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g=="
},
"node_modules/@types/triple-beam": {
"version": "1.3.2",
"resolved": "https://registry.npmmirror.com/@types/triple-beam/-/triple-beam-1.3.2.tgz",
"integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g=="
},
"node_modules/@types/validator": {
"version": "13.7.17",
"resolved": "https://registry.npmmirror.com/@types/validator/-/validator-13.7.17.tgz",
"integrity": "sha512-aqayTNmeWrZcvnG2MG9eGYI6b7S5fl+yKgPs6bAjOTwPS316R5SxBGKvtSExfyoJU7pIeHJfsHI0Ji41RVMkvQ=="
},
"node_modules/@zilliz/milvus2-sdk-node": {
"version": "2.2.19",
"resolved": "https://registry.npmmirror.com/@zilliz/milvus2-sdk-node/-/milvus2-sdk-node-2.2.19.tgz",
"integrity": "sha512-kKlQpic5ceVr7OQ0rg+AWHsMUcfoRvzn7BWKPutzU+Sst8cDbLiEaDcSaSR9gUchISBsKh7WwQ7WqK0rYpSYWA==",
"dependencies": {
"@grpc/grpc-js": "^1.8.17",
"@grpc/proto-loader": "^0.7.7",
"dayjs": "^1.11.7",
"lru-cache": "^9.1.2",
"protobufjs": "^7.2.4",
"winston": "^3.9.0"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/@grpc/proto-loader": {
"version": "0.7.8",
"resolved": "https://registry.npmmirror.com/@grpc/proto-loader/-/proto-loader-0.7.8.tgz",
"integrity": "sha512-GU12e2c8dmdXb7XUlOgYWZ2o2i+z9/VeACkxTA/zzAe2IjclC5PnVL0lpgjhrqfpDYHzM8B1TF6pqWegMYAzlA==",
"dependencies": {
"@types/long": "^4.0.1",
"lodash.camelcase": "^4.3.0",
"long": "^4.0.0",
"protobufjs": "^7.2.4",
"yargs": "^17.7.2"
},
"bin": {
"proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmmirror.com/cliui/-/cliui-8.0.1.tgz",
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.1",
"wrap-ansi": "^7.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/lru-cache": {
"version": "9.1.2",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-9.1.2.tgz",
"integrity": "sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==",
"engines": {
"node": "14 || >=16.14"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"dependencies": {
"cliui": "^8.0.1",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.1.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@zilliz/milvus2-sdk-node/node_modules/yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
"engines": {
"node": ">=12"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
@@ -1005,11 +867,6 @@
"node": ">=0.8"
}
},
"node_modules/async": {
"version": "3.2.4",
"resolved": "https://registry.npmmirror.com/async/-/async-3.2.4.tgz",
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
@@ -1268,15 +1125,6 @@
"node": ">=10"
}
},
"node_modules/color": {
"version": "3.2.1",
"resolved": "https://registry.npmmirror.com/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"dependencies": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
@@ -1293,42 +1141,11 @@
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/color-string": {
"version": "1.9.1",
"resolved": "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz",
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"dependencies": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"node_modules/color/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
},
"node_modules/colorette": {
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/colorette/-/colorette-1.4.0.tgz",
"integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g=="
},
"node_modules/colorspace": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/colorspace/-/colorspace-1.1.4.tgz",
"integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==",
"dependencies": {
"color": "^3.1.3",
"text-hex": "1.0.x"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -1365,6 +1182,117 @@
"resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/concurrently": {
"version": "8.2.0",
"resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-8.2.0.tgz",
"integrity": "sha512-nnLMxO2LU492mTUj9qX/az/lESonSZu81UznYDoXtz1IQf996ixVqPAgHXwvHiHCAef/7S8HIK+fTFK7Ifk8YA==",
"dependencies": {
"chalk": "^4.1.2",
"date-fns": "^2.30.0",
"lodash": "^4.17.21",
"rxjs": "^7.8.1",
"shell-quote": "^1.8.1",
"spawn-command": "0.0.2",
"supports-color": "^8.1.1",
"tree-kill": "^1.2.2",
"yargs": "^17.7.2"
},
"bin": {
"conc": "dist/bin/concurrently.js",
"concurrently": "dist/bin/concurrently.js"
},
"engines": {
"node": "^14.13.0 || >=16.0.0"
}
},
"node_modules/concurrently/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/concurrently/node_modules/cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmmirror.com/cliui/-/cliui-8.0.1.tgz",
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.1",
"wrap-ansi": "^7.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/concurrently/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"node_modules/concurrently/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/concurrently/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/concurrently/node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/concurrently/node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"dependencies": {
"cliui": "^8.0.1",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.1.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/concurrently/node_modules/yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
"engines": {
"node": ">=12"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -1443,10 +1371,16 @@
"node": ">=0.10"
}
},
"node_modules/dayjs": {
"version": "1.11.9",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.9.tgz",
"integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA=="
"node_modules/date-fns": {
"version": "2.30.0",
"resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-2.30.0.tgz",
"integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
"dependencies": {
"@babel/runtime": "^7.21.0"
},
"engines": {
"node": ">=0.11"
}
},
"node_modules/debug": {
"version": "2.6.9",
@@ -1516,6 +1450,14 @@
"node": ">=8"
}
},
"node_modules/dotenv": {
"version": "16.3.1",
"resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
"engines": {
"node": ">=12"
}
},
"node_modules/dottie": {
"version": "2.0.6",
"resolved": "https://registry.npmmirror.com/dottie/-/dottie-2.0.6.tgz",
@@ -1545,11 +1487,6 @@
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
},
"node_modules/enabled": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/enabled/-/enabled-2.0.0.tgz",
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
},
"node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-1.0.2.tgz",
@@ -1786,11 +1723,6 @@
"reusify": "^1.0.4"
}
},
"node_modules/fecha": {
"version": "4.2.3",
"resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz",
"integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw=="
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
@@ -1839,11 +1771,6 @@
"flat": "cli.js"
}
},
"node_modules/fn.name": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/fn.name/-/fn.name-1.1.0.tgz",
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.2.tgz",
@@ -2284,11 +2211,6 @@
"node": ">= 0.10"
}
},
"node_modules/is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.2.tgz",
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz",
@@ -2356,14 +2278,6 @@
"resolved": "https://registry.npmmirror.com/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g=="
},
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"engines": {
"node": ">=8"
}
},
"node_modules/is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/is-typedarray/-/is-typedarray-1.0.0.tgz",
@@ -2459,11 +2373,6 @@
"node": ">=0.6.0"
}
},
"node_modules/kuler": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz",
"integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/locate-path/-/locate-path-6.0.0.tgz",
@@ -2497,24 +2406,6 @@
"node": ">=10"
}
},
"node_modules/logform": {
"version": "2.5.1",
"resolved": "https://registry.npmmirror.com/logform/-/logform-2.5.1.tgz",
"integrity": "sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==",
"dependencies": {
"@colors/colors": "1.5.0",
"@types/triple-beam": "^1.3.2",
"fecha": "^4.2.0",
"ms": "^2.1.1",
"safe-stable-stringify": "^2.3.1",
"triple-beam": "^1.3.0"
}
},
"node_modules/logform/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/long": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/long/-/long-4.0.0.tgz",
@@ -2865,14 +2756,6 @@
"wrappy": "1"
}
},
"node_modules/one-time": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/one-time/-/one-time-1.0.0.tgz",
"integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==",
"dependencies": {
"fn.name": "1.x.x"
}
},
"node_modules/openai": {
"version": "3.3.0",
"resolved": "https://registry.npmmirror.com/openai/-/openai-3.3.0.tgz",
@@ -3125,19 +3008,6 @@
"node": ">= 0.8"
}
},
"node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz",
@@ -3149,6 +3019,11 @@
"node": ">=8.10.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmmirror.com/request/-/request-2.88.2.tgz",
@@ -3261,19 +3136,19 @@
"queue-microtask": "^1.2.2"
}
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"node_modules/safe-stable-stringify": {
"version": "2.4.3",
"resolved": "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz",
"integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==",
"engines": {
"node": ">=10"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
@@ -3480,6 +3355,11 @@
"node": ">=0.10.0"
}
},
"node_modules/shell-quote": {
"version": "1.8.1",
"resolved": "https://registry.npmmirror.com/shell-quote/-/shell-quote-1.8.1.tgz",
"integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA=="
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz",
@@ -3498,14 +3378,6 @@
"node": ">=14"
}
},
"node_modules/simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
"dependencies": {
"is-arrayish": "^0.3.1"
}
},
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/slash/-/slash-3.0.0.tgz",
@@ -3639,6 +3511,11 @@
"source-map": "^0.6.0"
}
},
"node_modules/spawn-command": {
"version": "0.0.2",
"resolved": "https://registry.npmmirror.com/spawn-command/-/spawn-command-0.0.2.tgz",
"integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ=="
},
"node_modules/sqlstring": {
"version": "2.3.3",
"resolved": "https://registry.npmmirror.com/sqlstring/-/sqlstring-2.3.3.tgz",
@@ -3671,14 +3548,6 @@
"node": ">=0.10.0"
}
},
"node_modules/stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmmirror.com/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==",
"engines": {
"node": "*"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.1.tgz",
@@ -3687,14 +3556,6 @@
"node": ">= 0.8"
}
},
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz",
@@ -3813,11 +3674,6 @@
"node": ">=10"
}
},
"node_modules/text-hex": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/text-hex/-/text-hex-1.0.0.tgz",
"integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="
},
"node_modules/tl-ngrpc": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tl-ngrpc/-/tl-ngrpc-1.0.1.tgz",
@@ -3869,14 +3725,19 @@
"node": ">=0.8"
}
},
"node_modules/triple-beam": {
"version": "1.4.1",
"resolved": "https://registry.npmmirror.com/triple-beam/-/triple-beam-1.4.1.tgz",
"integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==",
"engines": {
"node": ">= 14.0.0"
"node_modules/tree-kill": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"bin": {
"tree-kill": "cli.js"
}
},
"node_modules/tslib": {
"version": "2.6.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.6.1.tgz",
"integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig=="
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmmirror.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@@ -3929,11 +3790,6 @@
"punycode": "^2.1.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz",
@@ -4042,40 +3898,6 @@
"which": "bin/which"
}
},
"node_modules/winston": {
"version": "3.10.0",
"resolved": "https://registry.npmmirror.com/winston/-/winston-3.10.0.tgz",
"integrity": "sha512-nT6SIDaE9B7ZRO0u3UvdrimG0HkB7dSTAgInQnNR2SOPJ4bvq5q79+pXLftKmP52lJGW15+H5MCK0nM9D3KB/g==",
"dependencies": {
"@colors/colors": "1.5.0",
"@dabh/diagnostics": "^2.0.2",
"async": "^3.2.3",
"is-stream": "^2.0.0",
"logform": "^2.4.0",
"one-time": "^1.0.0",
"readable-stream": "^3.4.0",
"safe-stable-stringify": "^2.3.1",
"stack-trace": "0.0.x",
"triple-beam": "^1.3.0",
"winston-transport": "^4.5.0"
},
"engines": {
"node": ">= 12.0.0"
}
},
"node_modules/winston-transport": {
"version": "4.5.0",
"resolved": "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.5.0.tgz",
"integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==",
"dependencies": {
"logform": "^2.3.2",
"readable-stream": "^3.6.0",
"triple-beam": "^1.3.0"
},
"engines": {
"node": ">= 6.4.0"
}
},
"node_modules/wkx": {
"version": "0.5.0",
"resolved": "https://registry.npmmirror.com/wkx/-/wkx-0.5.0.tgz",

View File

@@ -4,14 +4,13 @@
"description": "webrtc, p2p, file, screen, video, live, draw, chat",
"main": "main.js",
"scripts": {
"lapi": "cross-env ENV_MODE=local node localapi",
"lsocket": "cross-env ENV_MODE=local node localsocket",
"sapi": "cross-env ENV_MODE=server node serverapi",
"ssocket": "cross-env ENV_MODE=server node serversocket",
"http-api": "cross-env tl_rtc_file_env_mode=http node tlapi",
"http-socket": "cross-env tl_rtc_file_env_mode=http node tlsocket",
"https-api": "cross-env tl_rtc_file_env_mode=https node tlapi",
"https-socket": "cross-env tl_rtc_file_env_mode=https node tlsocket",
"test": "cross-env mocha ./test/test.js",
"build:dev": "vite build --watch",
"build:pro": "vite build",
"build:vercel": "cross-env concurrently \"npm run build:pro\" \"npm run lapi\" \"npm run lsocket\""
"build:pro": "vite build"
},
"repository": {
"type": "git",
@@ -27,6 +26,7 @@
"@grpc/proto-loader": "^0.6.0",
"concurrently": "^8.2.0",
"cross-env": "^5.2.0",
"dotenv": "^16.3.1",
"express": "^4.17.1",
"glob": "^10.3.1",
"google-protobuf": "^3.0.0",

View File

@@ -1,64 +0,0 @@
const express = require("express");
const fs = require('fs');
const https = require('https');
const { inject_env_config } = require("./conf/env_config");
const conf = inject_env_config(require("./conf/cfg.json"));
const fileApiRouters = require("./src/controller/router")();
const db = require("./src/tables/db");
const utils = require("./src/utils/utils");
const resRouter = conf.api.router.res;
//打印logo
utils.tlConsoleIcon()
let app = express();
utils.tlConsole("api init start ...")
if (!conf.db.open) {// 没开db
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = {};
req.ctx.dbClient = {};
await next();
})
//res
for(let key in resRouter) app.use(key,express.static(resRouter[key]));
//file api
for(let key in fileApiRouters) app.use(key,fileApiRouters[key])
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
https.createServer(options,app).listen(conf.api.port);
utils.tlConsole("express init done ...")
utils.tlConsole("api server runing on ", conf.api.port, " successful");
} else {// 开了db
(async () => {
let { tables, dbClient } = await db.excute(conf)
utils.tlConsole("db init done ...")
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = tables;
req.ctx.dbClient = dbClient;
await next();
})
//res
for(let key in resRouter) app.use(key,express.static(resRouter[key]));
//file api
for(let key in fileApiRouters) app.use(key,fileApiRouters[key])
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
https.createServer(options,app).listen(conf.api.port);
utils.tlConsole("express init done ...")
utils.tlConsole("api server runing on ", conf.api.port, " successful");
})();
}

View File

@@ -1,38 +0,0 @@
const https = require('https');
const socketIO = require('socket.io');
const fs = require('fs');
const db = require("./src/tables/db");
const { inject_env_config } = require("./conf/env_config");
const conf = inject_env_config(require("./conf/cfg.json"));
const socket = require("./src/socket/index")
const utils = require("./src/utils/utils");
//打印logo
utils.tlConsoleIcon()
//Socket连接监听
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
let io = socketIO.listen(
https.createServer(options).listen(conf.wss.port)
);
if (!conf.db.open) {// 没开db
utils.tlConsole("db not open ...")
socket.excute({}, {}, io);
utils.tlConsole("socket init done ...")
utils.tlConsole("socket server listen on ", conf.wss.port, " successful");
} else {// 开了db
(async () => {
let { tables, dbClient } = await db.excute(conf)
utils.tlConsole("db init done ...")
socket.excute(tables, dbClient, io);
utils.tlConsole("socket init done ...")
utils.tlConsole("socket server listen on ", conf.wss.port, " successful");
})();
}

View File

@@ -1,5 +1,6 @@
const daoDog = require("./../../dao/dog/dog")
const cfg = require("../../../conf/cfg.json");
const { inject_env_config } = require("../../../conf/env_config");
const cfg = inject_env_config(require("../../../conf/cfg.json"));
const dbOpen = cfg.db.open
/**

View File

@@ -1,5 +1,6 @@
const daoRoom = require("./../../dao/room/room")
const cfg = require("../../../conf/cfg.json");
const {inject_env_config} = require("../../../conf/env_config")
const cfg = inject_env_config(require("../../../conf/cfg.json"));
const dbOpen = cfg.db.open
/**

View File

@@ -1,6 +1,7 @@
const daoRoom = require("./../../dao/room/room")
const cfg = require("../../../conf/cfg.json");
const dbOpen = cfg.db.open
const {inject_env_config} = require("../../../conf/env_config")
const cfg = inject_env_config(require("../../../conf/cfg.json"));
const dbOpen = cfg.db.open
/**
* 获取设置房间页面

View File

@@ -1,4 +1,5 @@
const conf = require("../../../conf/cfg.json");
const {inject_env_config} = require("../../../conf/env_config");
const conf = inject_env_config(require("../../../conf/cfg.json"));
const request = require('request');
const qiweiNormal = conf.notify.qiwei.normal;
const qiweiError = conf.notify.qiwei.error;

View File

@@ -80,8 +80,7 @@ function setApiKeyStatus( key ){
function getApiKey( roomId ){
// init
if(Object.keys(keysMap).length === 0){
let apiKeys = openai.apiKeys;
apiKeys.forEach((key)=>{
openai.keys.forEach((key)=>{
keysMap[key] = {
used : 0
}

View File

@@ -2,7 +2,8 @@ const aly = require('./aly');
const tx = require('./tx');
const qiniu = require('./qiniu');
const seafile = require('./seafile');
const cfg = require('./../../../conf/cfg.json');
const {inject_env_config} = require("./../../../conf/env_config");
const cfg = inject_env_config(require('./../../../conf/cfg.json'));
const oss = {
aly,

View File

@@ -4,7 +4,8 @@
*/
const request = require('request');
const seafile = require('../../../conf/cfg.json').oss.seafile
const {inject_env_config} = require("../../../conf/env_config");
const seafile = inject_env_config(require('../../../conf/cfg.json')).oss.seafile
/**
* 获取token

View File

@@ -1,5 +1,6 @@
const utils = require("../../utils/utils");
const conf = require("../../../conf/cfg.json");
const {inject_env_config} = require("../../../conf/env_config")
const conf = inject_env_config(require("../../../conf/cfg.json"));
const webrtcConf = conf.webrtc;
/**
@@ -16,7 +17,7 @@ function initData(req, res) {
//ice服务器配置
const iceServers = utils.genTurnServerIceServersConfig(openTurn, useSecret, "tlrtcfile");
if(process.env.ENV_MODE === 'local'){
if(process.env.tl_rtc_file_env_mode === 'http'){
let regexIP = /^((?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d))$/;
let ip = utils.getLocalIP();
@@ -36,11 +37,11 @@ function initData(req, res) {
};
res.json(data)
}else if(process.env.ENV_MODE === 'server'){
}else{
let data = {
version : conf.version,
wsHost: conf.wss.host,
wsHost: conf.ws.host,
rtcConfig: { iceServers },
options: webrtcConf.options,
logo : utils.genClientLogo(),

View File

@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const cfg = require("../../conf/cfg.json");
const {inject_env_config} = require("../../conf/env_config");
const cfg = inject_env_config(require("../../conf/cfg.json"));
const utils = require("../../src/utils/utils");
module.exports = () => {

View File

@@ -1,5 +1,6 @@
const utils = require("../../utils/utils");
const dbOpen = require("../../../conf/cfg.json").db.open;
const {inject_env_config} = require("../../../conf/env_config")
const dbOpen = inject_env_config(require("../../../conf/cfg.json")).db.open;
/**

View File

@@ -1,4 +1,5 @@
const cfg = require("../../../conf/cfg.json");
const {inject_env_config} = require("../../../conf/env_config");
const cfg = inject_env_config(require("../../../conf/cfg.json"));
const sequelizeObj = require('sequelize');
const utils = require("../../utils/utils");
const dbOpen = cfg.db.open;

View File

@@ -1,6 +1,7 @@
const utils = require("../../utils/utils");
const cfg = require("../../../conf/cfg.json")
const {inject_env_config} = require("../../../conf/env_config");
const cfg = inject_env_config(require("../../../conf/cfg.json"))
const manageConfig = cfg.manage;
const dbOpen = cfg.db.open;

View File

@@ -2,7 +2,8 @@ const daoRoom = require("./../../dao/room/room")
const bussinessNotify = require("./../../bussiness/notify/notifyHandler")
const rtcCount = require("./../rtcCount/count");
const utils = require("./../../utils/utils");
const cfg = require("./../../../conf/cfg.json")
const {inject_env_config} = require("./../../../conf/env_config");
const cfg = inject_env_config(require("./../../../conf/cfg.json"))
const rtcConstant = require("../rtcConstant");
const rtcClientEvent = rtcConstant.rtcClientEvent
const check = require("../../bussiness/check/content");
@@ -114,7 +115,7 @@ async function userCreateAndJoin(io, socket, tables, dbClient, data){
}
//流媒体房间只允许两个人同时在线
if((type === 'screen' || type === 'video') && numClients >= 4){
if((type === 'screen' || type === 'video') && numClients >= 2){
socket.emit(rtcClientEvent.tips, {
room : data.room,
to : socket.id,

View File

@@ -3,7 +3,8 @@ const bussinessManageRoomPage = require("./../../bussiness/manage/roomPage")
const bussinessManageSettingPage = require("./../../bussiness/manage/settingPage")
const bussinessNotify = require("./../../bussiness/notify/notifyHandler")
const utils = require("./../../utils/utils");
const cfg = require("./../../../conf/cfg.json")
const {inject_env_config} = require("./../../../conf/env_config");
const cfg = inject_env_config(require("./../../../conf/cfg.json"))
const manageConfig = cfg.manage
const rtcConstant = require("../rtcConstant");
const rtcClientEvent = rtcConstant.rtcClientEvent

View File

@@ -4,7 +4,8 @@ const bussinessManageSettingPage = require("./../../bussiness/manage/settingPage
const bussinessNotify = require("./../../bussiness/notify/notifyHandler")
const rtcConfirm = require("./confirm");
const utils = require("./../../utils/utils");
const cfg = require("./../../../conf/cfg.json")
const {inject_env_config} = require("./../../../conf/env_config");
const cfg = inject_env_config(require("./../../../conf/cfg.json"))
const manageConfig = cfg.manage
const rtcConstant = require("../rtcConstant");
const rtcClientEvent = rtcConstant.rtcClientEvent

View File

@@ -1,45 +1,81 @@
const sequelizeObj = require('sequelize');
const fs = require('fs');
const utils = require("../../src/utils/utils");
//db connect retry times
let connectRetryTimes = 0;
async function excute(config) {
let dbConf = config.db.mysql;
let dbClient = new sequelizeObj(dbConf.dbName, dbConf.user, dbConf.password, dbConf.other.sequelize);
try {
let connect = await dbClient.authenticate();
utils.tlConsole('db connect ok ... ');
} catch (e) {
utils.tlConsole('db connect err ...', e);
}
let dbClient = new sequelizeObj(
dbConf.dbName,
dbConf.user,
dbConf.password,
{
"dialect": "mysql",
"host": dbConf.host,
"port": dbConf.port,
"logging": false,
"pool": {
"max": 5,
"min": 0,
"acquire": 30000,
"idle": 10000
},
"timezone": "+08:00",
"define": {
"freezeTableName": true,
"underscored": true,
"charset": "utf8",
"collate": "utf8_general_ci",
"timestamps": false,
"paranoid": true
}
}
);
let tables = {}
let files = fs.readdirSync(__dirname);
for (let f of files) {
if (f[0] == '.' || f == 'db.js') continue;
async function connectDb(){
try {
let fn = require('./' + f);
if (typeof fn == 'function') {
let ms = fn(dbClient, sequelizeObj);
for (let k in ms) {
tables[k] = ms[k];
let connect = await dbClient.authenticate();
utils.tlConsole('db connect ok ... ');
let files = fs.readdirSync(__dirname);
for (let f of files) {
if (f[0] == '.' || f == 'db.js') continue;
try {
let fn = require('./' + f);
if (typeof fn == 'function') {
let ms = fn(dbClient, sequelizeObj);
for (let k in ms) {
tables[k] = ms[k];
}
}
} catch (e) {
utils.tlConsole(e);
}
}
try {
await dbClient.sync({ force: false });
utils.tlConsole("db sync ok ...");
} catch (e) {
utils.tlConsole("db sync err : ",e);
}
} catch (e) {
utils.tlConsole(e);
if(connectRetryTimes++ < 8){
utils.tlConsole('db connect err, retrying ... ',e.message);
await new Promise(resolve => setTimeout(resolve, connectRetryTimes * 3000));
await connectDb();
return;
}
utils.tlConsole('db connect err ',e);
}
}
try {
let res = await dbClient.sync({
force: false
});
utils.tlConsole("db sync ok ...");
} catch (e) {
utils.tlConsole("db sync err : ",e);
}
await connectDb();
return {
tables,

View File

@@ -1,5 +1,6 @@
const os = require('os');
const cfg = require('./../../conf/cfg.json');
const { inject_env_config } = require('./../../conf/env_config');
const cfg = inject_env_config(require('./../../conf/cfg.json'));
const crypto = require('crypto');
/**
@@ -210,7 +211,7 @@ function genTurnServerIceServersConfig(withTurn, useSecret, username){
// 有效账号模式
const secret = cfg.webrtc.turn.secret;
//生成账号的有效期
const expirseTime = 60 * 60 * 24 * 1000;
const expirseTime = cfg.webrtc.turn.expire;
//当前时间
const time = new Date().getTime();
//turn服务的用户名规则

62
svr/tlapi.js Normal file
View File

@@ -0,0 +1,62 @@
const express = require("express");
const { inject_env_config, load_env_config } = require("./conf/env_config");
//加载环境变量
load_env_config();
//加载环境变量完毕后,注入配置
const conf = inject_env_config(require("./conf/cfg.json"));
const fileApiRouters = require("./src/controller/router")();
const db = require("./src/tables/db"); //db
const utils = require("./src/utils/utils");
const fs = require('fs');
const https = require('https');
const resRouter = conf.api.router.res;
//打印logo
utils.tlConsoleIcon()
async function start() {
let app = express();
utils.tlConsole("api init start ...")
if (!conf.db.open) {// 没开db
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = {};
req.ctx.dbClient = {};
await next();
})
utils.tlConsole("db not open ...")
}else{
let { tables, dbClient } = await db.excute(conf)
app.use(async function (req, res, next) {
req.ctx = {};
req.ctx.tables = tables;
req.ctx.dbClient = dbClient;
await next();
})
utils.tlConsole("db init done ...")
}
//res
for (let key in resRouter) app.use(key, express.static(resRouter[key]));
//file api
for (let key in fileApiRouters) app.use(key, fileApiRouters[key])
//start server
if(process.env.tl_rtc_file_env_mode === 'http'){
app.listen(conf.api.port);
}else {
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
https.createServer(options,app).listen(conf.api.port);
}
utils.tlConsole("express init done ...")
utils.tlConsole("api ",process.env.tl_rtc_file_env_mode," server runing on ", conf.api.port, " successful")
}
start();

47
svr/tlsocket.js Normal file
View File

@@ -0,0 +1,47 @@
const http = require('http'); // http
const https = require('https');
const socketIO = require('socket.io');
const fs = require('fs');
const db = require("./src/tables/db"); //db
const { inject_env_config, load_env_config } = require("./conf/env_config");
//加载环境变量
load_env_config();
//加载环境变量完毕后,注入配置
const conf = inject_env_config(require("./conf/cfg.json")); //conf
const socket = require("./src/socket/index") //socket handler
const utils = require("./src/utils/utils");
//打印logo
utils.tlConsoleIcon()
async function start(){
// Socket连接监听
let io = null;
if(process.env.tl_rtc_file_env_mode == 'http'){
io = socketIO.listen(http.createServer().listen(conf.ws.port));
}else{
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
io = socketIO.listen(
https.createServer(options).listen(conf.ws.port)
);
}
if (!conf.db.open) {// 没开db
socket.excute({}, {}, io);
utils.tlConsole("db not open ...")
} else { // 开了db
let { tables, dbClient } = await db.excute(conf)
socket.excute(tables, dbClient, io);
utils.tlConsole("db init done ...")
}
utils.tlConsole("socket init done ...")
utils.tlConsole("socket ",process.env.tl_rtc_file_env_mode," server listen on ", conf.ws.port, " successful");
}
start();

89
tlrtcfile.env Normal file
View File

@@ -0,0 +1,89 @@
#-----------------以下为基础配置-----------------#
## api服务端口
tl_rtc_file_api_port=9092
## websocket服务端口
tl_rtc_file_ws_port=8444
## websocket服务地址
tl_rtc_file_ws_host=ws://127.0.0.1:8444
#-----------------以下为webrtc相关配置-----------------#
## webrtc-stun中继服务地址
tl_rtc_file_webrtc_stun_host=stun:127.0.0.1:3478
## webrtc-turn中继服务地址
tl_rtc_file_webrtc_turn_host=turn:127.0.0.1:3478?transport=udp
## webrtc中继服务用户名
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc中继服务密码
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc中继服务Secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc中继服务帐号过期时间 (毫秒)
tl_rtc_file_webrtc_turn_expire=86400000
#-----------------以下为mysql数据库相关配置-----------------#
## 是否开启数据库
tl_rtc_file_db_open=false
## 数据库地址
tl_rtc_file_db_mysql_host=mysql
## 数据库端口
tl_rtc_file_db_mysql_port=3306
## 数据库名称
tl_rtc_file_db_mysql_dbName=webchat
## 数据库用户名
tl_rtc_file_db_mysql_user=tlrtcfile
## 数据库密码
tl_rtc_file_db_mysql_password=tlrtcfile
#-----------------以下为oss相关配置-----------------#
## oss-seafile存储库ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile地址
tl_rtc_file_oss_seafile_host=
## oss-seafile用户名
tl_rtc_file_oss_seafile_username=
## oss-seafile密码
tl_rtc_file_oss_seafile_password=
## oss-alyun存储accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-aly存储SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-aly存储bucket
tl_rtc_file_oss_alyun_bucket=
## oss-txyun存储accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyunt存储SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun存储bucket
tl_rtc_file_oss_txyun_bucket=
## oss-qiniuyun存储accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyunt存储SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey=
## oss-qiniuyun存储bucket
tl_rtc_file_oss_qiniuyun_bucket=
#-----------------以下为管理后台相关配置-----------------#
## 管理后台房间号
tl_rtc_file_manage_room=tlrtcfile
## 管理后台密码
tl_rtc_file_manage_password=tlrtcfile
# #-----------------以下为openai相关配置-----------------#
# ## openai-key如果有多个key逗号分隔
tl_rtc_file_openai_keys=
# #-----------------以下为企业微信通知相关配置-----------------#
# ## 企业微信通知开关
tl_rtc_file_notify_open=false
## 企业微信通知机器人KEY正常通知如果有多个key逗号分隔
tl_rtc_file_notify_qiwei_normal=
## 企业微信通知机器人KEY错误通知如果有多个key逗号分隔
tl_rtc_file_notify_qiwei_error=