开源在线文件传输-tl-rtc-file
tl-rtc-file是一款p2p网页在线文件传输开源工具。基于webrtc协议,遵守MIT开源协议。tl-rtc-file跨终端,支持多操作系统平台,内网不限速,支持私有部署,支持多文件拖拽发送,支持本地屏幕录制,远程屏幕共享,远程音视频通话,密码房间,直播,oss云存储,中继服务设置,webrtc检测,统计,文字传输,公共聊天,远程画板,丰富的后台管理,实时执行日志展示,机器人告警通知等功能。

准备 (必须步骤)
安装node-14.x或14.x以上,npm后进入项目目录运行下面命令
`cd svr/`
`npm install`
首次运行/自行开发页面,需要启动下面两个命令之一
`npm run build:dev` (打包监听文件改动打包min) 或者  `npm run build:pro` 打包min
启动 (必须步骤)
启动以下两个服务, 选一种模式启动即可
http模式
api服务: `npm run lapi`
socket服务 : `npm run lsocket`
https模式
api服务: `npm run sapi`
socket服务 : `npm run ssocket`
配置websocket (必须步骤)
修改cfg.json中相应ws配置,或者wss配置
"ws": {
      "port": 8444,                         #socket 端口
      "host": "ws://127.0.0.1:8444",        #socket ip
 },
 "wss" : {
      "port": 8444,
      "host": "wss://域名||ip:port",
 },
配置数据库 (非必须步骤)
修改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
                }
            }
        }
    }
}
配置turnserver (局域网非必须步骤,公网必须步骤)
ubuntu示例:
安装coturn  `sudo apt-get install coturn`
项目提供了一份配置文件模板在 : `conf/turn/turnserver.conf`
修改配置文件后复制一份  `cp conf/turn/turnserver.conf /etc/turnserver.conf`
示例用户和密码: tlrtcfile
生成用户 (turnadmin生成密码)  `turnadmin -k -u tlrtcfile -r 你的域名`
或者 (自定义密码)  `turnadmin -a -u tlrtcfile -p tlrtcfile -r 你的域名`
启动turnserver  `turnserver -c /etc/turnserver.conf`
可参考示例模板 : `bin/turnStart.sh`
Docker (非必须步骤)
按需配置conf.json中的ws, 或者wss (需要填容器的ip,端口信息)
docker build -t tl-open-source/tl-rtc-file .
docker run -p 9092:9092 -p 8444:8444 --name tl-rtc-file-local -d tl-open-source/tl-rtc-file
访问 : http://localhost:9092 或者 http://本机ip:9092
管理后台 (非必须步骤)
前提 : 需要开启数据库配置
修改cfg.json中的manage的room和password,默认房间号和密码都是tlrtcfile
访问 : http://localhost:9092 或者 http://本机ip:9092
输入配置的房间号,输入密码,即可进入管理后台
"manage": {
	"room": "tlrtcfile",
	"password": "tlrtcfile"
},
Demo:im.iamtsm.cn/home.html
源码:https://github.com/tl-open-source/tl-rtc-file

发表回复