init
This commit is contained in:
commit
dae8fed78f
6 changed files with 3690 additions and 0 deletions
37
src/main.rs
Normal file
37
src/main.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use based::request::assets::DataResponse;
|
||||
use rocket::{get, launch, routes};
|
||||
|
||||
#[get("/")]
|
||||
pub async fn index() -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
#[get("/rootfs/<arch>/rootfs.tar.xz")]
|
||||
pub async fn rootfs_tar(arch: &str) -> DataResponse {
|
||||
match arch {
|
||||
"aarch64" => {
|
||||
DataResponse::new_file("./tar/aarch64.tar.xz", "application/tar".to_string(), Some(60 * 60))
|
||||
},
|
||||
"x86_64" => {
|
||||
DataResponse::new_file("./tar/x86_64.tar.xz", "application/tar".to_string(), Some(60 * 60))
|
||||
},
|
||||
_ => {
|
||||
DataResponse::new("Weird arch".as_bytes().to_vec(), "text/plain".to_string(), None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[launch]
|
||||
async fn rocket() -> _ {
|
||||
env_logger::init();
|
||||
|
||||
rocket::build()
|
||||
.mount(
|
||||
"/",
|
||||
routes![
|
||||
index,
|
||||
rootfs_tar
|
||||
],
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue