From 9a9776230ce8d12d305ca8db19cc76f20ae40926 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 6 Dec 2021 20:39:04 +0300 Subject: Added support for IndieAuth client sign in This will allow readers to view private posts intended just for them. Additionally fixed bugs in patterns due to which webmentions might not have been sent. --- src/main.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index aec3be0..4f5f9ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,6 +60,24 @@ async fn main() -> Result<(), std::io::Error> { let internal_token: Option = env::var("KITTYBOX_INTERNAL_TOKEN").ok(); + let cookie_secret: String = match env::var("COOKIE_SECRET").ok() { + Some(value) => value, + None => { + if let Some(filename) = env::var("COOKIE_SECRET_FILE").ok() { + use async_std::io::ReadExt; + + let mut file = async_std::fs::File::open(filename).await?; + let mut temp_string = String::new(); + file.read_to_string(&mut temp_string).await?; + + temp_string + } else { + error!("COOKIE_SECRET or COOKIE_SECRET_FILE is not set, will not be able to log in users securely!"); + std::process::exit(1); + } + } + }; + let host = env::var("SERVE_AT") .ok() .unwrap_or_else(|| "0.0.0.0:8080".to_string()); @@ -73,6 +91,7 @@ async fn main() -> Result<(), std::io::Error> { authorization_endpoint, backend_uri, media_endpoint, + cookie_secret, internal_token, ) .await; -- cgit 1.4.1