]> Untitled Git - lemmy.git/blobdiff - server/src/lib.rs
Merge branch 'dev' into federation
[lemmy.git] / server / src / lib.rs
index 0012c73fe439b85e4800c1d2cf2bc7bcb64bf56e..2c78cfc2643d3813a10027daf06dcf5868a2bce2 100644 (file)
@@ -11,13 +11,16 @@ pub extern crate actix;
 pub extern crate actix_web;
 pub extern crate bcrypt;
 pub extern crate chrono;
+pub extern crate comrak;
 pub extern crate dotenv;
 pub extern crate jsonwebtoken;
 pub extern crate lettre;
 pub extern crate lettre_email;
 extern crate log;
+pub extern crate openssl;
 pub extern crate rand;
 pub extern crate regex;
+pub extern crate rss;
 pub extern crate serde;
 pub extern crate serde_json;
 pub extern crate sha2;
@@ -112,7 +115,7 @@ pub fn send_email(
   to_username: &str,
   html: &str,
 ) -> Result<(), String> {
-  let email_config = Settings::get().email.as_ref().ok_or("no_email_setup")?;
+  let email_config = Settings::get().email.ok_or("no_email_setup")?;
 
   let email = Email::builder()
     .to((to_email, to_username))
@@ -127,7 +130,7 @@ pub fn send_email(
   } else {
     SmtpClient::new(&email_config.smtp_server, ClientSecurity::None).unwrap()
   }
-  .hello_name(ClientId::Domain(Settings::get().hostname.to_owned()))
+  .hello_name(ClientId::Domain(Settings::get().hostname))
   .smtp_utf8(true)
   .authentication_mechanism(Mechanism::Plain)
   .connection_reuse(ConnectionReuseParameters::ReuseUnlimited);
@@ -220,6 +223,10 @@ fn fetch_iframely_and_pictshare_data(
   )
 }
 
+pub fn markdown_to_html(text: &str) -> String {
+  comrak::markdown_to_html(text, &comrak::ComrakOptions::default())
+}
+
 #[cfg(test)]
 mod tests {
   use crate::{extract_usernames, is_email_regex, remove_slurs, slur_check, slurs_vec_to_str};