Merge pull request #3146 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-01-09 23:30:05 -07:00 committed by GitHub
commit 89e39ff699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 14 deletions

View file

@ -9,6 +9,8 @@
- Added UI Settings modal and fixed height media previews setting ([f2467e71](https://github.com/pixelfed/pixelfed/commit/f2467e71)) - Added UI Settings modal and fixed height media previews setting ([f2467e71](https://github.com/pixelfed/pixelfed/commit/f2467e71))
- Set max-width of 1440px for larger screens ([af68872a](https://github.com/pixelfed/pixelfed/commit/af68872a)) - Set max-width of 1440px for larger screens ([af68872a](https://github.com/pixelfed/pixelfed/commit/af68872a))
- Add link to sidebar profile card ([85964510](https://github.com/pixelfed/pixelfed/commit/85964510)) - Add link to sidebar profile card ([85964510](https://github.com/pixelfed/pixelfed/commit/85964510))
- Improved search bar, now resolves (and imports) remote accounts and posts, including webfinger addresses ([c8a667f2](https://github.com/pixelfed/pixelfed/commit/c8a667f2))
- Added user facing changelog at `/i/web/whats-new` ([e61dc66a](https://github.com/pixelfed/pixelfed/commit/e61dc66a))
### Configuration ### Configuration
- Enable network timeline by default ([b95aec12](https://github.com/pixelfed/pixelfed/commit/b95aec12)) - Enable network timeline by default ([b95aec12](https://github.com/pixelfed/pixelfed/commit/b95aec12))
@ -95,6 +97,7 @@
- Updated ApiV1Controller, fix home timeline entities. ([6fc0dcb3](https://github.com/pixelfed/pixelfed/commit/6fc0dcb3)) - Updated ApiV1Controller, fix home timeline entities. ([6fc0dcb3](https://github.com/pixelfed/pixelfed/commit/6fc0dcb3))
- Updated ApiV1Controller, fix favourites endpoints ([d6d99385](https://github.com/pixelfed/pixelfed/commit/d6d99385)) - Updated ApiV1Controller, fix favourites endpoints ([d6d99385](https://github.com/pixelfed/pixelfed/commit/d6d99385))
- Updated ApiV1Controller, fix reblogs endpoints ([de42d84c](https://github.com/pixelfed/pixelfed/commit/de42d84c)) - Updated ApiV1Controller, fix reblogs endpoints ([de42d84c](https://github.com/pixelfed/pixelfed/commit/de42d84c))
- Updated SearchApiV2Service, resolve remote queries. ([c8a667f2](https://github.com/pixelfed/pixelfed/commit/c8a667f2))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)

View file

@ -28,12 +28,14 @@ class SearchApiV2Service
protected function run($query) protected function run($query)
{ {
$this->query = $query; $this->query = $query;
$q = urldecode($query->input('q'));
if($query->has('resolve') && if($query->has('resolve') &&
$query->resolve == true && $query->resolve == true &&
Helpers::validateUrl(urldecode($query->input('q'))) ( Str::startsWith($q, 'https://') ||
Str::substrCount($q, '@') == 2)
) { ) {
return $this->resolve(); return $this->resolveQuery();
} }
if($query->has('type')) { if($query->has('type')) {
@ -77,16 +79,6 @@ class SearchApiV2Service
]; ];
} }
protected function resolve()
{
$query = urldecode($this->query->input('q'));
if(Str::startsWith($query, '@') == true) {
return WebfingerService::lookup($this->query->input('q'));
} else if (Str::startsWith($query, 'https://') == true) {
return $this->resolveQuery();
}
}
protected function accounts() protected function accounts()
{ {
$user = request()->user(); $user = request()->user();
@ -163,11 +155,79 @@ class SearchApiV2Service
return $this->resolveLocalProfile(); return $this->resolveLocalProfile();
} }
} else { } else {
return [ $default = [
'accounts' => [], 'accounts' => [],
'hashtags' => [], 'hashtags' => [],
'statuses' => [] 'statuses' => [],
]; ];
if(!Helpers::validateUrl($query) && strpos($query, '@') == -1) {
return $default;
}
if(Str::substrCount($query, '@') == 2) {
try {
$res = WebfingerService::lookup($query);
} catch (\Exception $e) {
return $default;
}
if($res && isset($res['id'])) {
$default['accounts'][] = $res;
return $default;
} else {
return $default;
}
}
try {
$res = ActivityPubFetchService::get($query);
if($res) {
$json = json_decode($res, true);
if(!$json || !isset($json['@context']) || !isset($json['type']) || !in_array($json['type'], ['Note', 'Person'])) {
return [
'accounts' => [],
'hashtags' => [],
'statuses' => [],
];
}
switch($json['type']) {
case 'Note':
$obj = Helpers::statusFetch($query);
if(!$obj) {
return $default;
}
$default['statuses'][] = StatusService::get($obj['id']);
return $default;
break;
case 'Person':
$obj = Helpers::profileFetch($query);
if(!$obj) {
return $default;
}
$default['accounts'][] = AccountService::get($obj['id']);
return $default;
break;
default:
return [
'accounts' => [],
'hashtags' => [],
'statuses' => [],
];
break;
}
}
} catch (\Exception $e) {
return [
'accounts' => [],
'hashtags' => [],
'statuses' => [],
];
}
return $default;
} }
} }

BIN
public/css/spa.css vendored

Binary file not shown.

BIN
public/js/spa.js vendored

Binary file not shown.

Binary file not shown.