Update AP Helpers
This commit is contained in:
parent
7d376c64ec
commit
fa0df4004c
|
@ -245,7 +245,8 @@ class Helpers {
|
|||
if($local) {
|
||||
$id = (int) last(explode('/', $url));
|
||||
return Status::whereNotIn('scope', ['draft','archived'])->findOrFail($id);
|
||||
} else {
|
||||
}
|
||||
|
||||
$cached = Status::whereNotIn('scope', ['draft','archived'])
|
||||
->whereUri($url)
|
||||
->orWhere('object_url', $url)
|
||||
|
@ -295,7 +296,7 @@ class Helpers {
|
|||
$keywords = config('costar.keyword.block');
|
||||
foreach($keywords as $kw) {
|
||||
if(Str::contains($res['content'], $kw) == true) {
|
||||
abort(400, 'Invalid object');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,21 +316,25 @@ class Helpers {
|
|||
}
|
||||
|
||||
$id = isset($res['id']) ? $res['id'] : $url;
|
||||
$idDomain = parse_url($id, PHP_URL_HOST);
|
||||
$urlDomain = parse_url($url, PHP_URL_HOST);
|
||||
|
||||
if(!self::validateUrl($id) ||
|
||||
!self::validateUrl($activity['object']['attributedTo'])
|
||||
) {
|
||||
if(!self::validateUrl($id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$idDomain = parse_url($id, PHP_URL_HOST);
|
||||
$urlDomain = parse_url($url, PHP_URL_HOST);
|
||||
if(isset($activity['object']['attributedTo'])) {
|
||||
$actorDomain = parse_url($activity['object']['attributedTo'], PHP_URL_HOST);
|
||||
if(!self::validateUrl($activity['object']['attributedTo']) ||
|
||||
$idDomain !== $actorDomain)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(
|
||||
$idDomain !== $urlDomain ||
|
||||
$actorDomain !== $urlDomain ||
|
||||
$idDomain !== $actorDomain
|
||||
$actorDomain !== $urlDomain
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -365,10 +370,8 @@ class Helpers {
|
|||
return $status;
|
||||
});
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
public static function statusFetch($url)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue