diff --git a/docker-compose.yml b/docker-compose.yml index 266754d6..0dc787c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: - CDN_HOST=localhost - MAILER_ADDRESS=noreply@philomena.local - START_ENDPOINT=true + - SITE_DOMAINS=localhost working_dir: /srv/philomena tty: true volumes: diff --git a/native/philomena/Cargo.lock b/native/philomena/Cargo.lock index e725f1ba..49a735fa 100644 --- a/native/philomena/Cargo.lock +++ b/native/philomena/Cargo.lock @@ -103,6 +103,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + [[package]] name = "cc" version = "1.0.70" @@ -143,10 +149,11 @@ dependencies = [ [[package]] name = "comrak" version = "0.12.1" -source = "git+https://github.com/philomena-dev/comrak?branch=main#b9bd7fb744d5cade8355280f4b3b3a8303410595" +source = "git+https://github.com/philomena-dev/comrak?branch=main#52ae6ca7ebcc459e557432991cdbbcea80e10b12" dependencies = [ "clap", "entities", + "http", "lazy_static", "pest", "pest_derive", @@ -256,6 +263,17 @@ dependencies = [ "libc", ] +[[package]] +name = "http" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "idna" version = "0.2.3" diff --git a/native/philomena/src/markdown.rs b/native/philomena/src/markdown.rs index b6345cba..2bbbb75b 100644 --- a/native/philomena/src/markdown.rs +++ b/native/philomena/src/markdown.rs @@ -2,6 +2,7 @@ use comrak::ComrakOptions; use crate::camo; use rustler::{MapIterator, Term}; use std::collections::HashMap; +use std::env; fn common_options() -> ComrakOptions { let mut options = ComrakOptions::default(); @@ -17,6 +18,10 @@ fn common_options() -> ComrakOptions { options.extension.camoifier = Some(|s| camo::image_url(s).unwrap_or_else(|| String::from(""))); + if let Some(domains) = env::var("SITE_DOMAINS").ok() { + options.extension.philomena_domains = Some(domains.split(",").map(|s| s.to_string()).collect::>()); + }; + options }