mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update WebfingerService, cache lookup
This commit is contained in:
parent
6df36a8a7c
commit
8b9faf3179
1 changed files with 7 additions and 0 deletions
|
@ -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…
Reference in a new issue