mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-11 05:40:41 +00:00
- Added `/file/1/{digest}` route to support file retrieval without specifying the algorithm.
- Implemented a Python-compatible JSON serializer to ensure consistent formatting for catalog artifacts.
- Replaced `HashMap` with `BTreeMap` for deterministic ordering in catalog serialization and updates.
- Updated integration tests to validate the new route functionality and ensure response correctness.
- Refactored `format_iso8601_basic` to improve timestamp formatting consistency.
46 lines
1.6 KiB
Rust
46 lines
1.6 KiB
Rust
use crate::http::admin;
|
|
use crate::http::handlers::{catalog, file, info, manifest, publisher, versions};
|
|
use crate::repo::DepotRepo;
|
|
use axum::{
|
|
Router,
|
|
routing::{get, post},
|
|
};
|
|
use std::sync::Arc;
|
|
use tower_http::trace::TraceLayer;
|
|
|
|
pub fn app_router(state: Arc<DepotRepo>) -> Router {
|
|
Router::new()
|
|
.route("/versions/0/", get(versions::get_versions))
|
|
.route(
|
|
"/{publisher}/catalog/1/{filename}",
|
|
get(catalog::get_catalog_v1).head(catalog::get_catalog_v1),
|
|
)
|
|
.route(
|
|
"/{publisher}/manifest/0/{fmri}",
|
|
get(manifest::get_manifest).head(manifest::get_manifest),
|
|
)
|
|
.route(
|
|
"/{publisher}/manifest/1/{fmri}",
|
|
get(manifest::get_manifest).head(manifest::get_manifest),
|
|
)
|
|
.route(
|
|
"/{publisher}/file/0/{algo}/{digest}",
|
|
get(file::get_file).head(file::get_file),
|
|
)
|
|
.route(
|
|
"/{publisher}/file/1/{algo}/{digest}",
|
|
get(file::get_file).head(file::get_file),
|
|
)
|
|
.route(
|
|
"/{publisher}/file/1/{digest}",
|
|
get(file::get_file_no_algo).head(file::get_file_no_algo),
|
|
)
|
|
.route("/{publisher}/info/0/{fmri}", get(info::get_info))
|
|
.route("/{publisher}/publisher/0", get(publisher::get_publisher_v0))
|
|
.route("/{publisher}/publisher/1", get(publisher::get_publisher_v1))
|
|
// Admin API over HTTP
|
|
.route("/admin/health", get(admin::health))
|
|
.route("/admin/auth/check", post(admin::auth_check))
|
|
.layer(TraceLayer::new_for_http())
|
|
.with_state(state)
|
|
}
|