turn on-site links to relative

This commit is contained in:
Luna D 2021-09-23 00:03:06 +02:00
parent fd867cbbbe
commit 071eecd082
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8
3 changed files with 25 additions and 1 deletions

View file

@ -34,6 +34,7 @@ services:
- CDN_HOST=localhost - CDN_HOST=localhost
- MAILER_ADDRESS=noreply@philomena.local - MAILER_ADDRESS=noreply@philomena.local
- START_ENDPOINT=true - START_ENDPOINT=true
- SITE_DOMAINS=localhost
working_dir: /srv/philomena working_dir: /srv/philomena
tty: true tty: true
volumes: volumes:

View file

@ -103,6 +103,12 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.70" version = "1.0.70"
@ -143,10 +149,11 @@ dependencies = [
[[package]] [[package]]
name = "comrak" name = "comrak"
version = "0.12.1" 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 = [ dependencies = [
"clap", "clap",
"entities", "entities",
"http",
"lazy_static", "lazy_static",
"pest", "pest",
"pest_derive", "pest_derive",
@ -256,6 +263,17 @@ dependencies = [
"libc", "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]] [[package]]
name = "idna" name = "idna"
version = "0.2.3" version = "0.2.3"

View file

@ -2,6 +2,7 @@ use comrak::ComrakOptions;
use crate::camo; use crate::camo;
use rustler::{MapIterator, Term}; use rustler::{MapIterator, Term};
use std::collections::HashMap; use std::collections::HashMap;
use std::env;
fn common_options() -> ComrakOptions { fn common_options() -> ComrakOptions {
let mut options = ComrakOptions::default(); 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(""))); 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::<Vec<String>>());
};
options options
} }