From 5e46922ed0eba18da9309a024d92b72897e3d01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Mon, 19 Aug 2019 22:39:48 +0200 Subject: [PATCH] validate custom domain! --- Cargo.lock | 1 + Cargo.toml | 1 + src/main.rs | 1 + src/routes/blogs.rs | 10 ++++++++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91f7f611..39ebce75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1973,6 +1973,7 @@ dependencies = [ "plume-api 0.3.0", "plume-common 0.3.0", "plume-models 0.3.0", + "reqwest 0.9.19 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_contrib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_csrf 0.1.0 (git+https://github.com/fdb-hiroshima/rocket_csrf?rev=4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c)", diff --git a/Cargo.toml b/Cargo.toml index 0254f681..a6495f19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ heck = "0.3.0" lettre = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" } lettre_email = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" } num_cpus = "1.10" +reqwest = "0.9" rocket = "0.4.0" rocket_contrib = { version = "0.4.0", features = ["json"] } rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" } diff --git a/src/main.rs b/src/main.rs index f9aaba9e..42640992 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ extern crate num_cpus; extern crate plume_api; extern crate plume_common; extern crate plume_models; +extern crate reqwest; #[macro_use] extern crate rocket; extern crate rocket_contrib; diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 7c6b3497..12da8e4e 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -19,6 +19,7 @@ use plume_models::{ blog_authors::*, blogs::*, instance::Instance, medias::*, posts::Post, safe_string::SafeString, users::User, Connection, PlumeRocket, }; +use reqwest::Client; use routes::{errors::ErrorPage, Page, RespondOrRedirect}; use template_utils::{IntoContext, Ructe}; @@ -183,12 +184,17 @@ fn valid_domain(domain: &str, valid_domains: State