mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-29 18:20:12 +08:00
[core] Push bot working directories to service
This commit is contained in:
parent
804cb8b12d
commit
ed7eca7f6b
@ -18,11 +18,12 @@ import kotlinx.serialization.json.Json
|
|||||||
import net.mamoe.mirai.internal.QQAndroidBot
|
import net.mamoe.mirai.internal.QQAndroidBot
|
||||||
import net.mamoe.mirai.internal.network.component.ComponentKey
|
import net.mamoe.mirai.internal.network.component.ComponentKey
|
||||||
import net.mamoe.mirai.internal.network.protocol.packet.createChannelProxy
|
import net.mamoe.mirai.internal.network.protocol.packet.createChannelProxy
|
||||||
import net.mamoe.mirai.internal.spi.EncryptService
|
|
||||||
import net.mamoe.mirai.internal.spi.EncryptServiceContext
|
import net.mamoe.mirai.internal.spi.EncryptServiceContext
|
||||||
|
import net.mamoe.mirai.internal.utils.actualCacheDir
|
||||||
import net.mamoe.mirai.internal.utils.crypto.QQEcdh
|
import net.mamoe.mirai.internal.utils.crypto.QQEcdh
|
||||||
import net.mamoe.mirai.internal.utils.crypto.QQEcdhInitialPublicKey
|
import net.mamoe.mirai.internal.utils.crypto.QQEcdhInitialPublicKey
|
||||||
import net.mamoe.mirai.internal.utils.crypto.verify
|
import net.mamoe.mirai.internal.utils.crypto.verify
|
||||||
|
import net.mamoe.mirai.internal.utils.workingDirPath
|
||||||
import net.mamoe.mirai.utils.MiraiLogger
|
import net.mamoe.mirai.utils.MiraiLogger
|
||||||
import net.mamoe.mirai.utils.buildTypeSafeMap
|
import net.mamoe.mirai.utils.buildTypeSafeMap
|
||||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||||
@ -124,6 +125,8 @@ internal class EcdhInitialPublicKeyUpdaterImpl(
|
|||||||
set(EncryptServiceContext.KEY_DEVICE_INFO, bot.client.device)
|
set(EncryptServiceContext.KEY_DEVICE_INFO, bot.client.device)
|
||||||
set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol)
|
set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol)
|
||||||
set(EncryptServiceContext.KEY_QIMEI36, bot.client.qimei36 ?: "")
|
set(EncryptServiceContext.KEY_QIMEI36, bot.client.qimei36 ?: "")
|
||||||
|
set(EncryptServiceContext.KEY_BOT_WORKING_DIR, bot.configuration.workingDirPath)
|
||||||
|
set(EncryptServiceContext.KEY_BOT_CACHING_DIR, bot.configuration.actualCacheDir().absolutePath)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ import net.mamoe.mirai.internal.network.component.ComponentKey
|
|||||||
import net.mamoe.mirai.internal.spi.EncryptService
|
import net.mamoe.mirai.internal.spi.EncryptService
|
||||||
import net.mamoe.mirai.internal.spi.EncryptServiceContext
|
import net.mamoe.mirai.internal.spi.EncryptServiceContext
|
||||||
import net.mamoe.mirai.internal.spi.GlobalEncryptServiceUsage
|
import net.mamoe.mirai.internal.spi.GlobalEncryptServiceUsage
|
||||||
|
import net.mamoe.mirai.internal.utils.actualCacheDir
|
||||||
|
import net.mamoe.mirai.internal.utils.workingDirPath
|
||||||
import net.mamoe.mirai.utils.buildTypeSafeMap
|
import net.mamoe.mirai.utils.buildTypeSafeMap
|
||||||
|
|
||||||
internal interface EncryptServiceHolder {
|
internal interface EncryptServiceHolder {
|
||||||
@ -48,6 +50,8 @@ internal class EncryptServiceHolderImpl(
|
|||||||
EncryptServiceContext(bot.id, buildTypeSafeMap {
|
EncryptServiceContext(bot.id, buildTypeSafeMap {
|
||||||
set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol)
|
set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol)
|
||||||
set(EncryptServiceContext.KEY_DEVICE_INFO, ssoProcessorContext.device)
|
set(EncryptServiceContext.KEY_DEVICE_INFO, ssoProcessorContext.device)
|
||||||
|
set(EncryptServiceContext.KEY_BOT_WORKING_DIR, bot.configuration.workingDirPath)
|
||||||
|
set(EncryptServiceContext.KEY_BOT_CACHING_DIR, bot.configuration.actualCacheDir().absolutePath)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
isAvailable = true
|
isAvailable = true
|
||||||
|
@ -33,6 +33,8 @@ public class EncryptServiceContext @MiraiInternalApi constructor(
|
|||||||
public val KEY_CHANNEL_PROXY: TypeKey<EncryptService.ChannelProxy> = TypeKey("KEY_CHANNEL_PROXY")
|
public val KEY_CHANNEL_PROXY: TypeKey<EncryptService.ChannelProxy> = TypeKey("KEY_CHANNEL_PROXY")
|
||||||
public val KEY_DEVICE_INFO: TypeKey<DeviceInfo> = TypeKey("KEY_DEVICE_INFO")
|
public val KEY_DEVICE_INFO: TypeKey<DeviceInfo> = TypeKey("KEY_DEVICE_INFO")
|
||||||
public val KEY_QIMEI36: TypeKey<String> = TypeKey("KEY_QIMEI36")
|
public val KEY_QIMEI36: TypeKey<String> = TypeKey("KEY_QIMEI36")
|
||||||
|
public val KEY_BOT_WORKING_DIR: TypeKey<String> = TypeKey("KEY_BOT_WORKING_DIR")
|
||||||
|
public val KEY_BOT_CACHING_DIR: TypeKey<String> = TypeKey("KEY_BOT_CACHING_DIR")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user