add Shield to remove warning
This commit is contained in:
parent
717e92b506
commit
e4172bd159
@ -1,6 +1,6 @@
|
|||||||
#[macro_use] extern crate rocket;
|
#[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_dyn_templates::{Template, context};
|
||||||
use rocket::fs::FileServer;
|
use rocket::fs::FileServer;
|
||||||
use rocket::shield::Shield;
|
use rocket::shield::Shield;
|
||||||
@ -51,10 +51,13 @@ fn index(ip: IpAddr) -> Template {
|
|||||||
|
|
||||||
#[launch]
|
#[launch]
|
||||||
fn rocket() -> _ {
|
fn rocket() -> _ {
|
||||||
|
let shield = Shield::new()
|
||||||
|
.enable(Hsts::Enable(Duration::MAX))
|
||||||
|
.enable(NoSniff::Enable);
|
||||||
rocket::build()
|
rocket::build()
|
||||||
.mount("/", routes![index, login])
|
.mount("/", routes![index, login])
|
||||||
.mount("/static", FileServer::from("static")) // Serves files in the `static` directory
|
.mount("/static", FileServer::from("static")) // Serves files in the `static` directory
|
||||||
.attach(Shield::new())
|
.attach(shield)
|
||||||
.attach(Template::fairing())
|
.attach(Template::fairing())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user