无法显示?也许可以帮到您:
20 |1.1 如使用本演示网站/开源项目,即表示您已同意本条款。我们 (开源项目维护团队) 始终在不断更改和改进我们的服务。我们可能会增加或删除功能,也可能暂停或彻底停止某项服务。您可以随时停止使用我们的服务,我们也可以随时对我们的服务增加新的限制。
38 |1.2 该网站/开源项目的使用者在使用本演示网站/开源项目前,应仔细阅读以下条款并同意遵守。使用本演示网站/开源项目将被视为对本免责协议的接受和遵守。
39 | 40 |2.1 本演示网站/开源项目旨在帮助大家学习webrtc,提供一个学习/演示demo环境,和基础功能代码入门教学
42 |2.2 本网站/开源项目提供的服务旨在为用户提供数据传输功能演示,包括但不限于文件传输、直播、音视频通话、远程屏幕共享、聊天等功能的演示。
43 |2.3 使用者应理解,本演示网站/开源项目仅提供技术支持演示,不对数据传输的准确性、及时性、完整性、安全性或合法性负责。使用者应自行承担使用本演示网站/开源项目的风险。
44 | 45 |3.1 使用者应承担使用本演示网站/开源项目的全部责任和风险。对于使用者通过本演示网站/开源项目进行的任何操作、行为或后果,本网站/开源项目不承担任何责任。
47 |3.2 使用者不得利用本演示网站/开源项目进行任何违法、侵权、威胁、诽谤、骚扰、破坏性或其他不当行为。若使用者违反上述规定,本网站/开源项目有权立即终止或限制使用者的访问权限。
48 |3.3 本网站使用者严禁上传违法违规内容,包括但不限于:色情低俗、政治敏感、、暴力、恶意软件、诈骗、贩卖公民隐私,上传上述内容将永久封禁账号或 IP 地址,并可能承担承担刑事责任。
49 | 50 |4.1 本网站/开源项目不对任何由于使用本演示网站/开源项目而引起的任何直接、间接、附带、特殊、惩罚性或后续的损害承担责任,包括但不限于利润损失、商业中断、计算机系统故障、数据丢失或其他经济损失。
52 |4.2 本网站/开源项目不对任何第三方通过本演示网站/开源项目发布、提供或传输的任何内容的准确性、合法性、安全性或可靠性负责。
53 | 54 |本免责协议适用于使用本网站/开源项目的所有用户,无论其身份或目的。该免责协议的内容适用于因使用本演示网站/开源项目而产生的一切事项,包括但不限于使用的内容、服务或信息所引起的任何纠纷、损失或损害。
56 | 57 | 58 | -------------------------------------------------------------------------------- /svr/src/bussiness/cache/scan/scanCache.js: -------------------------------------------------------------------------------- 1 | const { StateKey, InfoKey, CookieKey } = require("../key"); 2 | const cache = require("../cache"); 3 | 4 | /** 5 | * 设置扫码状态 : 五分钟 6 | * @param {*} key 7 | * @param {*} value 8 | */ 9 | const setScanState = (key, value) => { 10 | cache.setShortTimeCache(StateKey.SCAN_STATE_KEY + key, value); 11 | } 12 | 13 | /** 14 | * 获取扫码状态 : 五分钟 15 | * @param {*} key 16 | * @returns 17 | * 'scan': 已扫码 18 | * 'auth_succ': 授权成功 19 | * 'auth_fail': 授权失败 20 | * '' 21 | * */ 22 | const getScanState = (key) => { 23 | return cache.getShortTimeCache(StateKey.SCAN_STATE_KEY + key) || ""; 24 | } 25 | 26 | /** 27 | * 设置登录状态 : 一小时 28 | * @param {*} key 29 | * @param {*} value 30 | * @returns 31 | * */ 32 | const setTokenState = (key, value) => { 33 | cache.setLongTimeCache(StateKey.TOKEN_STATE_KEY + key, value); 34 | } 35 | 36 | /** 37 | * 获取登录状态 : 一小时 38 | * @param {*} key 39 | * @returns 40 | * { 41 | * token : token 42 | * } 43 | * */ 44 | const getTokenState = (key) => { 45 | return cache.getLongTimeCache(StateKey.TOKEN_STATE_KEY + key) || ""; 46 | } 47 | 48 | 49 | /** 50 | * 获取登录信息 : 一小时 51 | * @param {*} key 52 | * @returns 53 | * { 54 | * openId : openId, 55 | * loginTime: loginTime 56 | * } 57 | * */ 58 | const getLoginInfo = (key) => { 59 | return cache.getLongTimeCache(InfoKey.LOGIN_INFO_KEY + key) || {}; 60 | } 61 | 62 | 63 | /** 64 | * 设置登录信息 : 一小时 65 | * @param {*} key 66 | * @param {*} value 67 | * @returns 68 | * */ 69 | const setLoginInfo = (key, value) => { 70 | cache.setLongTimeCache(InfoKey.LOGIN_INFO_KEY + key, value); 71 | } 72 | 73 | 74 | /** 75 | * 获取用户信息 : 一天 76 | * @param {*} key 77 | * @returns 78 | * { 79 | * id: id, 80 | * openid: openid, 81 | * avatar: userInfo.avatarUrl, 82 | * uname: userInfo.nickName, 83 | * ... 84 | * } 85 | */ 86 | const getUserInfo = (key) => { 87 | return cache.getDayTimeCache(InfoKey.USER_INFO_KEY + key) || {}; 88 | } 89 | 90 | /** 91 | * 设置用户信息 : 一天 92 | * @param {*} key 93 | * @param {*} value 94 | */ 95 | const setUserInfo = (key, value) => { 96 | cache.setDayTimeCache(InfoKey.USER_INFO_KEY + key, value); 97 | } 98 | 99 | 100 | module.exports = { 101 | setScanState, getScanState, 102 | setTokenState, getTokenState, 103 | setLoginInfo, getLoginInfo, 104 | setUserInfo, getUserInfo 105 | } -------------------------------------------------------------------------------- /svr/conf/cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "10.5.2", 3 | "socket": { 4 | "port": "请到 tlrtcfile.env 中进行配置", 5 | "host": "请到 tlrtcfile.env 中进行配置" 6 | }, 7 | "api": { 8 | "port": "请到 tlrtcfile.env 中进行配置", 9 | "router": { 10 | "filter": { 11 | "whiteDir": [], 12 | "whiteFile": [ 13 | "router.js" 14 | ] 15 | }, 16 | "res" : { 17 | "/": "web-res/dist/" 18 | } 19 | } 20 | }, 21 | "login": { 22 | "appId" : "请到 tlrtcfile.env 中进行配置", 23 | "appSecret" : "请到 tlrtcfile.env 中进行配置", 24 | "token" : { 25 | "url" : "请到 tlrtcfile.env 中进行配置", 26 | "key" : "请到 tlrtcfile.env 中进行配置" 27 | } 28 | }, 29 | "manage": { 30 | "room": "请到 tlrtcfile.env 中进行配置", 31 | "password": "请到 tlrtcfile.env 中进行配置" 32 | }, 33 | "webrtc": { 34 | "turn": { 35 | "host": "请到 tlrtcfile.env 中进行配置", 36 | "secret": "请到 tlrtcfile.env 中进行配置", 37 | "username": "请到 tlrtcfile.env 中进行配置", 38 | "credential": "请到 tlrtcfile.env 中进行配置", 39 | "expire" : "请到 tlrtcfile.env 中进行配置" 40 | }, 41 | "stun": { 42 | "host": "请到 tlrtcfile.env 中进行配置" 43 | }, 44 | "iceTransportPolicy": "all", 45 | "options": { 46 | "offerToReceiveAudio": 1, 47 | "offerToReceiveVideo": 1 48 | } 49 | }, 50 | "openai": { 51 | "keys": [ "请到 tlrtcfile.env 中进行配置" ] 52 | }, 53 | "oss": { 54 | "seafile": { 55 | "repoid": "请到 tlrtcfile.env 中进行配置", 56 | "host": "请到 tlrtcfile.env 中进行配置", 57 | "username": "请到 tlrtcfile.env 中进行配置", 58 | "password": "请到 tlrtcfile.env 中进行配置" 59 | }, 60 | "alyun": { 61 | "AccessKey": "请到 tlrtcfile.env 中进行配置", 62 | "SecretKey": "请到 tlrtcfile.env 中进行配置", 63 | "bucket": "请到 tlrtcfile.env 中进行配置" 64 | }, 65 | "txyun": { 66 | "AccessKey": "请到 tlrtcfile.env 中进行配置", 67 | "SecretKey": "请到 tlrtcfile.env 中进行配置", 68 | "bucket": "请到 tlrtcfile.env 中进行配置" 69 | }, 70 | "qiniuyun": { 71 | "AccessKey": "请到 tlrtcfile.env 中进行配置", 72 | "SecretKey": "请到 tlrtcfile.env 中进行配置", 73 | "bucket": "请到 tlrtcfile.env 中进行配置" 74 | } 75 | }, 76 | "notify": { 77 | "open": "请到 tlrtcfile.env 中进行配置", 78 | "qiwei": { 79 | "normal": [ "请到 tlrtcfile.env 中进行配置" ], 80 | "error": [ "请到 tlrtcfile.env 中进行配置" ] 81 | } 82 | }, 83 | "db": { 84 | "open": "请到 tlrtcfile.env 中进行配置", 85 | "mysql": { 86 | "host": "请到 tlrtcfile.env 中进行配置", 87 | "port": "请到 tlrtcfile.env 中进行配置", 88 | "dbName": "请到 tlrtcfile.env 中进行配置", 89 | "user": "请到 tlrtcfile.env 中进行配置", 90 | "password": "请到 tlrtcfile.env 中进行配置" 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /svr/web-res/pay.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |QQ : 1905333456
48 |GitHub:https://github.com/iamtsm
49 | 50 |根据项目的复杂性和工作量,具体的交付时间将在项目定制阶段与客户协商确定,一般会在预估的时间内,如有延期会提前告知。
79 | 80 |此收费标准仅限开发功能,以及交付上线收取的费用,不包括后期维护以及后续功能迭代。
82 | 83 | 84 | -------------------------------------------------------------------------------- /svr/src/socket/rtcExit/exit.js: -------------------------------------------------------------------------------- 1 | const daoRoom = require("./../../dao/room/room") 2 | const bussinessNotify = require("./../../bussiness/notify/notifyHandler") 3 | const rtcCount = require("./../rtcCount/count"); 4 | const utils = require("./../../utils/utils"); 5 | const rtcConstant = require("../rtcConstant"); 6 | const rtcClientEvent = rtcConstant.rtcClientEvent; 7 | const rtcLocalNetRoom = require("../rtcLocalNetRoom/localNetRoom"); 8 | 9 | /** 10 | * 退出房间 11 | * @param {*} io socketio对象 12 | * @param {*} socket 单个socket连接 13 | * @param {*} tables 数据表对象 14 | * @param {*} dbClient sequelize-orm对象 15 | * @param {*} data event参数 16 | * @returns 17 | */ 18 | async function exit(io, socket, tables, dbClient, data){ 19 | try { 20 | let room = data.room; 21 | 22 | socket.leave(room); 23 | 24 | clientsInRoom = io.sockets.adapter.rooms[room]; 25 | if (clientsInRoom) { 26 | let otherSocketIds = Object.keys(clientsInRoom.sockets); 27 | for (let i = 0; i < otherSocketIds.length; i++) { 28 | let otherSocket = io.sockets.connected[otherSocketIds[i]]; 29 | otherSocket.emit(rtcClientEvent.exit, data); 30 | } 31 | } 32 | 33 | let recoderId = data.recoderId; 34 | if (recoderId != undefined) { 35 | await daoRoom.exitRoomBySid({ socket_id: socket.id },tables, dbClient) 36 | 37 | let {handshake, userAgent, ip} = utils.getSocketClientInfo(socket); 38 | 39 | bussinessNotify.sendExitRoomNotify({ 40 | title: "退出房间", 41 | room: data.room, 42 | socketId: socket.id, 43 | recoderId: data.recoderId, 44 | userAgent: userAgent, 45 | ip: ip 46 | }) 47 | } 48 | 49 | rtcCount.count(io, socket, tables, dbClient, data); 50 | 51 | //局域网房间变动通知 52 | rtcLocalNetRoom.localNetRoomForExit(io, socket, tables, dbClient, { room }); 53 | 54 | } catch (e) { 55 | socket.emit(rtcClientEvent.tips, { 56 | room: data.room, 57 | to: socket.id, 58 | msg: "系统错误" 59 | }); 60 | bussinessNotify.sendSystemErrorMsg({ 61 | title: "socket-exit", 62 | data: JSON.stringify(data), 63 | room: data.room, 64 | from : socket.id, 65 | msg : JSON.stringify({ 66 | message: e.message, 67 | fileName: e.fileName, 68 | lineNumber: e.lineNumber, 69 | stack: e.stack, 70 | name: e.name 71 | }, null, '\t') 72 | }) 73 | } 74 | } 75 | 76 | module.exports = { 77 | exit 78 | } -------------------------------------------------------------------------------- /tlrtcfile.env: -------------------------------------------------------------------------------- 1 | #-----------------以下为基础配置-----------------# 2 | ## api服务端口 3 | tl_rtc_file_api_port=9092 4 | ## websocket服务端口 5 | tl_rtc_file_socket_port=8444 6 | ## websocket服务地址 7 | tl_rtc_file_socket_host=127.0.0.1:8444 8 | 9 | 10 | #-----------------以下为webrtc相关配置-----------------# 11 | ## webrtc-stun中继服务地址 12 | tl_rtc_file_webrtc_stun_host=stun:127.0.0.1:3478 13 | ## webrtc-turn中继服务地址 14 | tl_rtc_file_webrtc_turn_host=turn:127.0.0.1:3478?transport=udp 15 | ## webrtc中继服务用户名 16 | tl_rtc_file_webrtc_turn_username=tlrtcfile 17 | ## webrtc中继服务密码 18 | tl_rtc_file_webrtc_turn_credential=tlrtcfile 19 | ## webrtc中继服务Secret 20 | tl_rtc_file_webrtc_turn_secret=tlrtcfile 21 | ## webrtc中继服务帐号过期时间 (毫秒) 22 | tl_rtc_file_webrtc_turn_expire=86400000 23 | 24 | 25 | #-----------------以下为mysql数据库相关配置-----------------# 26 | ## 是否开启数据库 27 | tl_rtc_file_db_open=false 28 | ## 数据库地址 29 | tl_rtc_file_db_mysql_host=mysql 30 | ## 数据库端口 31 | tl_rtc_file_db_mysql_port=3306 32 | ## 数据库名称 33 | tl_rtc_file_db_mysql_dbName=webchat 34 | ## 数据库用户名 35 | tl_rtc_file_db_mysql_user=tlrtcfile 36 | ## 数据库密码 37 | tl_rtc_file_db_mysql_password=tlrtcfile 38 | 39 | #-----------------以下为oss相关配置-----------------# 40 | ## oss-seafile存储库ID 41 | tl_rtc_file_oss_seafile_repoid= 42 | ## oss-seafile地址 43 | tl_rtc_file_oss_seafile_host= 44 | ## oss-seafile用户名 45 | tl_rtc_file_oss_seafile_username= 46 | ## oss-seafile密码 47 | tl_rtc_file_oss_seafile_password= 48 | 49 | ## oss-alyun存储accessKey 50 | tl_rtc_file_oss_alyun_AccessKey= 51 | ## oss-aly存储SecretKey 52 | tl_rtc_file_oss_alyun_Secretkey= 53 | ## oss-aly存储bucket 54 | tl_rtc_file_oss_alyun_bucket= 55 | 56 | ## oss-txyun存储accessKey 57 | tl_rtc_file_oss_txyun_AccessKey= 58 | ## oss-txyunt存储SecretKey 59 | tl_rtc_file_oss_txyun_Secretkey= 60 | ## oss-txyun存储bucket 61 | tl_rtc_file_oss_txyun_bucket= 62 | 63 | ## oss-qiniuyun存储accessKey 64 | tl_rtc_file_oss_qiniuyun_AccessKey= 65 | ## oss-qiniuyunt存储SecretKey 66 | tl_rtc_file_oss_qiniuyun_Secretkey= 67 | ## oss-qiniuyun存储bucket 68 | tl_rtc_file_oss_qiniuyun_bucket= 69 | 70 | 71 | #-----------------以下为管理后台相关配置-----------------# 72 | ## 管理后台房间号 73 | tl_rtc_file_manage_room=tlrtcfile 74 | ## 管理后台密码 75 | tl_rtc_file_manage_password=tlrtcfile 76 | 77 | 78 | #-----------------以下为openai相关配置-----------------# 79 | ## openai-key,如果有多个key,逗号分隔 80 | tl_rtc_file_openai_keys= 81 | 82 | 83 | #-----------------以下为企业微信通知相关配置-----------------# 84 | ## 企业微信通知开关 85 | tl_rtc_file_notify_open=false 86 | ## 企业微信通知机器人KEY,正常通知,如果有多个key,逗号分隔 87 | tl_rtc_file_notify_qiwei_normal= 88 | ## 企业微信通知机器人KEY,错误通知,如果有多个key,逗号分隔 89 | tl_rtc_file_notify_qiwei_error= 90 | 91 | 92 | #-----------------以下为微信小程序授权登录相关配置-----------------# 93 | ## appId 94 | tl_rtc_file_login_appId= 95 | ## appSecret 96 | tl_rtc_file_login_appSecret= 97 | ## token url 98 | tl_rtc_file_login_token_url=http://127.0.0.1:9092 99 | ## token api key 100 | tl_rtc_file_login_token_key=tlrtcfile --------------------------------------------------------------------------------