feat: 目录结构优化重整

feat: 支持单独发送文件
feat: 支持文本私聊
feat: 支持seafile网盘暂存文件
feat: 支持直播房间
feat: 支持取件码下载文件
feat: 支持预览视频文件
feat: 支持报错告警
feat: 调整补充启动logo
feat: 调整补充免责协议
feat: 调整补充配置中的版本号
feat: 调整优化开源协议
feat: 调整补充定制收费服务
feat: 调整优化服务端代码
feat: 调整优化批量发送逻辑
feat: 调整优化样式体验
feat: 调整优化conf中ws, manage相关配置
feat: 调整优化文件发送时间间隔为1秒钟
feat: 调整优化文件发送体验
feat: 调整优化选择文件逻辑
feat: 调整优化启动文件/命令
feat: 调整优化socket配置区分
feat: 调整优化分享进入房间
feat: 调整优化右上角消息提示
feat: 调整删除npm依赖
feat: 调整删除首次弹窗
feat: 即将支持远程cavas画笔
feat: 即将支持远程控制
This commit is contained in:
https://blog.iamtsm.cn
2023-06-02 00:16:39 +08:00
parent 46fe2724fd
commit 69a43cce7d
166 changed files with 12487 additions and 18016 deletions

View File

@@ -0,0 +1,116 @@
const rtcConstant = require("../rtcConstant");
const rtcClientEvent = rtcConstant.rtcClientEvent
const daoDog = require("./../../dao/dog/dog")
const daoFile = require("./../../dao/file/file")
const bussinessNotify = require("./../../bussiness/notify/notifyHandler")
const utils = require("./../../utils/utils");
const seafile = require("./../../bussiness/oss/seafile")
const rtcCommData = require("./../rtcCommData/commData");
/**
* 添加取件码文件
* @param {*} io socketio对象
* @param {*} socket 单个socket连接
* @param {*} tables 数据表对象
* @param {*} dbClient sequelize-orm对象
* @param {*} data event参数
* @returns
*/
async function addCodeFile(io, socket, tables, dbClient, data){
try{
let cacheSwitchData = rtcCommData.getCacheSwitchData()
if(!cacheSwitchData.openGetCodeFile){
socket.emit(rtcClientEvent.tips, {
room: data.room,
to: socket.id,
msg: "当前功能已暂时关闭,有问题可以加群交流"
});
return
}
let {handshake, userAgent, ip} = utils.getSocketClientInfo(socket);
const ossToken = await seafile.seafileGetToken();
let donwloadLink = ""
if(ossToken){
let shareLink = await seafile.seafileCreateShareLink(ossToken, {
name : data.ossFileName,
can_edit : false,
can_download : true,
expire_days : 1
});
if(shareLink){
donwloadLink = seafile.seafileGetDownLoadLink(shareLink.token);
}
}
data.donwloadLink = donwloadLink;
utils.tlConsole("获取下载链接成功 : ",donwloadLink)
bussinessNotify.addCodeFileNotify({
title: "添加取件码文件",
room: data.room,
from: data.from,
name: data.name,
type: data.type,
size: data.size,
ossFileId : data.ossFileId,
ossFileName : data.ossFileName,
donwloadLink : data.donwloadLink,
userAgent: userAgent,
ip: ip
})
await daoDog.addDogData({
name: "添加取件码文件",
roomId: data.room || "",
socketId: socket.id,
device: userAgent,
flag: 0,
content: JSON.stringify(data),
handshake: JSON.stringify(handshake),
ip: ip
}, tables, dbClient);
await daoFile.addCodeFile({
roomId: data.room || "",
code: data.ossFileId,
name : data.name,
ossName : data.ossFileName,
download: data.donwloadLink,
content: JSON.stringify(data),
}, tables, dbClient)
//不返回下载链接
delete data.donwloadLink;
socket.emit(rtcClientEvent.addCodeFile, data);
}catch(e){
utils.tlConsole(e)
socket.emit("tips", {
room: data.room,
to: socket.id,
msg: "系统错误"
});
bussinessNotify.sendSystemErrorMsg({
title: "socket-addCodeFile",
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 = {
addCodeFile
}