From 4da93570c9316106d3511361a5a2c5bace00293d Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 17 Aug 2024 21:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=A2=E7=82=B9=E6=9B=B4=E6=96=B0=E4=B8=8A?= =?UTF-8?q?=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/src/ica.rs | 2 +- ica-rs/src/ica/client.rs | 10 +++++----- ica-rs/src/main.rs | 9 ++++++++- news.md | 2 ++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ica-rs/src/ica.rs b/ica-rs/src/ica.rs index 8ad6658..3ddd0fb 100644 --- a/ica-rs/src/ica.rs +++ b/ica-rs/src/ica.rs @@ -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"); diff --git a/ica-rs/src/ica/client.rs b/ica-rs/src/ica/client.rs index 60e0b57..079dc6d 100644 --- a/ica-rs/src/ica/client.rs +++ b/ica-rs/src/ica/client.rs @@ -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(()) } diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 4a6ff12..454263d 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -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); diff --git a/news.md b/news.md index 217e3bb..d5ccfb2 100644 --- a/news.md +++ b/news.md @@ -6,6 +6,8 @@ - 现在会在插件加载时警告你的插件原来定义了 `CONFIG_DATA` 这一项 - `IcaNewMessage` 添加了新的 api - `get_sender_name` 获取发送人昵称 +- `ica` 兼容版本号 `2.12.11` -> `2.12.12` +- 加入了 `STABLE` 信息, 用于标记稳定版本 ## 0.6.10