feat: 统一 JSON API 到 /v1 前缀,移除旧邮件兼容路由
- 删除旧邮件查询兼容路由 GET /mail-api/messages、/mail-api/messages/{id}、/mail-api/search
- 所有 JSON API 统一使用 /v1/...:邮件、上下文记忆、动态页面创建和健康检查接口
- 页面路由保持非 /v1 地址:/mail、/mail/messages/{id}、/mail/{slug}、/web/{page_type}/{slug}、/updates
- AI 内部工具调用同步改用 /v1/web/pages 与 /v1/context/memories...
- 无数据库结构变化,新增 0.1.14 升级日志记录
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ias-main"
|
||||
version = "0.1.7"
|
||||
version = "0.1.14"
|
||||
edition = "2024"
|
||||
|
||||
[[bin]]
|
||||
|
||||
@@ -86,4 +86,53 @@ pub enum MailAction {
|
||||
Auth,
|
||||
/// 查看已经配置的邮件账户
|
||||
List,
|
||||
/// 查看单个邮件账户详情
|
||||
Show {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 修改邮件账户配置
|
||||
Edit {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 检查邮件账户 IMAP 连通性
|
||||
Check {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 手动拉取最新邮件
|
||||
Pull {
|
||||
/// 邮件账户 ID;不提供时拉取所有启用账户
|
||||
id: Option<i64>,
|
||||
},
|
||||
/// 删除邮件账户
|
||||
Delete {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 启用邮件账户
|
||||
Enable {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 禁用邮件账户
|
||||
Disable {
|
||||
/// 邮件账户 ID
|
||||
id: i64,
|
||||
},
|
||||
/// 分页列出邮件
|
||||
Messages {
|
||||
/// 页码 (从 1 开始)
|
||||
#[arg(short, long, default_value_t = 1)]
|
||||
page: i64,
|
||||
/// 每页数量
|
||||
#[arg(short = 'n', long, default_value_t = 20)]
|
||||
per_page: i64,
|
||||
},
|
||||
/// 查看邮件内容
|
||||
Message {
|
||||
/// 邮件 ID
|
||||
id: i64,
|
||||
},
|
||||
}
|
||||
|
||||
+18
-3
@@ -2,13 +2,13 @@ mod cli;
|
||||
|
||||
use clap::Parser;
|
||||
use cli::{Channels, Cli, Commands, MailAction, ServiceAction, WechatAction};
|
||||
use ias_service::supervisor::{
|
||||
print_logs, restart_service, start_service, status_service, stop_service,
|
||||
};
|
||||
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<()> {
|
||||
@@ -48,6 +48,21 @@ async fn main() -> anyhow::Result<()> {
|
||||
match command {
|
||||
MailAction::Auth => ias_mail::auth::auth_account(&pool).await?,
|
||||
MailAction::List => ias_mail::auth::list_accounts(&pool).await?,
|
||||
MailAction::Show { id } => ias_mail::auth::show_account(&pool, id).await?,
|
||||
MailAction::Edit { id } => ias_mail::auth::edit_account(&pool, id).await?,
|
||||
MailAction::Check { id } => ias_mail::auth::check_account(&pool, id).await?,
|
||||
MailAction::Pull { id } => ias_mail::auth::pull_mail(&pool, id).await?,
|
||||
MailAction::Delete { id } => ias_mail::auth::delete_account(&pool, id).await?,
|
||||
MailAction::Enable { id } => {
|
||||
ias_mail::auth::enable_account(&pool, id, true).await?
|
||||
}
|
||||
MailAction::Disable { id } => {
|
||||
ias_mail::auth::enable_account(&pool, id, false).await?
|
||||
}
|
||||
MailAction::Messages { page, per_page } => {
|
||||
ias_mail::auth::list_messages(&pool, page, per_page).await?
|
||||
}
|
||||
MailAction::Message { id } => ias_mail::auth::show_message(&pool, id).await?,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user