fix: head void_cat_redirect
This commit is contained in:
parent
4f40efa99c
commit
5530f39779
@ -73,7 +73,7 @@ async fn main() -> Result<(), Error> {
|
|||||||
.attach(Shield::new()) // disable
|
.attach(Shield::new()) // disable
|
||||||
.mount(
|
.mount(
|
||||||
"/",
|
"/",
|
||||||
routes![root, get_blob, head_blob, routes::void_cat_redirect],
|
routes![root, get_blob, head_blob, routes::void_cat_redirect, routes::void_cat_redirect_head],
|
||||||
)
|
)
|
||||||
.mount("/admin", routes::admin_routes());
|
.mount("/admin", routes::admin_routes());
|
||||||
|
|
||||||
|
@ -451,3 +451,24 @@ pub async fn void_cat_redirect(id: &str, settings: &State<Settings>) -> Option<N
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rocket::head("/d/<id>")]
|
||||||
|
pub async fn void_cat_redirect_head(id: &str) -> VoidCatFile {
|
||||||
|
let id = if id.contains(".") {
|
||||||
|
id.split('.').next().unwrap()
|
||||||
|
} else {
|
||||||
|
id
|
||||||
|
};
|
||||||
|
let uuid =
|
||||||
|
uuid::Uuid::from_slice_le(nostr::bitcoin::base58::decode(id).unwrap().as_slice()).unwrap();
|
||||||
|
VoidCatFile {
|
||||||
|
status: Status::Ok,
|
||||||
|
uuid: Header::new("X-UUID", uuid.to_string()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Responder)]
|
||||||
|
pub struct VoidCatFile {
|
||||||
|
pub status: Status,
|
||||||
|
pub uuid: Header<'static>,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user