mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 10:53:11 +02:00
プロフィールのURL認証をrel=meで可能に (#12100)
This commit is contained in:
parent
2c0a139da6
commit
12fe09c6e7
1 changed files with 6 additions and 2 deletions
|
@ -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({
|
||||||
|
|
Loading…
Reference in a new issue