丢点更新上去
This commit is contained in:
parent
8c52d898ff
commit
4da93570c9
@ -10,7 +10,7 @@ use crate::config::IcaConfig;
|
||||
use crate::error::{ClientResult, IcaError};
|
||||
use crate::StopGetter;
|
||||
|
||||
const ICA_PROTOCOL_VERSION: &str = "2.12.11";
|
||||
const ICA_PROTOCOL_VERSION: &str = "2.12.12";
|
||||
|
||||
pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientResult<(), IcaError> {
|
||||
let span = span!(Level::INFO, "Icalingua Client");
|
||||
|
@ -7,7 +7,7 @@ use ed25519_dalek::{Signature, Signer, SigningKey};
|
||||
use rust_socketio::asynchronous::Client;
|
||||
use rust_socketio::Payload;
|
||||
use serde_json::Value;
|
||||
use tracing::{debug, info, span, warn, Level};
|
||||
use tracing::{debug, info, span, warn, event, Level};
|
||||
|
||||
/// "安全" 的 发送一条消息
|
||||
pub async fn send_message(client: &Client, message: &SendMessage) -> bool {
|
||||
@ -56,7 +56,7 @@ async fn inner_sign(payload: Payload, client: Client) -> ClientResult<(), IcaErr
|
||||
|
||||
let (auth_key, version) = (&require_data[0], &require_data[1]);
|
||||
|
||||
info!("auth_key: {:?}, server_version: {:?}", auth_key, version);
|
||||
event!(Level::INFO, "服务器发过来的待签名key: {:?}, 服务端版本号: {:?}", auth_key, version);
|
||||
// 判定和自己的兼容版本号是否 一致
|
||||
let server_protocol_version = version
|
||||
.get("protocolVersion")
|
||||
@ -81,15 +81,15 @@ async fn inner_sign(payload: Payload, client: Client) -> ClientResult<(), IcaErr
|
||||
let private_key = MainStatus::global_config().ica().private_key.clone();
|
||||
|
||||
let array_key: [u8; 32] = hex::decode(private_key)
|
||||
.expect("Not a vaild pub key")
|
||||
.expect("配置文件设置的私钥不是一个有效的私钥, 无法使用hex解析")
|
||||
.try_into()
|
||||
.expect("Not a vaild pub key");
|
||||
.expect("配置文件设置的私钥不是一个有效的私钥, 无法转换为[u8; 32]数组");
|
||||
let signing_key: SigningKey = SigningKey::from_bytes(&array_key);
|
||||
let signature: Signature = signing_key.sign(salt.as_slice());
|
||||
|
||||
// 发送签名
|
||||
let sign = signature.to_bytes().to_vec();
|
||||
client.emit("auth", sign).await.expect("Faild to send signin data");
|
||||
client.emit("auth", sign).await.expect("发送签名信息失败");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,10 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub const ICA_VERSION: &str = "1.6.1";
|
||||
pub const TAILCHAT_VERSION: &str = "1.2.1";
|
||||
|
||||
/// 是否为稳定版本
|
||||
/// 会在 release 的时候设置为 true
|
||||
pub const STABLE: bool = false;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! async_callback_with_state {
|
||||
($f:expr, $state:expr) => {{
|
||||
@ -69,7 +73,10 @@ async fn main() {
|
||||
let span = span!(Level::INFO, "Shenbot Main");
|
||||
let _enter = span.enter();
|
||||
|
||||
event!(Level::INFO, "shenbot-async-rs v{} starting", VERSION);
|
||||
event!(Level::INFO, "shenbot-rs v{} starting", VERSION);
|
||||
if !STABLE {
|
||||
event!(Level::WARN, "这是一个开发版本, 有问题记得找 shenjack");
|
||||
}
|
||||
|
||||
let bot_config = BotConfig::new_from_cli();
|
||||
MainStatus::static_init(bot_config);
|
||||
|
Loading…
Reference in New Issue
Block a user