forked from mirror/pixelfed
Fix SearchApiV2Service, improve webfinger condition
This commit is contained in:
parent
6d6a033a54
commit
9d31f73bfa
2 changed files with 4 additions and 2 deletions
|
@ -33,7 +33,6 @@ class SearchApiV2Service
|
||||||
$q = urldecode($query->input('q'));
|
$q = urldecode($query->input('q'));
|
||||||
|
|
||||||
if($query->has('resolve') &&
|
if($query->has('resolve') &&
|
||||||
$query->resolve == true &&
|
|
||||||
( Str::startsWith($q, 'https://') ||
|
( Str::startsWith($q, 'https://') ||
|
||||||
Str::substrCount($q, '@') >= 1)
|
Str::substrCount($q, '@') >= 1)
|
||||||
) {
|
) {
|
||||||
|
@ -203,7 +202,7 @@ class SearchApiV2Service
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Str::substrCount($query, '@') == 1 && strpos($query, '@') !== 0) {
|
if(!Str::startsWith($query, 'http') && Str::substrCount($query, '@') == 1 && strpos($query, '@') !== 0) {
|
||||||
try {
|
try {
|
||||||
$res = WebfingerService::lookup('@' . $query, $mastodonMode);
|
$res = WebfingerService::lookup('@' . $query, $mastodonMode);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -56,6 +56,9 @@ class WebfingerService
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$profile = Helpers::profileFetch($link);
|
$profile = Helpers::profileFetch($link);
|
||||||
|
if(!$profile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return $mastodonMode ?
|
return $mastodonMode ?
|
||||||
AccountService::getMastodon($profile->id, true) :
|
AccountService::getMastodon($profile->id, true) :
|
||||||
AccountService::get($profile->id);
|
AccountService::get($profile->id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue