Update WebfingerService, cache lookup

pull/2103/head
Daniel Supernault 5 years ago
parent 6df36a8a7c
commit 8b9faf3179
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -3,6 +3,7 @@
namespace App\Services;
use Cache;
use App\Profile;
use Illuminate\Support\Facades\Redis;
use App\Util\Webfinger\WebfingerUrl;
use Zttp\Zttp;
@ -21,6 +22,12 @@ class WebfingerService
protected function run($query)
{
if($profile = Profile::whereUsername($query)->first()) {
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
return $fractal->createData($resource)->toArray();
}
$url = WebfingerUrl::generateWebfingerUrl($query);
if(!Helpers::validateUrl($url)) {
return [];

Loading…
Cancel
Save