Merge tag 'tags/2024.3.2' from upstream Sharkey

This commit is contained in:
jaina heartles 2024-03-31 16:31:48 -07:00
commit 80162565d6
25 changed files with 272 additions and 121 deletions

View file

@ -114,10 +114,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@bindThis
private async fetchAny(uri: string, me: MiLocalUser | null | undefined): Promise<SchemaType<typeof meta['res']> | null> {
// ブロックしてたら中断
const host = this.utilityService.extractDbHost(uri);
const fetchedMeta = await this.metaService.fetch();
const dbHost = this.utilityService.extractDbHost(uri);
if (this.utilityService.isBlockedHost(fetchedMeta.blockedHosts, dbHost)) return null;
if (fetchedMeta.allowlistMode && !this.utilityService.isAllowedHost(fetchedMeta.allowedHosts, dbHost)) return null;
if (this.utilityService.isBlockedHost(fetchedMeta.blockedHosts, host)) return null;
if (fetchedMeta.allowlistMode && !this.utilityService.isAllowedHost(fetchedMeta.allowedHosts, host)) return null;
let local = await this.mergePack(me, ...await Promise.all([
this.apDbResolverService.getUserFromApId(uri),
@ -125,6 +126,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
]));
if (local != null) return local;
// local object, not found in db? fail
if (this.utilityService.isSelfHost(host)) return null;
// リモートから一旦オブジェクトフェッチ
const resolver = this.apResolverService.createResolver();
const object = await resolver.resolve(uri) as any;