From e4172bd15981db4de839a1d58c751f508eeec3f4 Mon Sep 17 00:00:00 2001 From: fabolous005 Date: Tue, 3 Dec 2024 09:06:02 +0100 Subject: [PATCH] add Shield to remove warning --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2480305..750a2d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #[macro_use] extern crate rocket; -use rocket::form::Form; +use rocket::{form::Form, shield::{Hsts, NoSniff}, time::Duration}; use rocket_dyn_templates::{Template, context}; use rocket::fs::FileServer; use rocket::shield::Shield; @@ -51,10 +51,13 @@ fn index(ip: IpAddr) -> Template { #[launch] fn rocket() -> _ { + let shield = Shield::new() + .enable(Hsts::Enable(Duration::MAX)) + .enable(NoSniff::Enable); rocket::build() .mount("/", routes![index, login]) .mount("/static", FileServer::from("static")) // Serves files in the `static` directory - .attach(Shield::new()) + .attach(shield) .attach(Template::fairing()) }