Merge pull request #5164 from pixelfed/staging

Staging
This commit is contained in:
daniel 2024-06-08 06:58:47 -06:00 committed by GitHub
commit a03a9a44bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 [];