Update InboxPipeline, fix peertube attributedTo parsing

This commit is contained in:
Daniel Supernault 2022-09-01 05:15:20 -06:00
parent 50b3369a09
commit 99fb80bf5d
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 29 additions and 5 deletions

View file

@ -140,7 +140,15 @@ class DeleteWorker implements ShouldQueue
&& is_array($bodyDecoded['object']) && is_array($bodyDecoded['object'])
&& isset($bodyDecoded['object']['attributedTo']) && isset($bodyDecoded['object']['attributedTo'])
) { ) {
if(parse_url($bodyDecoded['object']['attributedTo'], PHP_URL_HOST) !== $keyDomain) { $attr = Helpers::pluckval($bodyDecoded['object']['attributedTo']);
if(is_array($attr)) {
if(isset($attr['id'])) {
$attr = $attr['id'];
} else {
$attr = "";
}
}
if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) {
return; return;
} }
} }

View file

@ -167,7 +167,15 @@ class InboxValidator implements ShouldQueue
&& is_array($bodyDecoded['object']) && is_array($bodyDecoded['object'])
&& isset($bodyDecoded['object']['attributedTo']) && isset($bodyDecoded['object']['attributedTo'])
) { ) {
if(parse_url(Helpers::pluckval($bodyDecoded['object']['attributedTo']), PHP_URL_HOST) !== $keyDomain) { $attr = Helpers::pluckval($bodyDecoded['object']['attributedTo']);
if(is_array($attr)) {
if(isset($attr['id'])) {
$attr = $attr['id'];
} else {
$attr = "";
}
}
if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) {
return; return;
} }
} }

View file

@ -157,7 +157,15 @@ class InboxWorker implements ShouldQueue
&& is_array($bodyDecoded['object']) && is_array($bodyDecoded['object'])
&& isset($bodyDecoded['object']['attributedTo']) && isset($bodyDecoded['object']['attributedTo'])
) { ) {
if(parse_url(Helpers::pluckval($bodyDecoded['object']['attributedTo']), PHP_URL_HOST) !== $keyDomain) { $attr = Helpers::pluckval($bodyDecoded['object']['attributedTo']);
if(is_array($attr)) {
if(isset($attr['id'])) {
$attr = $attr['id'];
} else {
$attr = "";
}
}
if(parse_url($attr, PHP_URL_HOST) !== $keyDomain) {
return; return;
} }
} }