mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-10 00:18:49 -06:00
Merge pull request 'Also return json for long accept header with profile link (ref #1216)' (#114) from json-headers into main
Reviewed-on: https://yerbamate.dev/LemmyNet/lemmy/pulls/114
This commit is contained in:
commit
3e22c99c96
@ -13,15 +13,21 @@ use lemmy_apub::{
|
|||||||
use lemmy_utils::settings::Settings;
|
use lemmy_utils::settings::Settings;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
static APUB_JSON_CONTENT_TYPE_LONG: &str =
|
||||||
|
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"";
|
||||||
|
|
||||||
pub fn config(cfg: &mut web::ServiceConfig) {
|
pub fn config(cfg: &mut web::ServiceConfig) {
|
||||||
if Settings::get().federation.enabled {
|
if Settings::get().federation.enabled {
|
||||||
println!("federation enabled, host is {}", Settings::get().hostname);
|
println!("federation enabled, host is {}", Settings::get().hostname);
|
||||||
let digest_verifier = VerifyDigest::new(Sha256::new());
|
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
|
cfg
|
||||||
.service(
|
.service(
|
||||||
web::scope("/")
|
web::scope("/")
|
||||||
.guard(guard::Header("Accept", APUB_JSON_CONTENT_TYPE))
|
.guard(header_guard)
|
||||||
.route(
|
.route(
|
||||||
"/c/{community_name}",
|
"/c/{community_name}",
|
||||||
web::get().to(get_apub_community_http),
|
web::get().to(get_apub_community_http),
|
||||||
|
Loading…
Reference in New Issue
Block a user