Add option to change invitation org name, fixes #825

Add option to allow additional iframe ancestors, fixes #843
Sort the rocket routes before printing them
This commit is contained in:
Daniel García
2020-02-04 22:14:50 +01:00
parent f5916ec396
commit 8867626de8
3 changed files with 14 additions and 5 deletions

View File

@ -7,6 +7,8 @@ use rocket::response::{self, Responder};
use rocket::{Data, Request, Response, Rocket};
use std::io::Cursor;
use crate::CONFIG;
pub struct AppHeaders();
impl Fairing for AppHeaders {
@ -23,7 +25,7 @@ impl Fairing for AppHeaders {
res.set_raw_header("X-Frame-Options", "SAMEORIGIN");
res.set_raw_header("X-Content-Type-Options", "nosniff");
res.set_raw_header("X-XSS-Protection", "1; mode=block");
let csp = "frame-ancestors 'self' chrome-extension://nngceckbapebfimnlniiiahkandclblb moz-extension://*;";
let csp = format!("frame-ancestors 'self' chrome-extension://nngceckbapebfimnlniiiahkandclblb moz-extension://* {};", CONFIG.allowed_iframe_ancestors());
res.set_raw_header("Content-Security-Policy", csp);
// Disable cache unless otherwise specified
@ -131,7 +133,9 @@ impl Fairing for BetterLogging {
fn on_launch(&self, rocket: &Rocket) {
if self.0 {
info!(target: "routes", "Routes loaded:");
for route in rocket.routes() {
let mut routes: Vec<_> = rocket.routes().collect();
routes.sort_by_key(|r| r.uri.path());
for route in routes {
if route.rank < 0 {
info!(target: "routes", "{:<6} {}", route.method, route.uri);
} else {