Commit Graph

809 Commits

Author SHA1 Message Date
Karlatemp
405f52d3ad
[core] protocol properties public view 2023-07-11 02:27:37 +08: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
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
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
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
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
Him188
bda5d54bd3 [core/auth] Wrap exception from BotAuthorization as BotAuthorizationException; add tests 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
2ef89d2b3f [build] Do not apply Android-relevant plugins if Android target is not enabled 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
164f621427 [build] Fully support Android target; Update to Gradle 8.0 2023-05-02 16:17:48 +01:00
Him188
f469e889d2
[build] Enable atomicfu compiler plugin for mirai-core and mirai-core-api, but disable transformations for JVM, #2315 2023-05-01 11:09:28 +01:00
cssxsh
71e9de3608
[core] 支持获取群公告图片 URL (#2619)
* fix: announcement protocol

* add: api dump
2023-04-13 11:57:04 +01:00
Him188
460275fc0f
[core] Allow using helper to use TxCaptchaHelper in CLI LoginSolver 2023-04-04 21:15:27 +01:00
Him188
8b84bd0aa3
[core] Add 'file://' to file paths in logs in LoginSolver 2023-04-04 21:08:31 +01:00
Karlatemp
893fb3e9f6
[core] Make MessageSource.kind a member not extension 2023-03-29 22:53:11 +08:00
Karlatemp
89fa2f7ffb
[core] Fix private message source target 2023-03-29 22:53:09 +08:00
Karlatemp
ec5870e0b3
[core] Get group incoming message source raw data directly 2023-03-29 22:53:00 +08:00
Karlatemp
e2d7332ac0
[core] Add QRCodeLoginListener.onCompleted 2023-03-27 00:55:54 +08:00
Him188
b9ee2a8931
[core] Commonize BotConfiguration, simplify MPP hierarchy: (#2583)
* [core] Commonize BotConfiguration, simplify MPP hierarchy:

Move platform specific API to `AbstractBotConfiguration`

* Updates docs for AbstractBotConfiguration

* Add @since for AbstractBotConfiguration

* Mark AbstractBotConfiguration as not stable for inheritance
2023-03-21 23:06:27 +00:00
cssxsh
f4fa2cabf4
[core] feat: essence message setting (#2314)
* feat: remove essence message

* feat: Essences

* add: share and remove

* fix: impl

* fix: arguments

* feat: image url to image

* add: doc

* fix: doc

* Copyright: 2023

* remove: method removeEssenceMessage

* feat: lazy load source

* add: no parse

* add: sendAndExpect try

* fix: remove throw

* fix: parse IMAGE_MD5_REGEX
2023-03-21 14:53:23 +00:00
Him188
403380514a
[core] 更新 MiraiProtocol 注释, 注明 ANDROID_WATCH 不支持戳一戳, 删除 ANDROID_PAD 的错误注释 (#2572) 2023-03-21 14:01:46 +00:00
Him188
427c37e649
[build] Update to Kotlin 1.8.10 2023-03-19 03:18:34 +00:00
StageGuard
78d0b4fd54
QRCode login support & Introduce new authorization factory (#2502)
* [core] process `wtlogin.trans_emp` to support qrcode login

* [core] fix `wtlogin.trans_emp` protocol

* [core] optimize QRCodeLoginProcessor logic

* [core] fix `wtlogin.trans_emp` outgoing packet

* [core] cancel login when logging a bot which is inconsistent from bot factory

* [core] ignore `flag3` check on ANDROID_WATCH & name `flag1` and `flag2`

* [core] provide default `QRCodeLoginListener` for jvm

* [core] don't catch IllegalStateException in QRCodeLoginProcessor

* [core] Use `LoginSolver.createQRCodeLoginListener()` instead of property; Rename configuration name

* [core] Code improvement

* [core] remove qrcode state lock

* [core] ignore `flag3` when command is `wtlogin.trans_emp` in packet codec

* [core] enable qrcode login for macos

* [core] remove debug property in log

* [core] reformat code

* [core] rename `TransEmpResponse` to `Response`

* [core] assert `flag3Exception` not null first

* [core] remove arg client

* [core] update qrcode login notes

* [core] set custom qrcode size

* [core] Draft BotAuthorization

* [core] make SecretsProtection mpp

* [core] BotAuthorization.byXXX

* [core] Move QRCodeLoginListener to `.auth`

* [core] Protect data of BotAccount

* [core] Add SelectorRequireReconnectException

* [core] Implementation of BotAuthorization

* Revert changes of BotConfiguration

* api dump

* [core] remove passwordMd5 in `BotAccount`

* [mock] Add new bot factory function to mock bot factory

* Delete LoginCommandTest

* [core] Improve QRCode render

* [core] Introduce UnsupportedCaptchaMethodException & UnsupportedQRCodeCaptchaException

* api dump

* update docs

* [core] update `DebugRunHelper`

* [core] add simple block for BotAuthorization

* api dump

* Rename `canDoQRLogin` to `supportsQRLogin`, and specify argument names for MiraiProtocolInternal

* Remove `phoneNumber` parameter from BotAccount

* Make `BotAccount.<init>` with String password parameter TestOnly

* Rename `InconsistentBotException` to `InconsistentBotIdException`

* Rename `QRCodeLoginListener.onStatusChanged` to `QRCodeLoginListener.onStateChanged`

* Rename `BotAuthorizationResult` to `BotAuthResult`

* Rename BotAuthComponent, move internal APIs to internal module

* Logic fixup

* doc update

* QRCodeLoginListener.qrCodeStateUpdateInterval & onIntervalLoop

* console login with BotAuthorization

* update testing

* Update mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt

* Move AuthControl outside SsoProcessor

* Redesign auth

* Add initialTicket to producerCoroutine

* Revert protocol changes of MACOS

* Fix latch death locking

* Fix CoroutineOnDemandValueScope.receiveOrNull exceptional finish

* Fix exception collecting

* Fix DefaultBotAuthorizationFactory loading

* [core] qrcode login for IPAD protocol

* Revert "[core] qrcode login for IPAD protocol"

This reverts commit c1136a8798.

---------

Co-authored-by: Karlatemp <kar@kasukusakura.com>
Co-authored-by: Him188 <Him188@mamoe.net>
2023-03-18 13:52:31 +00:00
ヒューマンワーキン
2f154b6807
[core] 增加 TxCaptchaHelper 可用性无法保证的警告 (#2564)
* Update LoginSolver.jvm.kt

* revert
2023-03-10 20:00:23 +00:00
Karlatemp
4d9f6e88f9
[core] Fix polymorphic serialization 2023-02-20 22:09:39 +08:00
Him188
26a3ddd505
[core] Improve docs on queryProfile, close #2460 2023-02-19 11:46:35 +00:00
Him188
aec5e21dda
[core] Fix docs for RoamingMessages 2023-02-11 13:08:47 +00:00
Him188
974be88410
[core] Remove SwingSolver and SeleniumLoginSolver. Always use StandardCharImageLoginSolver on desktop JVM. Close #2410 2023-01-11 21:31:46 +00:00
Him188
f04c623658 [core] Implement a more efficient algorithm to fetch roaming messages for group:
- Added `RoamingMessagesImplGroup`.
- Dump API changes for Group RoamingMessages.
- [mock] Fix MockRoamingMessages missing MessageSource
- [core] Convert hierarchical TimeBasedRoamingMessagesImpl to common, to reduce code complexity
2023-01-05 02:33:27 +00:00
StageGuard
2d0b4d470a [core] Proposal implementation of RoamingSupported for Group 2023-01-05 02:33:27 +00:00
Him188
3c580eead4 [core] Add default implementation for RoamingMessages.getMessagesStream 2023-01-05 02:33:27 +00:00
cssxsh
2cffb7a4a4
[core] feat: RockPaperScissors (#2220)
* [core] feat: RockPaperScissors

Co-authored-by: Karlatemp <kar@kasukusakura.com>

* docs update

* rename `eliminate` to `eliminates`

Co-authored-by: Karlatemp <kar@kasukusakura.com>
2023-01-03 10:00:32 +08:00
微莹·纤绫
553ea9abbc
[core] Introduce CacheValidator for validating caches (#2388)
* [core] Export DeviceInfo.serializer() to mirai-core

* [core] Introduce CacheValidator for validating caches
2023-01-02 15:39:36 +00:00
Him188
6365e23f2c
[core] Change StdoutLogger color for WARNING. Fix #2336.
Commit 28030dfb05 fixed this problem for PlatformLogger
2022-12-27 17:54:34 +00:00
Him188
7908edb57b
[core+console] Raise deprecation level for 2.14, API including:
- EventChannel.asChannel
- (internal) syncFromEventImpl
- EmptyMessageChain
- GroupEntranceAnnouncementChangeEvent
- MiraiConsole.createLogger
- SingletonExtensionPoint
2022-12-27 15:53:12 +00:00
Him188
76a70f596f
[core] Raise deprecation level for RemoteFile to ERROR (for v2.14) 2022-12-27 14:34:41 +00:00
Him188
6fc1482f69
[core] Relocate ktor-io in mirai-core-api. Fix #2381 2022-12-04 14:49:47 +00:00
ヒューマンワーキン
5a645b4e8e
修正 'contentToString` 注释不严谨处 (#2374)
* 修正 'contentToString` 注释不严谨处

* link `At`
2022-12-03 14:55:21 +00:00
Him188
28f198d03f
[core] Add QiaoMen to PokeMessage.values. Fix poke id of QiaoMen. Close #2170. 2022-11-27 20:20:45 +00:00
Him188
60bbcf6e2c
[core] Revert "Review atomic calls and enable atomicfu compiler. Close #2315", due to atomicfu does not behave correctly when mirai-console depends on mirai-core-utils. Fixes #2329.
This commit reverts part of commit 564a7ce8f8
2022-11-27 20:08:21 +00:00
Him188
3360347ca2 [build] Fix dependency exclusion for builds when IDEA_ACTIVE 2022-11-27 15:25:18 +00:00