mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-20 03:53:17 +00:00
commit
a03a9a44bd
1 changed files with 6 additions and 1 deletions
|
@ -950,7 +950,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
{
|
{
|
||||||
abort_if(! $request->user() || ! $request->user()->token() || ! $username, 403);
|
abort_if(! $request->user() || ! $request->user()->token() || ! $username, 403);
|
||||||
abort_unless($request->user()->tokenCan('read'), 403);
|
abort_unless($request->user()->tokenCan('read'), 403);
|
||||||
|
$username = trim($username);
|
||||||
$rateLimiting = (bool) config_cache('api.rate-limits.v1Dot1.accounts.usernameToId.enabled');
|
$rateLimiting = (bool) config_cache('api.rate-limits.v1Dot1.accounts.usernameToId.enabled');
|
||||||
$ipRateLimiting = (bool) config_cache('api.rate-limits.v1Dot1.accounts.usernameToId.ip_enabled');
|
$ipRateLimiting = (bool) config_cache('api.rate-limits.v1Dot1.accounts.usernameToId.ip_enabled');
|
||||||
if ($ipRateLimiting) {
|
if ($ipRateLimiting) {
|
||||||
|
@ -997,6 +997,11 @@ class ApiV1Dot1Controller extends Controller
|
||||||
'X-Rate-Limit-Reset' => RateLimiter::availableIn($userKey),
|
'X-Rate-Limit-Reset' => RateLimiter::availableIn($userKey),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
if (str_ends_with($username, config_cache('pixelfed.domain.app'))) {
|
||||||
|
$pre = str_starts_with($username, '@') ? substr($username, 1) : $username;
|
||||||
|
$parts = explode('@', $pre);
|
||||||
|
$username = $parts[0];
|
||||||
|
}
|
||||||
$accountId = AccountService::usernameToId($username, true);
|
$accountId = AccountService::usernameToId($username, true);
|
||||||
if (! $accountId) {
|
if (! $accountId) {
|
||||||
return [];
|
return [];
|
||||||
|
|
Loading…
Reference in a new issue