mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 21:43:17 +00:00
commit
637cb62a94
1 changed files with 9 additions and 4 deletions
|
@ -247,10 +247,13 @@ class Helpers {
|
||||||
->whereUri($url)
|
->whereUri($url)
|
||||||
->orWhere('object_url', $url)
|
->orWhere('object_url', $url)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($cached) {
|
if($cached) {
|
||||||
return $cached;
|
return $cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = self::fetchFromUrl($url);
|
$res = self::fetchFromUrl($url);
|
||||||
|
|
||||||
if(!$res || empty($res)) {
|
if(!$res || empty($res)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -308,13 +311,15 @@ class Helpers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!self::validateUrl($activity['id']) ||
|
$id = isset($res['id']) ? $res['id'] : $url;
|
||||||
|
|
||||||
|
if(!self::validateUrl($id) ||
|
||||||
!self::validateUrl($activity['object']['attributedTo'])
|
!self::validateUrl($activity['object']['attributedTo'])
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$idDomain = parse_url($activity['id'], PHP_URL_HOST);
|
$idDomain = parse_url($id, PHP_URL_HOST);
|
||||||
$urlDomain = parse_url($url, PHP_URL_HOST);
|
$urlDomain = parse_url($url, PHP_URL_HOST);
|
||||||
$actorDomain = parse_url($activity['object']['attributedTo'], PHP_URL_HOST);
|
$actorDomain = parse_url($activity['object']['attributedTo'], PHP_URL_HOST);
|
||||||
|
|
||||||
|
@ -334,12 +339,12 @@ class Helpers {
|
||||||
$reply_to = null;
|
$reply_to = null;
|
||||||
}
|
}
|
||||||
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
|
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
|
||||||
$status = DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope) {
|
$status = DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) {
|
||||||
$status = new Status;
|
$status = new Status;
|
||||||
$status->profile_id = $profile->id;
|
$status->profile_id = $profile->id;
|
||||||
$status->url = isset($res['url']) ? $res['url'] : $url;
|
$status->url = isset($res['url']) ? $res['url'] : $url;
|
||||||
$status->uri = isset($res['url']) ? $res['url'] : $url;
|
$status->uri = isset($res['url']) ? $res['url'] : $url;
|
||||||
$status->object_url = isset($activity['id']) ? $activity['id'] : $url;
|
$status->object_url = $id;
|
||||||
$status->caption = strip_tags($res['content']);
|
$status->caption = strip_tags($res['content']);
|
||||||
$status->rendered = Purify::clean($res['content']);
|
$status->rendered = Purify::clean($res['content']);
|
||||||
$status->created_at = Carbon::parse($ts);
|
$status->created_at = Carbon::parse($ts);
|
||||||
|
|
Loading…
Reference in a new issue