Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Shamrock: fix #252
Browse files Browse the repository at this point in the history
Signed-off-by: 白池 <[email protected]>
  • Loading branch information
whitechi73 committed Feb 24, 2024
1 parent 7203131 commit 6b1147d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package moe.fuqiuluo.qqinterface.servlet.transfile

import kotlinx.atomicfu.atomic
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import moe.fuqiuluo.qqinterface.servlet.BaseSvc
import moe.fuqiuluo.qqinterface.servlet.TicketSvc
Expand Down Expand Up @@ -214,11 +216,12 @@ internal object NtV2RichMediaSvc: BaseSvc() {
}
}

@Serializable
data class TryUpPicData(
val uKey: ByteArray,
val exist: Boolean,
val fileId: ULong,
var upIp: ArrayList<Long>? = null,
var upPort: ArrayList<Int>? = null,
@SerialName("ukey") val uKey: ByteArray,
@SerialName("exist") val exist: Boolean,
@SerialName("file_id") val fileId: ULong,
@SerialName("up_ip") var upIp: ArrayList<Long>? = null,
@SerialName("up_port") var upPort: ArrayList<Int>? = null,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ internal object RichProtoSvc: BaseSvc() {

val domain = if (!result.download_file_rsp.str_download_dns.has())
("https://" + result.download_file_rsp.str_download_ip.get())
else ("http://" + result.download_file_rsp.str_download_dns.get())
else ("http://" + result.download_file_rsp.str_download_dns.get().toByteArray().decodeToString())
val downloadUrl = result.download_file_rsp.bytes_download_url.get().toByteArray().toHexString()
val appId = MobileQQ.getMobileQQ().appId
val version = PlatformUtils.getQQVersion(MobileQQ.getContext())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package moe.fuqiuluo.shamrock.remote.action.handlers

import moe.fuqiuluo.qqinterface.servlet.transfile.NtV2RichMediaSvc
import moe.fuqiuluo.shamrock.remote.action.ActionSession
import moe.fuqiuluo.shamrock.remote.action.IActionHandler
import moe.fuqiuluo.symbols.OneBotHandler

@OneBotHandler("request_upload_group_image")
internal object RequestUploadGroupImage: IActionHandler() {
override suspend fun internalHandle(session: ActionSession): String {
val md5 = session.getString("md5").uppercase()
val fileSize = session.getLong("file_size")
val width = session.getInt("width")
val height = session.getInt("height")
val groupId = session.getString("group_id")
NtV2RichMediaSvc.requestUploadGroupPic(
groupId.toULong(),
md5,
fileSize.toULong(),
width.toUInt(),
height.toUInt()
).onSuccess {
return ok(it, session.echo)
}.onFailure {
return error(it.message ?: it.toString(), session.echo)
}
return logic("request_upload_group_image failed", session.echo)
}
}

0 comments on commit 6b1147d

Please sign in to comment.