diff --git a/docker-compose-with-all-env.yml b/docker-compose-with-all-env.yml new file mode 100644 index 0000000..caa841b --- /dev/null +++ b/docker-compose-with-all-env.yml @@ -0,0 +1,184 @@ +## !!!!!!用于docker-compose部署并启动官方镜像!!!!!! +## !!!!!!内置配置的形式启动!!!!!!!!!!!!!!!!!!!!!!! + +version: '3' + +################## 按需修改好配置 +x-tlrtcfile-env: &tlrtcfile-env + ## api服务端口 + tl_rtc_file_api_port: 9092 + ## websocket服务端口 + tl_rtc_file_socket_port: 8444 + ## websocket服务地址 + tl_rtc_file_socket_host: 127.0.0.1:8444 + ## 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 + ## 是否开启数据库 + tl_rtc_file_db_open: true + ## 数据库地址 + 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-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-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: + + +services: + + #http模式启动api服务 + api-http: + profiles: ['http'] + image: iamtsm/tl-rtc-file-api + container_name: api + environment: + <<: *tlrtcfile-env + tl_rtc_file_env_mode: http + command: + - tlapi + ports: + - 9092:9092 + links: + - mysql + depends_on: + - mysql + - coturn + + #https模式启动api服务 + api-https: + profiles: ['https'] + image: iamtsm/tl-rtc-file-api + container_name: api + environment: + <<: *tlrtcfile-env + tl_rtc_file_env_mode: https + command: + - tlapi + ports: + - 9092:9092 + links: + - mysql + depends_on: + - mysql + - coturn + + #http模式启动socket服务 + socket-http: + profiles: ['http'] + image: iamtsm/tl-rtc-file-socket + container_name: socket + command: + - tlsocket + environment: + <<: *tlrtcfile-env + tl_rtc_file_env_mode: http + ports: + - 8444:8444 + links: + - mysql + depends_on: + - mysql + - coturn + + #https模式启动socket服务 + socket-https: + profiles: ['https'] + image: iamtsm/tl-rtc-file-socket + container_name: socket + command: + - tlsocket + environment: + <<: *tlrtcfile-env + tl_rtc_file_env_mode: https + ports: + - 8444:8444 + links: + - mysql + depends_on: + - mysql + - coturn + + #mysql服务 + mysql: + profiles: ['http','https'] + image: iamtsm/tl-rtc-file-mysql + container_name: mysql + restart: always + environment: + #设置root密码 + MYSQL_ROOT_PASSWORD: tlrtcfile + #设置数据库 + MYSQL_DATABASE: webchat + #设置用户 + MYSQL_USER: tlrtcfile + #设置用户密码 + MYSQL_PASSWORD: tlrtcfile + ports: + - 3306:3306 + volumes: + - ./db:/var/lib/mysql + - ./my.cnf:/etc/mysql/conf.d/my.cnf + - ./log:/var/log/mysql + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + + #coturn服务 + coturn: + profiles: ['http','https'] + image: iamtsm/tl-rtc-file-coturn + container_name: coturn + ports: + - "3478:3478/udp" + - "3478:3478/tcp" + volumes: + - ./turnserver-with-secret-user.conf:/etc/turnserver.conf \ No newline at end of file diff --git a/svr/conf/cfg.json b/svr/conf/cfg.json index 9c62bc4..c78f0f9 100644 --- a/svr/conf/cfg.json +++ b/svr/conf/cfg.json @@ -1,5 +1,5 @@ { - "version": "10.4.5", + "version": "10.4.6", "socket": { "port": "请到 tlrtcfile.env 中进行配置", "host": "请到 tlrtcfile.env 中进行配置" diff --git a/svr/res/css/index.css b/svr/res/css/index.css index cf36284..5cd0d0a 100644 --- a/svr/res/css/index.css +++ b/svr/res/css/index.css @@ -258,7 +258,6 @@ body { .tl-rtc-file-user { padding: 10px 20px 0px 10px; cursor: pointer; - background-color: rgb(248, 253, 255); border-radius: 10px; box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 3px; transition: box-shadow 0.3s; @@ -1081,7 +1080,6 @@ body { user-select: none; } - .chating_input_body{ bottom: 0px; position: absolute; @@ -1111,7 +1109,6 @@ body { border-radius: 5px; } - .remote_user_info{ text-align: left; padding: 20px 20px 0 20px; @@ -1142,7 +1139,7 @@ body { max-width: 40px; width: 5% !important; margin-left: 50% !important; - } +} .tl-rtc-file-tool-mobile { padding: 5px !important; @@ -1157,7 +1154,7 @@ body { word-break: keep-all !important; margin: 0 !important; bottom: 0 !important; - -webkit-transform-origin-x: 0 !important; + -webkit-transform-origin-x: 0 !important; transform: scale(0.6) !important; -webkit-transform: scale(0.6) !important; } @@ -1167,18 +1164,18 @@ body { margin: 10px 20px; border-radius: 8px; cursor: pointer; - transition: all 0.5s; + transition: all 0.3s; font-weight: bold; - color: #595252e3; + color: black; } .tl-rtc-file-live-user-choose svg{ - font-size: 3rem; + font-size: 2rem; margin-bottom: 5px; } .tl-rtc-file-live-user-choose:hover{ - color: black; + color: #79b0e8; } /* 500px以下 */ diff --git a/svr/res/index.html b/svr/res/index.html index 18a2736..bcaa55c 100644 --- a/svr/res/index.html +++ b/svr/res/index.html @@ -330,11 +330,13 @@
-
-
- +
+
+
+ +
【{{roomTypeName}}】- @@ -1035,13 +1037,18 @@
-
+
+ +
+
-
+
-
+
+
+ +
{{changeLiveShareMediaTrackAndStreamTime}}
-
+
-
+
-
+
文件传输通知 - ${data.title}` + + ` - ${data.room}\n` + + `库记录ID: ${data.recoderId}\n` + + `旧的昵称: ${data.oldNickName}\n` + + `新的昵称: ${data.nickName}\n` + + `当前时间: ${utils.formateDateTime(new Date(), "yyyy-MM-dd hh:mm:ss")}\n` + + `访问IP: ${data.ip}\n` + + `访问设备: ${data.userAgent}\n`; + notify.requestMsg(notifyMsg) +} + + /** * 发送文本内容通知 * @param {*} data @@ -507,5 +524,6 @@ module.exports = { prepareCodeFileNotify, sendSystemErrorMsg, sendStartRemoteDrawNotify, - sendStopRemoteDrawNotify + sendStopRemoteDrawNotify, + sendChangeNickNameNotify } \ No newline at end of file diff --git a/svr/src/socket/connect.js b/svr/src/socket/connect.js index be6aaa2..8fc9fc2 100644 --- a/svr/src/socket/connect.js +++ b/svr/src/socket/connect.js @@ -15,6 +15,8 @@ const rtcChatingRoom = require("./rtcChatingRoom/chatingRoom"); const rtcOpenai = require("./rtcOpenai/openai"); const rtcDraw = require("./rtcDraw/draw"); const rtcPrepareCodeFile = require("./rtcCodeFile/prepareCodeFile"); +const rtcChangeNickName = require("./rtcChangeNickName/changeNickName") +const rtcHeartbeat = require("./rtcHeartbeat/heartbeat"); const rtcAddCodeFile = require("./rtcCodeFile/addCodeFile"); const rtcGetCodeFile = require("./rtcCodeFile/getCodeFile"); const rtcServerEvent = require("./rtcConstant").rtcServerEvent @@ -118,4 +120,14 @@ module.exports = (io, socket, tables, dbClient) => { socket.on(rtcServerEvent.getCodeFile, (data) => { rtcGetCodeFile.getCodeFile(io, socket, tables, dbClient, data) }); + + // 心跳 + socket.on(rtcServerEvent.heartbeat, (data) => { + rtcHeartbeat.heartbeat(io, socket, tables, dbClient, data) + }); + + // 修改昵称 + socket.on(rtcServerEvent.changeNickName, (data) => { + rtcChangeNickName.changeNickName(io, socket, tables, dbClient, data) + }); } \ No newline at end of file diff --git a/svr/src/socket/rtcChangeNickName/changeNickName.js b/svr/src/socket/rtcChangeNickName/changeNickName.js new file mode 100644 index 0000000..165cb91 --- /dev/null +++ b/svr/src/socket/rtcChangeNickName/changeNickName.js @@ -0,0 +1,105 @@ +const daoDog = require("./../../dao/dog/dog") +const bussinessNotify = require("./../../bussiness/notify/notifyHandler") +const utils = require("./../../utils/utils"); +const rtcConstant = require("../rtcConstant"); +const rtcClientEvent = rtcConstant.rtcClientEvent +const check = require("../../bussiness/check/content"); + +/** + * 房间内更新昵称 + * 指定了to : 就会发送给指定的用户 + * 没有指定to : 广播给除了自己外的房间内的所有用户 + * @param {*} io socketio对象 + * @param {*} socket 单个socket连接 + * @param {*} tables 数据表对象 + * @param {*} dbClient sequelize-orm对象 + * @param {*} data event参数 + * @returns + */ +async function changeNickName(io, socket, tables, dbClient, data){ + try { + let {handshake, userAgent, ip} = utils.getSocketClientInfo(socket); + + let { nickName = '', preNickName = ''} = data; + + if(nickName && nickName.length > 10){ + nickName = nickName.toString().substr(0, 9); + } + + await daoDog.addDogData({ + name: "修改个人昵称", + roomId: data.room || "", + socketId: "", + device: userAgent, + flag: 0, + content: JSON.stringify(data), + handshake: JSON.stringify(handshake), + ip: ip + }, tables, dbClient); + + data.nickName = check.contentFilter(nickName); + + bussinessNotify.sendChangeNickNameNotify({ + title: "修改个人昵称", + room: data.room, + nickName: data.nickName, + preNickName: preNickName, + userAgent: userAgent, + ip: ip + }) + + //更新下服务端存下的昵称 + io.sockets.connected[socket.id].nickName = nickName; + + // 指定发送 + if(data.to && data.to !== ''){ + let toOtherSocket = io.sockets.connected[data.to]; + if(toOtherSocket){ + toOtherSocket.emit(rtcClientEvent.chatingRoom, data); + } + return + } + + // 没指定,走广播(除了自己) + let clientsInRoom = io.sockets.adapter.rooms[data.room]; + if (!clientsInRoom) { + return + } + let otherSocketIds = Object.keys(clientsInRoom.sockets); + for (let i = 0; i < otherSocketIds.length; i++) { + if(data.from === otherSocketIds[i]){ //跳过自己 + continue; + } + let otherSocket = io.sockets.connected[otherSocketIds[i]]; + if(!otherSocket){ + continue; + } + otherSocket.emit(rtcClientEvent.changeNickName, data); + } + + } catch (e) { + utils.tlConsole(e) + socket.emit("tips", { + room: data.room, + to: socket.id, + msg: "系统错误" + }); + bussinessNotify.sendSystemErrorMsg({ + title: "socket-changeNickName", + data: JSON.stringify(data), + room: data.room, + from : socket.id, + msg : JSON.stringify({ + message: e.message, + fileName: e.fileName, + lineNumber: e.lineNumber, + stack: e.stack, + name: e.name + }, null, '\t') + }) + } +} + +module.exports = { + changeNickName +} \ No newline at end of file diff --git a/svr/src/socket/rtcConstant.js b/svr/src/socket/rtcConstant.js index 03895da..e434ab9 100644 --- a/svr/src/socket/rtcConstant.js +++ b/svr/src/socket/rtcConstant.js @@ -44,6 +44,10 @@ const rtcServerEvent = { addCodeFile : "addCodeFile", //获取取件码文件 getCodeFile : "getCodeFile", + //心跳 + heartbeat : "heartbeat", + //修改昵称 + changeNickName : "changeNickName", } /** @@ -124,6 +128,10 @@ let rtcClientEvent = { addCodeFile : "addCodeFile", //获取取件码文件 getCodeFile : "getCodeFile", + //心跳 + heartbeat : "heartbeat", + //修改昵称 + changeNickName : "changeNickName", } /** diff --git a/svr/src/socket/rtcHeartbeat/heartbeat.js b/svr/src/socket/rtcHeartbeat/heartbeat.js new file mode 100644 index 0000000..09e9c03 --- /dev/null +++ b/svr/src/socket/rtcHeartbeat/heartbeat.js @@ -0,0 +1,26 @@ +const rtcConstant = require("../rtcConstant"); +const rtcClientEvent = rtcConstant.rtcClientEvent +const utils = require("../../../src/utils/utils"); + +/** + * 心跳 + * @param {*} io socketio对象 + * @param {*} socket 单个socket连接 + * @param {*} tables 数据表对象 + * @param {*} dbClient sequelize-orm对象 + * @param {*} data event参数 + * @returns + */ +async function heartbeat(io, socket, tables, dbClient, data){ + try{ + socket.emit(rtcClientEvent.heartbeat, { + status : "ok" + }) + }catch(e){ + utils.tlConsole(e) + } +} + +module.exports = { + heartbeat +} \ No newline at end of file diff --git a/svr/static/layui/font-ext/demo_index.html b/svr/static/layui/font-ext/demo_index.html index a3e98ce..12a2c2e 100644 --- a/svr/static/layui/font-ext/demo_index.html +++ b/svr/static/layui/font-ext/demo_index.html @@ -54,6 +54,24 @@
    +
  • + +
    相机反转
    +
    &#xe6de;
    +
  • + +
  • + +
    奖杯7-3
    +
    &#xe6bc;
    +
  • + +
  • + +
    奖杯
    +
    &#xe6ea;
    +
  • +
  • 老师
    @@ -708,9 +726,9 @@
    @font-face {
       font-family: 'iconfont';
    -  src: url('iconfont.woff2?t=1692323109723') format('woff2'),
    -       url('iconfont.woff?t=1692323109723') format('woff'),
    -       url('iconfont.ttf?t=1692323109723') format('truetype');
    +  src: url('iconfont.woff2?t=1692448975663') format('woff2'),
    +       url('iconfont.woff?t=1692448975663') format('woff'),
    +       url('iconfont.ttf?t=1692448975663') format('truetype');
     }
     

    第二步:定义使用 iconfont 的样式

    @@ -736,6 +754,33 @@
      +
    • + +
      + 相机反转 +
      +
      .icon-rtc-file-xiangjifanzhuan +
      +
    • + +
    • + +
      + 奖杯7-3 +
      +
      .icon-rtc-file-jiangbei- +
      +
    • + +
    • + +
      + 奖杯 +
      +
      .icon-rtc-file-jiangbei +
      +
    • +
    • @@ -1717,6 +1762,30 @@
        +
      • + +
        相机反转
        +
        #icon-rtc-file-xiangjifanzhuan
        +
      • + +
      • + +
        奖杯7-3
        +
        #icon-rtc-file-jiangbei-
        +
      • + +
      • + +
        奖杯
        +
        #icon-rtc-file-jiangbei
        +
      • +