mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Merge branch 'master' of https://github.com/ikechan8370/OpenShamrock
This commit is contained in:
commit
2f264ee9e4
@ -110,8 +110,8 @@ fun LabFragment() {
|
||||
}
|
||||
|
||||
Function(
|
||||
title = "拦截QQ无用发包",
|
||||
desc = "测试阶段,可能导致网络异常。",
|
||||
title = "拦截QQ无用收包",
|
||||
desc = "测试阶段,可能导致网络异常或掉线。",
|
||||
descColor = it,
|
||||
isSwitch = ShamrockConfig.isInjectPacket(ctx)
|
||||
) {
|
||||
|
@ -5,6 +5,7 @@ import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import moe.fuqiuluo.qqinterface.servlet.MsgSvc
|
||||
import moe.fuqiuluo.qqinterface.servlet.msg.convert.MessageConvert
|
||||
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
||||
import moe.fuqiuluo.shamrock.helper.db.MessageDB
|
||||
@ -53,7 +54,8 @@ internal object GetHistoryMsg: IActionHandler() {
|
||||
return logic(result.msg ?: "获取历史消息失败", echo = echo)
|
||||
}
|
||||
|
||||
val msgList = result.data!!.map { msg ->
|
||||
val msgList = ArrayList<MessageDetail>().apply {
|
||||
addAll(result.data!!.map { msg ->
|
||||
val msgHash = MessageHelper.generateMsgIdHash(msg.chatType, msg.msgId)
|
||||
MessageDetail(
|
||||
time = msg.msgTime.toInt(),
|
||||
@ -70,6 +72,28 @@ internal object GetHistoryMsg: IActionHandler() {
|
||||
groupId = if (msg.chatType == MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0,
|
||||
targetId = if (msg.chatType != MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0
|
||||
)
|
||||
})
|
||||
if (startMsgId != 0L) {
|
||||
val msg = MsgSvc.getMsgByQMsgId(chatType, peerId, startMsgId).onFailure {
|
||||
return logic("Obtain msg failed, please check your msg_id.", echo)
|
||||
}.getOrThrow()
|
||||
val seq = msg.clientSeq.toInt()
|
||||
add(MessageDetail(
|
||||
time = msg.msgTime.toInt(),
|
||||
msgType = MessageHelper.obtainDetailTypeByMsgType(msg.chatType),
|
||||
msgId = MessageHelper.generateMsgIdHash(msg.chatType, msg.msgId),
|
||||
realId = seq,
|
||||
sender = MessageSender(
|
||||
msg.senderUin, msg.sendNickName, "unknown", 0, msg.senderUid
|
||||
),
|
||||
message = MessageConvert.convertMessageRecordToMsgSegment(msg).map {
|
||||
it.toJson()
|
||||
},
|
||||
peerId = msg.peerUin,
|
||||
groupId = if (msg.chatType == MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0,
|
||||
targetId = if (msg.chatType != MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
return ok(data = GetHistoryMsgResult(msgList), echo = echo)
|
||||
|
@ -15,8 +15,8 @@ internal object SetGroupUnique: IActionHandler() {
|
||||
}
|
||||
|
||||
suspend operator fun invoke(groupId: String, userId: String, unique: String, echo: JsonElement = EmptyJsonString): String {
|
||||
if (!GroupSvc.isAdmin(groupId)) {
|
||||
return error("you are not admin", echo)
|
||||
if (!GroupSvc.isOwner(groupId)) {
|
||||
return error("you are not owner", echo)
|
||||
}
|
||||
GroupSvc.setGroupUniqueTitle(groupId, userId, unique)
|
||||
return ok("成功", echo)
|
||||
|
@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit
|
||||
fun Routing.otherAction() {
|
||||
|
||||
if (ShamrockConfig.allowShell()) {
|
||||
getOrPost("/shell") {
|
||||
post("/shell") {
|
||||
val runtime = Runtime.getRuntime()
|
||||
val dir = fetchOrThrow("dir")
|
||||
val out = StringBuilder()
|
||||
|
@ -113,7 +113,7 @@ internal class HookWrapperCodec: IAction {
|
||||
from.putWupBuffer(merge.toByteArray())
|
||||
} else if (from.appId != MAGIC_APP_ID) {
|
||||
if (from.serviceCmd in IgnoredCmd && ShamrockConfig.isInjectPacket()) {
|
||||
from.serviceCmd = "ShamrockInjectedCmd"
|
||||
from.serviceCmd = "ShamrockInjectedCmd_${from.serviceCmd}"
|
||||
from.putWupBuffer(EMPTY_BYTE_ARRAY)
|
||||
} else {
|
||||
pushOnReceive(from)
|
||||
|
Loading…
x
Reference in New Issue
Block a user