mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 07:56:56 +08:00
Deprecated IMirai.Http for future removal
This commit is contained in:
parent
b4bb1696de
commit
d1cb05025e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@ -30,10 +30,7 @@ import net.mamoe.mirai.message.action.Nudge
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.message.data.Image.Key.queryUrl
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.recall
|
||||
import net.mamoe.mirai.utils.FileCacheStrategy
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
import net.mamoe.mirai.utils.MiraiInternalApi
|
||||
import net.mamoe.mirai.utils.NotStableForInheritance
|
||||
import net.mamoe.mirai.utils.*
|
||||
|
||||
/**
|
||||
* [IMirai] 实例.
|
||||
@ -100,6 +97,8 @@ public interface IMirai : LowLevelApiAccessor {
|
||||
*
|
||||
* 覆盖后将会立即应用到全局.
|
||||
*/
|
||||
@Deprecated("Mirai is not going to use ktor. This is deprecated for removal.", level = DeprecationLevel.WARNING)
|
||||
@DeprecatedSinceMirai(warningSince = "2.11.0")
|
||||
public var Http: HttpClient
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.utils
|
||||
@ -22,6 +22,7 @@ internal abstract class TxCaptchaHelper {
|
||||
init {
|
||||
var newClient = false
|
||||
client = try {
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http
|
||||
} catch (ignore: Throwable) {
|
||||
newClient = true
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@ -57,7 +57,6 @@ import net.mamoe.mirai.internal.network.protocol.packet.sendAndExpect
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.summarycard.SummaryCard
|
||||
import net.mamoe.mirai.internal.network.psKey
|
||||
import net.mamoe.mirai.internal.network.sKey
|
||||
import net.mamoe.mirai.internal.utils.ImagePatcher
|
||||
import net.mamoe.mirai.internal.utils.MiraiProtocolInternal
|
||||
import net.mamoe.mirai.internal.utils.crypto.TEA
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
@ -145,6 +144,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
|
||||
override var FileCacheStrategy: FileCacheStrategy = net.mamoe.mirai.utils.FileCacheStrategy.PlatformDefault
|
||||
|
||||
@Deprecated("Mirai is not going to use ktor. This is deprecated for removal.", level = DeprecationLevel.WARNING)
|
||||
override var Http: HttpClient = HttpClient(OkHttp) {
|
||||
install(HttpTimeout) {
|
||||
this.requestTimeoutMillis = 30_0000
|
||||
@ -579,6 +579,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
override suspend fun getRawGroupActiveData(bot: Bot, groupId: Long, page: Int): GroupActiveData =
|
||||
bot.asQQAndroidBot().run {
|
||||
val rep = network.run {
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.get<String> {
|
||||
url("https://qqweb.qq.com/c/activedata/get_mygroup_data")
|
||||
parameter("bkn", client.wLoginSigInfo.bkn)
|
||||
@ -606,6 +607,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
type: GroupHonorType
|
||||
): GroupHonorListData? = bot.asQQAndroidBot().run {
|
||||
val rep = network.run {
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.get<String> {
|
||||
url("https://qun.qq.com/interactive/honorlist")
|
||||
parameter("gc", groupId)
|
||||
@ -735,6 +737,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
seconds: Int
|
||||
) {
|
||||
bot as QQAndroidBot
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
val response = Mirai.Http.post<String> {
|
||||
url("https://qqweb.qq.com/c/anonymoustalk/blacklist")
|
||||
body = MultiPartFormDataContent(formData {
|
||||
@ -883,6 +886,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
bot.asQQAndroidBot()
|
||||
when (val resp = MultiMsg.ApplyDown(bot.client, 2, resourceId, 1).sendAndExpect(bot)) {
|
||||
is MultiMsg.ApplyDown.Response.RequireDownload -> {
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
val http = Mirai.Http
|
||||
val origin = resp.origin
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@ -195,6 +195,7 @@ internal sealed class AbstractUser(
|
||||
resourceKind = PRIVATE_IMAGE,
|
||||
channelKind = ChannelKind.HTTP
|
||||
) { ip, port ->
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.postImage(
|
||||
serverIp = ip, serverPort = port,
|
||||
htcmd = "0x6ff0070",
|
||||
@ -206,6 +207,7 @@ internal sealed class AbstractUser(
|
||||
}
|
||||
}.recoverCatchingSuppressed {
|
||||
// try upload by http on fallback server
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.postImage(
|
||||
serverIp = "htdata2.qq.com",
|
||||
htcmd = "0x6ff0070",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@ -129,6 +129,7 @@ internal class FriendImpl(
|
||||
ResourceKind.GROUP_AUDIO,
|
||||
ChannelKind.HTTP
|
||||
) { ip, port ->
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.postPtt(ip, port, res, resp.uKey, resp.fileKey)
|
||||
}
|
||||
audio = OfflineAudioImpl(
|
||||
|
@ -321,6 +321,7 @@ internal class GroupImpl constructor(
|
||||
GROUP_AUDIO,
|
||||
ChannelKind.HTTP
|
||||
) { ip, port ->
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.postPtt(ip, port, resource, resp.uKey, resp.fileKey)
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.internal.network.components
|
||||
@ -87,6 +87,7 @@ internal class EcdhInitialPublicKeyUpdaterImpl(
|
||||
} else {
|
||||
logger.info("ECDH key is invalid, start to fetch ecdh public key from server.")
|
||||
val respStr =
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
Mirai.Http.get<String>("https://keyrotate.qq.com/rotate_key?cipher_suite_ver=305&uin=${bot.client.uin}")
|
||||
val resp = json.decodeFromString(ServerRespPOJO.serializer(), respStr)
|
||||
resp.pubKeyMeta.let { meta ->
|
||||
|
Loading…
Reference in New Issue
Block a user