File tree Expand file tree Collapse file tree
acidify-core/src/commonMain/kotlin/org/ntqqrev/acidify/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import kotlinx.coroutines.channels.BufferOverflow
66import kotlinx.coroutines.channels.Channel
77import org.ntqqrev.acidify.common.SsoResponse
88import org.ntqqrev.acidify.exception.ServiceException
9+ import org.ntqqrev.acidify.exception.UrlSignException
910import org.ntqqrev.acidify.internal.context.FlashTransferContext
1011import org.ntqqrev.acidify.internal.context.HighwayContext
1112import org.ntqqrev.acidify.internal.context.PacketContext
@@ -79,7 +80,15 @@ internal sealed class AbstractClient(
7980 timeoutMillis = timeout,
8081 requestType = service.ssoRequestType,
8182 encryptType = service.ssoEncryptType,
82- ssoSecureInfo = getSsoSecureInfo(service.cmd, sequence, byteArray)
83+ ssoSecureInfo = try {
84+ getSsoSecureInfo(service.cmd, sequence, byteArray)
85+ } catch (e: UrlSignException ) {
86+ logger.w { " 没有成功获取 ${service.cmd} 的签名,该操作可能会失败: ${e.message} " }
87+ null
88+ } catch (e: Exception ) {
89+ logger.w(e) { " 获取 ${service.cmd} 的签名时发生未知错误,该操作可能会失败" }
90+ null
91+ }
8392 )
8493 if (resp.retCode != 0 ) {
8594 throw ServiceException (
Original file line number Diff line number Diff line change @@ -469,25 +469,20 @@ internal class KuromeClient(
469469
470470 override suspend fun getSsoSecureInfo (cmd : String , seq : Int , src : ByteArray ): SsoSecureInfo ? {
471471 return if (signRequiredCommand.contains(cmd)) {
472- try {
473- signProvider.sign(
474- uin = uin,
475- cmd = cmd,
476- seq = seq,
477- buffer = src,
478- guid = guid.toHexString(),
479- version = appInfo.ptVersion,
480- qua = appInfo.qua,
481- ).let {
482- SsoSecureInfo (
483- sign = it.sign,
484- token = it.token,
485- extra = it.extra,
486- )
487- }
488- } catch (e: UrlSignException ) {
489- logger.w(e) { " 没有成功获取 $cmd (seq=$seq ) 的签名,该操作可能会失败" }
490- null
472+ signProvider.sign(
473+ uin = uin,
474+ cmd = cmd,
475+ seq = seq,
476+ buffer = src,
477+ guid = guid.toHexString(),
478+ version = appInfo.ptVersion,
479+ qua = appInfo.qua,
480+ ).let {
481+ SsoSecureInfo (
482+ sign = it.sign,
483+ token = it.token,
484+ extra = it.extra,
485+ )
491486 }
492487 } else {
493488 null
Original file line number Diff line number Diff line change @@ -64,17 +64,12 @@ internal class LagrangeClient(
6464
6565 override suspend fun getSsoSecureInfo (cmd : String , seq : Int , src : ByteArray ): SsoSecureInfo ? {
6666 return if (signRequiredCommand.contains(cmd)) {
67- try {
68- signProvider.sign(cmd, seq, src).let {
69- SsoSecureInfo (
70- sign = it.sign,
71- token = it.token,
72- extra = it.extra,
73- )
74- }
75- } catch (e: UrlSignException ) {
76- logger.w(e) { " 没有成功获取 $cmd (seq=$seq ) 的签名,该操作可能会失败" }
77- null
67+ signProvider.sign(cmd, seq, src).let {
68+ SsoSecureInfo (
69+ sign = it.sign,
70+ token = it.token,
71+ extra = it.extra,
72+ )
7873 }
7974 } else {
8075 null
You can’t perform that action at this time.
0 commit comments