Also return json for long accept header with profile link (ref #1216) #114

Merged
dessalines merged 1 commits from json-headers into main 2020-10-21 16:33:35 +00:00
1 changed files with 7 additions and 1 deletions

View File

@ -13,15 +13,21 @@ use lemmy_apub::{
use lemmy_utils::settings::Settings;
use sha2::{Digest, Sha256};
static APUB_JSON_CONTENT_TYPE_LONG: &str =
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"";
Review

Why not move this to the lib.rs right below the other one, or that one here.

Why not move this to the lib.rs right below the other one, or that one here.
Review

The other one is also used for outgoing requests, so its reasonable to have it as a public var. This one is only used here, so I'm not sure if that makes sense. But I can change it if you want.

The other one is also used for outgoing requests, so its reasonable to have it as a public var. This one is only used here, so I'm not sure if that makes sense. But I can change it if you want.
Review

Ah, that's fine then. I'll just wait for it to pass then merge.

https://travis-ci.org/github/LemmyNet/lemmy/builds/737740876

Ah, that's fine then. I'll just wait for it to pass then merge. https://travis-ci.org/github/LemmyNet/lemmy/builds/737740876
pub fn config(cfg: &mut web::ServiceConfig) {
if Settings::get().federation.enabled {
println!("federation enabled, host is {}", Settings::get().hostname);
let digest_verifier = VerifyDigest::new(Sha256::new());
let header_guard = guard::Any(guard::Header("Accept", APUB_JSON_CONTENT_TYPE))
.or(guard::Header("Accept", APUB_JSON_CONTENT_TYPE_LONG));
cfg
.service(
web::scope("/")
.guard(guard::Header("Accept", APUB_JSON_CONTENT_TYPE))
.guard(header_guard)
.route(
"/c/{community_name}",
web::get().to(get_apub_community_http),