Skip to content

Commit

Permalink
build: 1.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jul 16, 2023
1 parent 3c8efcd commit 1a16d91
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
39 changes: 31 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@

`1.7.0+` 中加入了 TLV544Provider, 但实际效果有限。

`1.9.0+` 中加入了 KFCFactory, 以对接第三方服务
**请注意第三方服务支持的协议版本是否和 Bot 登录的协议版本匹配**
`1.9.0+` 中加入了 KFCFactory, 以对接[第三方签名服务](https://mirai.mamoe.net/topic/2373)

请确保第三方签名服务**可用**!!!
请确保第三方签名服务**可用**!!!
请确保第三方签名服务**可用**!!!

## 第三方签名服务

目前支持的第三方签名服务有
* [fuqiuluo/unidbg-fetch-qsign](https://github.com/fuqiuluo/unidbg-fetch-qsign)
* [kiliokuara/magic-signer-guide](https://github.com/kiliokuara/magic-signer-guide)

**请确认第三方签名服务 支持的协议版本 和 登录的协议版本 匹配**

下面是配置文件示例,你可以根据实际情况调整
```json
{
"8.9.63": {
Expand All @@ -27,8 +40,8 @@
"8.9.58": {
"base_url": "http://127.0.0.1:8888",
"type": "kiliokuara/magic-signer-guide",
"serverIdentityKey": "vivo50",
"authorizationKey": "kfc"
"server_identity_key": "vivo50",
"authorization_key": "kfc"
}
}
```
Expand Down Expand Up @@ -61,7 +74,12 @@
> since 1.8.0
* `protocol load` 加载本地协议文件
例如 `protocol load ANDROID_PAD`
例如 `protocol load ANDROID_PHONE`

> since 1.9.6
* `protocol fetch <type> <version>` 在线获取协议
例如 `protocol fetch ANDROID_PAD 8.9.63`

## Mirai Core 使用方法

Expand All @@ -71,7 +89,7 @@
`1.9.0+` 中加入了 [async-http-client](https://search.maven.org/artifact/org.asynchttpclient/async-http-client/2.12.3/jar) 作为依赖,请自行补全

然后在代码中调用 `FixProtocolVersion` 的静态方法
java示例:
java示例:
```java
import xyz.cssxsh.mirai.tool.FixProtocolVersion;
import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol;
Expand All @@ -87,20 +105,25 @@ public class Example {
public static void sync() {
FixProtocolVersion.sync(BotConfiguration.MiraiProtocol.ANDROID_PAD);
}
// 获取指定协议版本
public static void fetch() {
FixProtocolVersion.fetch(BotConfiguration.MiraiProtocol.ANDROID_PAD, "latest");
FixProtocolVersion.fetch(BotConfiguration.MiraiProtocol.ANDROID_PAD, "8.9.63");
}
// 加载协议版本
public static void load() {
FixProtocolVersion.load(BotConfiguration.MiraiProtocol.ANDROID_PAD);
}
// 获取协议版本信息 你可以用这个来检查update是否正常工作
public static Map<MiraiProtocol, String> info() {
public static Map<BotConfiguration.MiraiProtocol, String> info() {
return FixProtocolVersion.info();
}
}
```

## 相关项目

* https://github.com/RomiChan/protocol-versions 协议选项同步来源
* https://github.com/RomiChan/protocol-versions 协议信息同步来源
* https://github.com/LaoLittle/t544_enc 内置 T544 编码器
* https://github.com/fuqiuluo/unidbg-fetch-qsign
* https://github.com/kiliokuara/magic-signer-guide Docker 镜像, 解决各种 QQ 机器人框架的 sso sign 和 tlv 加密问题。
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "xyz.cssxsh.mirai"
version = "1.9.5"
version = "1.9.6"

mavenCentralPublish {
useCentralS01()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal object FixProtocolVersionPlugin : KotlinPlugin(
JvmPluginDescription(
id = "xyz.cssxsh.mirai.fix-protocol-version",
name = "fix-protocol-version",
version = "1.9.5"
version = "1.9.6"
) {
author("cssxsh")
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/xyz/cssxsh/mirai/tool/KFCFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class KFCFactory(private val config: File) : EncryptService.Factory {
}
} catch (cause: ConnectException) {
throw RuntimeException("请检查 unidbg-fetch-qsign by ${server.base} 的可用性", cause)
} catch (cause: java.io.FileNotFoundException) {
throw RuntimeException("请检查 unidbg-fetch-qsign by ${server.base} 的可用性", cause)
}
UnidbgFetchQsign(
server = server.base,
Expand All @@ -115,6 +117,8 @@ public class KFCFactory(private val config: File) : EncryptService.Factory {
}
} catch (cause: ConnectException) {
throw RuntimeException("请检查 magic-signer-guide by ${server.base} 的可用性", cause)
} catch (cause: java.io.FileNotFoundException) {
throw RuntimeException("请检查 unidbg-fetch-qsign by ${server.base} 的可用性", cause)
}
ViVo50(
server = server.base,
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/xyz/cssxsh/mirai/tool/UnidbgFetchQsign.kt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public class UnidbgFetchQsign(private val server: String, private val key: Strin
launch(CoroutineName("RequestToken")) {
while (isActive) {
val interval = System.getProperty(REQUEST_TOKEN_INTERVAL, "2400000").toLong()
if (interval == 0L) break
if (interval <= 0L) break
if (interval < 600_000) logger.warning("$REQUEST_TOKEN_INTERVAL=${interval} < 600_000 (ms)")
delay(interval)
val request = try {
requestToken(uin = context.id)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/xyz/cssxsh/mirai/tool/ViVo50.kt
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public class ViVo50(
val json = try {
future.get(timeout, TimeUnit.MILLISECONDS)
} catch (cause: TimeoutException) {
logger.warning("Session(bot=${bot}) $type timeout", cause)
logger.warning("Session(bot=${bot}) $type timeout ${timeout}ms", cause)
return null
}

Expand Down

0 comments on commit 1a16d91

Please sign in to comment.