Merge branch 'develop' into upstream/2025.5.0
This commit is contained in:
commit
33aee38a59
125 changed files with 3926 additions and 2148 deletions
|
|
@ -18,6 +18,7 @@ import { SearchService } from '@/core/SearchService.js';
|
|||
import { ApLogService } from '@/core/ApLogService.js';
|
||||
import { ReactionService } from '@/core/ReactionService.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { DbUserDeleteJobData } from '../types.js';
|
||||
|
|
@ -94,6 +95,7 @@ export class DeleteAccountProcessorService {
|
|||
private searchService: SearchService,
|
||||
private reactionService: ReactionService,
|
||||
private readonly apLogService: ApLogService,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('delete-account');
|
||||
}
|
||||
|
|
@ -140,6 +142,22 @@ export class DeleteAccountProcessorService {
|
|||
}
|
||||
|
||||
{ // Delete user relations
|
||||
await this.cacheService.refreshFollowRelationsFor(user.id);
|
||||
await this.cacheService.userFollowingsCache.delete(user.id);
|
||||
await this.cacheService.userFollowingsCache.delete(user.id);
|
||||
await this.cacheService.userBlockingCache.delete(user.id);
|
||||
await this.cacheService.userBlockedCache.delete(user.id);
|
||||
await this.cacheService.userMutingsCache.delete(user.id);
|
||||
await this.cacheService.userMutingsCache.delete(user.id);
|
||||
await this.cacheService.hibernatedUserCache.delete(user.id);
|
||||
await this.cacheService.renoteMutingsCache.delete(user.id);
|
||||
await this.cacheService.userProfileCache.delete(user.id);
|
||||
this.cacheService.userByIdCache.delete(user.id);
|
||||
this.cacheService.localUserByIdCache.delete(user.id);
|
||||
if (user.token) {
|
||||
this.cacheService.localUserByNativeTokenCache.delete(user.token);
|
||||
}
|
||||
|
||||
await this.followingsRepository.delete({
|
||||
followerId: user.id,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
|
|||
import { StatusError } from '@/misc/status-error.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
||||
import { JsonLdService } from '@/core/activitypub/JsonLdService.js';
|
||||
import { isSigned, JsonLdService } from '@/core/activitypub/JsonLdService.js';
|
||||
import { ApInboxService } from '@/core/activitypub/ApInboxService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
|
@ -179,8 +179,8 @@ export class InboxProcessorService implements OnApplicationShutdown {
|
|||
// また、signatureのsignerは、activity.actorと一致する必要がある
|
||||
if (!httpSignatureValidated || authUser.user.uri !== actorId) {
|
||||
// 一致しなくても、でもLD-Signatureがありそうならそっちも見る
|
||||
const ldSignature = activity.signature;
|
||||
if (ldSignature) {
|
||||
if (isSigned(activity)) {
|
||||
const ldSignature = activity.signature;
|
||||
if (ldSignature.type !== 'RsaSignature2017') {
|
||||
throw new Bull.UnrecoverableError(`skip: unsupported LD-signature type ${ldSignature.type}`);
|
||||
}
|
||||
|
|
@ -202,24 +202,21 @@ export class InboxProcessorService implements OnApplicationShutdown {
|
|||
throw new Bull.UnrecoverableError('skip: LD-SignatureのユーザーはpublicKeyを持っていませんでした');
|
||||
}
|
||||
|
||||
const jsonLd = this.jsonLdService.use();
|
||||
|
||||
// LD-Signature検証
|
||||
const verified = await jsonLd.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
|
||||
const verified = await this.jsonLdService.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
|
||||
if (!verified) {
|
||||
throw new Bull.UnrecoverableError('skip: LD-Signatureの検証に失敗しました');
|
||||
}
|
||||
|
||||
// アクティビティを正規化
|
||||
delete activity.signature;
|
||||
const copy = { ...activity, signature: undefined };
|
||||
try {
|
||||
activity = await jsonLd.compact(activity) as IActivity;
|
||||
activity = await this.jsonLdService.compact(copy) as IActivity;
|
||||
} catch (e) {
|
||||
throw new Bull.UnrecoverableError(`skip: failed to compact activity: ${e}`);
|
||||
}
|
||||
// TODO: 元のアクティビティと非互換な形に正規化される場合は転送をスキップする
|
||||
// https://github.com/mastodon/mastodon/blob/664b0ca/app/services/activitypub/process_collection_service.rb#L24-L29
|
||||
activity.signature = ldSignature;
|
||||
|
||||
// もう一度actorチェック
|
||||
if (authUser.user.uri !== actorId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue