- 应用外壳换成 stash-ui Layout:左侧导航(任务调度 / Python 镜像)+ 页面标题区,窄屏折叠为顶部导航 - 新增 python_mirrors 表与 CRUD/设默认接口,内置清华、阿里云、中科大、PyPI 官方 - Python 脚本任务运行时注入默认镜像的 PIP_INDEX_URL / UV_INDEX_URL,任务自身环境变量优先 - 新增镜像管理页与表单,支持新增、编辑、启用/停用、设默认、删除 - 重新生成 OpenAPI 与 TS 类型;补齐后端镜像测试、前端单测与 e2e,修复窄屏页面被宽表格撑开
44 lines
1.0 KiB
Rust
44 lines
1.0 KiB
Rust
pub mod api;
|
|
pub mod cron;
|
|
pub mod database;
|
|
pub mod directory_browser;
|
|
pub mod error;
|
|
pub mod process_job;
|
|
pub mod python_env;
|
|
pub mod python_mirrors;
|
|
pub mod runs;
|
|
pub mod scheduler;
|
|
pub mod security;
|
|
pub mod state;
|
|
pub mod tasks;
|
|
|
|
use axum::Router;
|
|
use sqlx::SqlitePool;
|
|
use tower_http::{
|
|
services::{ServeDir, ServeFile},
|
|
trace::TraceLayer,
|
|
};
|
|
|
|
pub async fn app(
|
|
pool: SqlitePool,
|
|
logs_dir: std::path::PathBuf,
|
|
) -> crate::error::ApiResult<Router> {
|
|
let state = state::AppState::start(pool, logs_dir).await?;
|
|
Ok(router(state))
|
|
}
|
|
|
|
pub fn router(state: state::AppState) -> Router {
|
|
api::router(state).layer(TraceLayer::new_for_http())
|
|
}
|
|
|
|
pub fn router_with_static(state: state::AppState, static_dir: std::path::PathBuf) -> Router {
|
|
let index = static_dir.join("index.html");
|
|
let router = if index.is_file() {
|
|
api::router(state)
|
|
.fallback_service(ServeDir::new(&static_dir).fallback(ServeFile::new(index)))
|
|
} else {
|
|
api::router(state)
|
|
};
|
|
router.layer(TraceLayer::new_for_http())
|
|
}
|