Introduce an environment variable to disable HTTPS, and use it when fetching WebFinger resources

You can now use USE_HTTPS=0 when debugging the federation locally.
This commit is contained in:
Bat
2018-06-26 16:16:59 +02:00
parent 5bbfd9d1e9
commit f805ec1d53
6 changed files with 19 additions and 14 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ use openssl::{
};
use webfinger::*;
use BASE_URL;
use {BASE_URL, USE_HTTPS};
use plume_common::activity_pub::{
ApSignature, ActivityStream, Id, IntoId, PublicKey,
inbox::WithInbox,
@@ -97,7 +97,7 @@ impl Blog {
}
fn fetch_from_webfinger(conn: &PgConnection, acct: String) -> Option<Blog> {
match resolve(acct.clone()) {
match resolve(acct.clone(), *USE_HTTPS) {
Ok(wf) => wf.links.into_iter().find(|l| l.mime_type == Some(String::from("application/activity+json"))).and_then(|l| Blog::fetch_from_url(conn, l.href)),
Err(details) => {
println!("{:?}", details);