Commit Graph

8428 Commits

Author SHA1 Message Date
Him188
2eb313ba69
[core] 默认关闭进行登录验证时的内部日志; 可使用 system prop mirai.network.auth.logging=true 启用 2023-06-28 17:26:13 +01:00
cssxsh
cb3dc9f897
fix: qrcode login (#2708)
* fix: uri

* update: macos 6.8.2.21241

* add: pc (macos) t544

* add: protocol value

* add: protocol supported check

* fix: name
2023-06-26 21:30:45 +01:00
cssxsh
356f00b54b
修复禁言匿名成员 (#2711) 2023-06-25 10:48:56 +01:00
StageGuard
545e5bb310
[core] Provide isFirstLogin and getReLoginCause in BotAuthInfo (#2664)
* [core] provide `isFirstLogin` and `getReLoginCause` in `BotAuthInfo`

* [core] provide `reAuthCause` as sealed class

* [core] add test

* Update mirai-core-api/src/commonMain/kotlin/auth/BotAuthorization.kt

我觉得这个描述不太好,因为这里是 `authorize` 过程而不是 `login` 过程

Co-authored-by: Him188 <Him188@mamoe.net>

* [core] optimize docs and rename

* import

* revert linebreak

---------

Co-authored-by: Him188 <Him188@mamoe.net>
2023-06-20 14:22:49 +01:00
Him188
8ff64d4a7f
Remove native (#2700)
* Remove native target

* Add foojay-resolver-convention

* disable windows
2023-06-16 13:40:46 +01:00
ヒューマンワーキン
9a6b9cc900
[core/android] Fix wrong publication of androidRelease (#2699) 2023-06-15 22:59:54 +08:00
BakaFT
3b8954372e
[docs](EventList.md): fix mismatch between description and event name (#2692) 2023-06-13 19:07:50 +01:00
sandtechnology
3ec8e552cd
[core] Add encryption SPI & T544 support (#2566)
* Initial design for encryption SPI & T544 support

* Fix missed vararg

* Move EncryptWorkerService to internal spi

* Add useAndroid val to QQAndroidClient and rebase to the latest dev branch

* Remove docs and annotations (Throws and MiraiExperimentalApi)

* Remove unwanted changes

* Remove redundant runBlocking in tlv544

* Tweak the file annotation location

* Remove suspend modifier for doTLVEncrypt

* Disable DebuggingProperties

* Fix format

* Remove empty line

* Remove empty line again

* Use instance field directly

* Add Volatile annotation to instance

* Use atomicRef instead of field

* Use kotlin lambda for readability

* wip

* Improve EncryptService API

* Add possible values

* remove docs

* Add key BOT_PROTOCOL

---------

Co-authored-by: Him188 <Him188@mamoe.net>
2023-06-04 00:01:54 +01:00
Him188
68c991c078
[core] Add DeviceInfoBuilder. Close #2669 (#2674)
* [core] Add DeviceInfoBuilder. Close #2669

* Use private var

* fix doc
2023-05-28 19:20:30 +01:00
微莹·纤绫
97f85bc8b9
[core] ForwardMessage refine by light app (#2675) 2023-05-28 19:20:12 +01:00
Him188
e89d245ca0
[build] Fix build sync when ENABLE_ANDROID_INSTRUMENTED_TESTS is false 2023-05-27 16:00:29 +01:00
cssxsh
3dfe86bbe0
fix: digest message (#2672)
fix: unsigned int
2023-05-27 12:40:48 +01:00
微莹·纤绫
8b4af6d8cf
[console] 优化插件 classpath 策略 (#2666)
* [console/it] Fix testers not run when testers modified

* [console] Add options to control plugin classpath resolving

- Also add `META-INF/mirai-console-plugin/options.properties`

* [console/it] Testers for options.properties

* api dump

* update property names

* doc update
2023-05-21 21:21:20 +08:00
StageGuard
60d360baad
[core] Update login protocol, deprecate DeviceInfo constructor and serializer (#2613)
* [core] update protocol

* [core] fix t106 decryption key

* [core] handle t543

* [core] revert t106

* [core] revert native test pow data

* [core] split build version and apk version name

* [core] pass time to t1 instead of time diff

* [core] remove unused t106 writer & rename param ip to ipv4 of t1 and t106

* [core] implement qimei for t545
TODO: aes and rsa crypto for nativeMain

* [core] fix base64 decode for android in rsa

* [core] fix unix timestamp parsing on native and add more tests

* [api] DeviceInfo move `androidId` to main constructor and adjust test.

* [api] do not request qimei when protocol is neither  ANDROID_PHONE nor ANDROID_PAD

* [api] implement aes crypto for native target

* [api] rsa crypto for multi-platform

* [api] crypto test

* [api] move freePointer util

* [api] openssl api compatibility

* [core] add explicit `androidId` param

* [core] remove unused `tlvCount`

* [core] optimize crypto

* [core] move Qimei to network package

* [core] move appId to protocol

* [core] lazily initialize qimeiLogger

* [core] write byte array to BIO mem

* [core] move qimei to client, add direct serializer for DeviceInfo

* [core] optimize DeviceInfoDelegateSerializer

* [core] real user-agent when requesting qimei

* [core] use `DeviceInfo.version.release`

* [core] remove unused wtlogin packet

* [core] do what constructor serializer should do

* [core] fix endless cache validation caused by not upgrading device info file.

* [core] request qimei before fast-login

* [core] tlv order

* [core] remove wrong tests and print more detail when deserialize failed.

* [core] device info upgrade for native

* [core] request qimei after validating cache

* [core] DeviceInfo compatibility

* [core] DeviceInfo test name

* [core] compatibility serializer

* [core] disable rsa crypto test on android unit test

* [core] move rsa impl to jvmBase

* action

* import

* api dump

* api dump

* revert wrong api dumps

* [core] Deprecate DeviceInfo constructor and serializer, provide `serializeToString` and `deserializeFromString` for replacement

* rerun ci

* optimize

* use serializer directly

* optimize test

* revert

* [core] CacheValidator use `DeviceInfo.serializeToString()` instead of direct serializer

* Remove `println` in `DeviceInfoManager`

* Add legacy deserialize overload for ABI compatibility

* Remove uncompleted docs for DeviceInfo

* Suppress DeviceInfo deprecation warnings for internal usages

---------

Co-authored-by: Him188 <Him188@mamoe.net>
2023-05-21 13:45:46 +01:00
Him188
dafa25d611
[core] Simplify and stabilize BaseService and AudioToSilkService (#2658)
* [core] Simplify and stabilize BaseService and AudioToSilkService

* fix

* api dump
2023-05-21 00:24:51 +01:00
Him188
c57fdd7790
Revert "[core] Add common JvmFile for compatibility"
This reverts commit 64e3d6c0f2.
2023-05-08 13:00:53 +01:00
Him188
64e3d6c0f2
[core] Add common JvmFile for compatibility 2023-05-08 12:21:38 +01:00
cssxsh
44e9bb118c
[core+console] Update docs (#2639)
* feat: Question.md

* update: UserManual.md

* update: ConsoleTerminal.md

* update: ConsoleTerminal.md

* update: Question.md

* update: Bots.md

* update: Question.md

* update: EventList.md

* update: Question.md

* update: Preparations.md

* update: ConsoleTerminal.md

* update: Bots.md

* update: nav.js

* update: UserManual.md

* update: Bots.md

* update: Bots.md

* update: Bots.md

* update: ConsoleTerminal.md

* update: Questions.md

* update: Questions.md

* update: ...

* update: Bots.md

* update: Questions.md

---------

Co-authored-by: Him188 <Him188@mamoe.net>
2023-05-06 13:13:18 +01:00
Him188
9d1e78386e
[core] Generate blocking bridges for Announcements.members and Announcements.remind 2023-05-06 11:53:04 +01:00
Him188
b82e938b2c
[build] Fix checkAndroidApiLevel tasks when building without ADK 2023-05-06 11:20:49 +01:00
Him188
363d1f7ece
Remove module-level opt-ins, add @OptIn explicit in use-sites;
added some opt-in markers on API which should have:

- `appendMiraiCodeTo`

Made API stable (otherwise they require too heavy opt-ins):
- MiraiConsoleImplementation$ConsoleLaunchOptions
- LowLevelApi
2023-05-06 11:04:31 +01:00
Karlatemp
96a772c5ca
Add mirai.enable.jvmtoolchain.special=false to disable jvmToolchain 2023-05-05 23:26:52 +08:00
Karlatemp
bc8ff18b07
[build] Reload local.properties when file modified 2023-05-05 23:26:12 +08:00
Him188
bda5d54bd3 [core/auth] Wrap exception from BotAuthorization as BotAuthorizationException; add tests 2023-05-04 16:36:28 +01:00
Him188
b18e62b3b6 [core] SsoProcessor.loginSuccess: use sendRegister to allow being overriden for tests 2023-05-04 16:36:28 +01:00
Him188
c6a8f4bde5 [core] Remove Latch since it's not needed anymore 2023-05-04 16:36:28 +01:00
Him188
0e625d3368 [core] OnDemandChannel: Ensure scope is closed on exceptional cases:
[core] OnDemandChannel: Ensure channel close and emit shares same behavior

[core] OnDemandChannel: Ensure channel is closed properly when producer throws an exception

[core] OnDemandChannel: Ensure coroutine scope cancelled when producer coroutine throws exception,

also added more tests
2023-05-04 16:36:28 +01:00
Him188
87fbaa4fb2 [core] Revise OnDemandChannel, improve state abstraction:
[core] Start producer coroutine immediately on `expectMore` and yield

Improve docs for OnDemandChannel

Rename factory function `OnDemandReceiveChannel` to  `OnDemandChannel` to better cover its meaning

Create deferred lazily in Producing state

Rename ProducerState to ChannelState

fix atomicfu bug receiveOrNull

Add docs (WIP, to be rebased)

[core] OnDemandChannel: Catch Throwable in `receiveOrNull` to prevent possible failures
2023-05-04 16:36:28 +01:00
Him188
99f592d614 [core] Move Latch and OnDemandValueScope to mirai-core-utils,
and rename OnDemandValueScope to OnDemandSendChannel and OnDemandReceiveChannel
2023-05-04 16:36:28 +01:00
Him188
36d90c57fe [core] Add UtilsLogger in mirai-core-utils module to bridge logging,
also added delegations in mirai-core and mirai-core-api.
2023-05-04 16:36:28 +01:00
Him188
26ea98db6a [core] Extract SafeBotAuthSession implementation from AuthControl 2023-05-04 16:36:28 +01:00
Him188
0c24053198 [core] AuthControl: require explicit .start() instead of launching job in constructor 2023-05-04 16:36:28 +01:00
Him188
10e731f260 [core] CoroutineOnDemandValueScope: remove CreatingProducer state 2023-05-04 16:36:28 +01:00
Him188
d263a9ee29
[core] MiraiProtocolInternal: Use setters 2023-05-02 21:41:22 +01:00
Him188
64cfab6f0a [build] Publish android artifacts 2023-05-02 16:17:48 +01:00
Him188
84d03c9a71 [core] Set minimum Android API level to 21 2023-05-02 16:17:48 +01:00
Him188
193fedfc24 [docs] Improve docs for building the project and add instructions for building Android 2023-05-02 16:17:48 +01:00
Him188
2ef89d2b3f [build] Do not apply Android-relevant plugins if Android target is not enabled 2023-05-02 16:17:48 +01:00
Him188
438b58c717 [build] Binary validator: support Android 2023-05-02 16:17:48 +01:00
Him188
178ca6c1b5 [build] Rewrite shadow relocation; fix dependency graph issues with Android, and improve build performance:
- Generate relocated JARs with classifier `relocated`, instead of replacing the output of `:jar` task.

- Create `JvmRelocated` publications to publish relocated artifacts.

- Patch Kotlin Metadata and Maven Pom for the added publication.

- Updated deps test to be more strict
2023-05-02 16:17:48 +01:00
Him188
40d4957837 [core/android] Implement mirai-core tests for Android target with AndroidSDK 2023-05-02 16:17:48 +01:00
Him188
4ed551027a [build] Support both configuring Android targets by Android SDK or JVM
- try to fix sdk dir when android is desired
- Do not printAndroidNotInstalled multiple times
2023-05-02 16:17:48 +01:00
Him188
2cf97a181f [build] Use JUnit5 on Android 2023-05-02 16:17:48 +01:00
Him188
a2d50ec03a [build] Relocate ktor only for jvm, not for Android 2023-05-02 16:17:48 +01:00
Him188
164f621427 [build] Fully support Android target; Update to Gradle 8.0 2023-05-02 16:17:48 +01:00
Him188
fc549d380f
[core] Make properties mutable in MiraiProtocolInternal 2023-05-01 23:11:46 +01:00
Him188
a988d442e2
[core] Add PacketReplier DSL for core tests 2023-05-01 22:56:34 +01:00
Him188
e4ff4d108e
[build] Use language version 1.9 and enable Context Receivers for tests 2023-05-01 22:56:33 +01:00
Him188
7a5cbbcb88
[core] Add kotlinx-coroutines-debug in mirai-core-utils 2023-05-01 22:52:29 +01:00
Him188
0ea5503f3b
[core/testFramework] Add assertNoCoroutineSuspension 2023-05-01 22:52:11 +01:00