|
|
@ -161,13 +161,13 @@ class Helpers {
|
|
|
|
|
|
|
|
|
|
|
|
$host = parse_url($valid, PHP_URL_HOST);
|
|
|
|
$host = parse_url($valid, PHP_URL_HOST);
|
|
|
|
|
|
|
|
|
|
|
|
if(count(dns_get_record($host, DNS_A | DNS_AAAA)) == 0) {
|
|
|
|
// if(count(dns_get_record($host, DNS_A | DNS_AAAA)) == 0) {
|
|
|
|
return false;
|
|
|
|
// return false;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(config('costar.enabled') == true) {
|
|
|
|
if(config('costar.enabled') == true) {
|
|
|
|
if(
|
|
|
|
if(
|
|
|
|
(config('costar.domain.block') != null && Str::contains($host, config('costar.domain.block')) == true) ||
|
|
|
|
(config('costar.domain.block') != null && Str::contains($host, config('costar.domain.block')) == true) ||
|
|
|
|
(config('costar.actor.block') != null && in_array($url, config('costar.actor.block')) == true)
|
|
|
|
(config('costar.actor.block') != null && in_array($url, config('costar.actor.block')) == true)
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -257,7 +257,7 @@ class Helpers {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$res = self::fetchFromUrl($url);
|
|
|
|
$res = self::fetchFromUrl($url);
|
|
|
|
|
|
|
|
|
|
|
|
if(!$res || empty($res) || isset($res['error']) ) {
|
|
|
|
if(!$res || empty($res) || isset($res['error']) ) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -269,7 +269,7 @@ class Helpers {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$scope = 'private';
|
|
|
|
$scope = 'private';
|
|
|
|
|
|
|
|
|
|
|
|
$cw = isset($res['sensitive']) ? (bool) $res['sensitive'] : false;
|
|
|
|
$cw = isset($res['sensitive']) ? (bool) $res['sensitive'] : false;
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($res['to']) == true) {
|
|
|
|
if(isset($res['to']) == true) {
|
|
|
@ -312,7 +312,7 @@ class Helpers {
|
|
|
|
$cwDomains = config('costar.domain.cw');
|
|
|
|
$cwDomains = config('costar.domain.cw');
|
|
|
|
if(in_array(parse_url($url, PHP_URL_HOST), $cwDomains) == true) {
|
|
|
|
if(in_array(parse_url($url, PHP_URL_HOST), $cwDomains) == true) {
|
|
|
|
$cw = true;
|
|
|
|
$cw = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$id = isset($res['id']) ? $res['id'] : $url;
|
|
|
|
$id = isset($res['id']) ? $res['id'] : $url;
|
|
|
@ -350,13 +350,13 @@ class Helpers {
|
|
|
|
$statusLockKey = 'helpers:status-lock:' . hash('sha256', $res['id']);
|
|
|
|
$statusLockKey = 'helpers:status-lock:' . hash('sha256', $res['id']);
|
|
|
|
$status = Cache::lock($statusLockKey)
|
|
|
|
$status = Cache::lock($statusLockKey)
|
|
|
|
->get(function () use(
|
|
|
|
->get(function () use(
|
|
|
|
$profile,
|
|
|
|
$profile,
|
|
|
|
$res,
|
|
|
|
$res,
|
|
|
|
$url,
|
|
|
|
$url,
|
|
|
|
$ts,
|
|
|
|
$ts,
|
|
|
|
$reply_to,
|
|
|
|
$reply_to,
|
|
|
|
$cw,
|
|
|
|
$cw,
|
|
|
|
$scope,
|
|
|
|
$scope,
|
|
|
|
$id
|
|
|
|
$id
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) {
|
|
|
|
return DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) {
|
|
|
@ -426,7 +426,7 @@ class Helpers {
|
|
|
|
MediaStoragePipeline::dispatch($media);
|
|
|
|
MediaStoragePipeline::dispatch($media);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$status->viewType();
|
|
|
|
$status->viewType();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -497,7 +497,7 @@ class Helpers {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Update info after 24 hours
|
|
|
|
// Update info after 24 hours
|
|
|
|
if($profile->last_fetched_at == null ||
|
|
|
|
if($profile->last_fetched_at == null ||
|
|
|
|
$profile->last_fetched_at->lt(now()->subHours(24)) == true
|
|
|
|
$profile->last_fetched_at->lt(now()->subHours(24)) == true
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
$profile->name = isset($res['name']) ? Purify::clean($res['name']) : 'user';
|
|
|
|
$profile->name = isset($res['name']) ? Purify::clean($res['name']) : 'user';
|
|
|
|