mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +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;
|
namespace App\Services;
|
||||||
|
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use App\Profile;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
use App\Util\Webfinger\WebfingerUrl;
|
use App\Util\Webfinger\WebfingerUrl;
|
||||||
use Zttp\Zttp;
|
use Zttp\Zttp;
|
||||||
|
@ -21,6 +22,12 @@ class WebfingerService
|
||||||
|
|
||||||
protected function run($query)
|
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);
|
$url = WebfingerUrl::generateWebfingerUrl($query);
|
||||||
if(!Helpers::validateUrl($url)) {
|
if(!Helpers::validateUrl($url)) {
|
||||||
return [];
|
return [];
|
||||||
|
|
Loading…
Reference in a new issue