mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 08:43:17 +00:00
commit
89e39ff699
5 changed files with 77 additions and 14 deletions
|
@ -9,6 +9,8 @@
|
|||
- 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))
|
||||
- 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
|
||||
- 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 favourites endpoints ([d6d99385](https://github.com/pixelfed/pixelfed/commit/d6d99385))
|
||||
- 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/))
|
||||
|
||||
## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)
|
||||
|
|
|
@ -28,12 +28,14 @@ class SearchApiV2Service
|
|||
protected function run($query)
|
||||
{
|
||||
$this->query = $query;
|
||||
$q = urldecode($query->input('q'));
|
||||
|
||||
if($query->has('resolve') &&
|
||||
$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')) {
|
||||
|
@ -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()
|
||||
{
|
||||
$user = request()->user();
|
||||
|
@ -163,12 +155,80 @@ class SearchApiV2Service
|
|||
return $this->resolveLocalProfile();
|
||||
}
|
||||
} else {
|
||||
$default = [
|
||||
'accounts' => [],
|
||||
'hashtags' => [],
|
||||
'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' => []
|
||||
'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;
|
||||
}
|
||||
}
|
||||
|
||||
protected function resolveLocalStatus()
|
||||
|
|
BIN
public/css/spa.css
vendored
BIN
public/css/spa.css
vendored
Binary file not shown.
BIN
public/js/spa.js
vendored
BIN
public/js/spa.js
vendored
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue