mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-24 06:35:11 +00:00
fix: primitive 2: acceptance of cross-origin alternate links
This commit is contained in:
parent
27339e03c2
commit
d883934826
1 changed files with 5 additions and 1 deletions
|
@ -18,6 +18,7 @@ import type Logger from '@/logger.js';
|
|||
import type { IObject } from './type.js';
|
||||
import { validateContentTypeSetAsActivityPub } from '@/core/activitypub/misc/validator.js';
|
||||
import { assertActivityMatchesUrls } from '@/core/activitypub/misc/check-against-url.js';
|
||||
import { UtilityService } from "@/core/UtilityService.js";
|
||||
|
||||
type Request = {
|
||||
url: string;
|
||||
|
@ -147,6 +148,7 @@ export class ApRequestService {
|
|||
private userKeypairService: UserKeypairService,
|
||||
private httpRequestService: HttpRequestService,
|
||||
private loggerService: LoggerService,
|
||||
private utilityService: UtilityService,
|
||||
) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
this.logger = this.loggerService?.getLogger('ap-request'); // なぜか TypeError: Cannot read properties of undefined (reading 'getLogger') と言われる
|
||||
|
@ -241,9 +243,11 @@ export class ApRequestService {
|
|||
if (alternate) {
|
||||
const href = alternate.getAttribute('href');
|
||||
if (href) {
|
||||
if (this.utilityService.punyHost(url) === this.utilityService.punyHost(href)) {
|
||||
return await this.signedGet(href, user, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// something went wrong parsing the HTML, ignore the whole thing
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue