プロフィールのURL認証をrel=meで可能に (#12100)

This commit is contained in:
CyberRex 2023-10-21 18:38:51 +09:00 committed by GitHub
parent 2c0a139da6
commit 12fe09c6e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -437,9 +437,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const myLink = `${this.config.url}/@${user.username}`; const myLink = `${this.config.url}/@${user.username}`;
const includesMyLink = Array.from(doc.getElementsByTagName('a')).some(a => a.href === myLink); const aEls = Array.from(doc.getElementsByTagName('a'));
const linkEls = Array.from(doc.getElementsByTagName('link'));
if (includesMyLink) { const includesMyLink = aEls.some(a => a.href === myLink);
const includesRelMeLinks = [...aEls, ...linkEls].some(link => link.rel === 'me' && link.href === myLink);
if (includesMyLink || includesRelMeLinks) {
await this.userProfilesRepository.createQueryBuilder('profile').update() await this.userProfilesRepository.createQueryBuilder('profile').update()
.where('userId = :userId', { userId: user.id }) .where('userId = :userId', { userId: user.id })
.set({ .set({