feat: 模块统一 ias- 前缀、独立版本与内网地址支持 (0.1.7)
- 所有 Rust crate 统一加 ias- 前缀:ai → ias-ai、common → ias-common、context → ias-context、mail → ias-mail、service → ias-service、wechat → ias-wechat - 新增 ias-main 模块承载 CLI 入口和二进制打包 - 各模块开始独立维护版本号,ias-main 0.1.7 代表整体版本 - 新增 IA_WEB_INTERNAL_URL 环境变量,版本通知同时发送公网和内网链接 - 将已有升级日志翻译为中文 - ias_upgrade_logs 新增 modules JSONB 字段 - 新增 VERSION 文件和 CHANGELOG.md - 新增 AGENTS.md 项目规则文件
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
mod cli;
|
||||
|
||||
use clap::Parser;
|
||||
use cli::{Channels, Cli, Commands, MailAction, ServiceAction, WechatAction};
|
||||
use ias_service::{
|
||||
connect_db, delete_account, init_logging, list_accounts, login_user, rename_account,
|
||||
run_service,
|
||||
};
|
||||
use ias_service::supervisor::{
|
||||
print_logs, restart_service, start_service, status_service, stop_service,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
dotenvy::dotenv().ok();
|
||||
init_logging();
|
||||
let cli = Cli::parse();
|
||||
match cli.command {
|
||||
Commands::Service { command } => {
|
||||
let action = command.unwrap_or(ServiceAction::Run);
|
||||
match action {
|
||||
ServiceAction::Run => {
|
||||
let pool = connect_db().await?;
|
||||
run_service(pool).await?;
|
||||
}
|
||||
ServiceAction::Start => start_service().await?,
|
||||
ServiceAction::Stop => stop_service().await?,
|
||||
ServiceAction::Restart => restart_service().await?,
|
||||
ServiceAction::Status => status_service().await?,
|
||||
ServiceAction::Logs { lines } => print_logs(lines)?,
|
||||
}
|
||||
}
|
||||
Commands::Channel { command } => {
|
||||
let pool = connect_db().await?;
|
||||
match command {
|
||||
Channels::Wechat { command } => match command {
|
||||
WechatAction::Login => login_user(&pool).await,
|
||||
WechatAction::List => list_accounts(&pool).await,
|
||||
WechatAction::Delete { account } => delete_account(&pool, account).await,
|
||||
WechatAction::Rename { account, name } => {
|
||||
rename_account(&pool, account, name).await
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Commands::Mail { command } => {
|
||||
let pool = connect_db().await?;
|
||||
match command {
|
||||
MailAction::Auth => ias_mail::auth::auth_account(&pool).await?,
|
||||
MailAction::List => ias_mail::auth::list_accounts(&pool).await?,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user