Skip to content

Commit

Permalink
プロフィールのURL認証をrel=meで可能に (#12100)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRex0 authored Oct 21, 2023
1 parent 2c0a139 commit 12fe09c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/backend/src/server/api/endpoints/i/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-

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()
.where('userId = :userId', { userId: user.id })
.set({
Expand Down

0 comments on commit 12fe09c

Please sign in to comment.