Set cache control to no-cache for all api endpoints, logging access keys instead of captcha keys

This commit is contained in:
Imbus 2024-03-25 01:54:25 +01:00
parent a2292ffc68
commit 2e600cc6d2

View file

@ -41,7 +41,7 @@ async fn main() -> std::io::Result<()> {
for _ in 0..10 { for _ in 0..10 {
let s = hex_string(10); let s = hex_string(10);
info!("Adding captcha key: {}", &s); info!("Adding access key: {}", &s);
capt_db.capthca_db.lock().unwrap().insert(s); capt_db.capthca_db.lock().unwrap().insert(s);
} }
@ -68,6 +68,10 @@ async fn main() -> std::io::Result<()> {
) )
.service( .service(
scope("/api") scope("/api")
.wrap(
middleware::DefaultHeaders::new()
.add(CacheControl(vec![CacheDirective::NoCache])),
)
.service(get_posts) .service(get_posts)
.service(new_post) .service(new_post)
.service(delete_post) .service(delete_post)