chore: use common utility for checking self host
This commit is contained in:
parent
32eaa31d42
commit
a5727cb72a
|
@ -18,7 +18,6 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
|||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { FetchAllowSoftFailMask } from '@/core/activitypub/misc/check-against-url.js';
|
||||
|
@ -114,9 +113,6 @@ export const paramDef = {
|
|||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.config)
|
||||
private config: Config,
|
||||
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
|
@ -225,7 +221,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (pathComponents.length === 1 && pathComponents[0].startsWith('@')) {
|
||||
const acct = Acct.parse(pathComponents[0]);
|
||||
// normalize acct host
|
||||
if (acct.host != null && this.utilityService.toPuny(acct.host) === this.utilityService.toPuny(this.config.host)) acct.host = null;
|
||||
if (this.utilityService.isSelfHost(acct.host)) acct.host = null;
|
||||
|
||||
return await this.usersRepository.findOneBy({
|
||||
usernameLower: acct.username.toLowerCase(),
|
||||
|
|
Loading…
Reference in New Issue