fix
This commit is contained in:
parent
dae8fed78f
commit
736d41513b
1 changed files with 16 additions and 18 deletions
34
src/main.rs
34
src/main.rs
|
@ -9,29 +9,27 @@ pub async fn index() -> String {
|
||||||
#[get("/rootfs/<arch>/rootfs.tar.xz")]
|
#[get("/rootfs/<arch>/rootfs.tar.xz")]
|
||||||
pub async fn rootfs_tar(arch: &str) -> DataResponse {
|
pub async fn rootfs_tar(arch: &str) -> DataResponse {
|
||||||
match arch {
|
match arch {
|
||||||
"aarch64" => {
|
"aarch64" | "arm64" => DataResponse::new_file(
|
||||||
DataResponse::new_file("./tar/aarch64.tar.xz", "application/tar".to_string(), Some(60 * 60))
|
"./tar/aarch64.tar.xz",
|
||||||
},
|
"application/tar".to_string(),
|
||||||
"x86_64" => {
|
Some(60 * 60),
|
||||||
DataResponse::new_file("./tar/x86_64.tar.xz", "application/tar".to_string(), Some(60 * 60))
|
),
|
||||||
},
|
"x86_64" | "amd64" => DataResponse::new_file(
|
||||||
_ => {
|
"./tar/x86_64.tar.xz",
|
||||||
DataResponse::new("Weird arch".as_bytes().to_vec(), "text/plain".to_string(), None)
|
"application/tar".to_string(),
|
||||||
}
|
Some(60 * 60),
|
||||||
|
),
|
||||||
|
_ => DataResponse::new(
|
||||||
|
"Weird arch".as_bytes().to_vec(),
|
||||||
|
"text/plain".to_string(),
|
||||||
|
None,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[launch]
|
#[launch]
|
||||||
async fn rocket() -> _ {
|
async fn rocket() -> _ {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
rocket::build()
|
rocket::build().mount("/", routes![index, rootfs_tar])
|
||||||
.mount(
|
|
||||||
"/",
|
|
||||||
routes![
|
|
||||||
index,
|
|
||||||
rootfs_tar
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue