2022-09-17 18:27:08 +00:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
import { In } from 'typeorm';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { DI } from '@/di-symbols.js';
|
2022-09-20 20:33:11 +00:00
|
|
|
import type { Config } from '@/config.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
|
|
|
import { ReactionService } from '@/core/ReactionService.js';
|
|
|
|
import { RelayService } from '@/core/RelayService.js';
|
|
|
|
import { NotePiningService } from '@/core/NotePiningService.js';
|
|
|
|
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
|
|
|
import { NoteDeleteService } from '@/core/NoteDeleteService.js';
|
|
|
|
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
|
|
|
import { concat, toArray, toSingle, unique } from '@/misc/prelude/array.js';
|
|
|
|
import { AppLockService } from '@/core/AppLockService.js';
|
|
|
|
import type Logger from '@/logger.js';
|
|
|
|
import { MetaService } from '@/core/MetaService.js';
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
import { AccountMoveService } from '@/core/AccountMoveService.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { IdService } from '@/core/IdService.js';
|
|
|
|
import { StatusError } from '@/misc/status-error.js';
|
|
|
|
import { UtilityService } from '@/core/UtilityService.js';
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
import { CacheService } from '@/core/CacheService.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
|
|
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
|
|
|
import { QueueService } from '@/core/QueueService.js';
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
import type { UsersRepository, NotesRepository, FollowingsRepository, AbuseUserReportsRepository, FollowRequestsRepository, } from '@/models/index.js';
|
2023-02-12 09:47:30 +00:00
|
|
|
import { bindThis } from '@/decorators.js';
|
2023-02-13 06:50:22 +00:00
|
|
|
import type { RemoteUser } from '@/models/entities/User.js';
|
2023-04-08 05:16:26 +00:00
|
|
|
import { getApHrefNullable, getApId, getApIds, getApType, getOneApHrefNullable, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js';
|
2022-09-18 18:08:54 +00:00
|
|
|
import { ApNoteService } from './models/ApNoteService.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { ApLoggerService } from './ApLoggerService.js';
|
|
|
|
import { ApDbResolverService } from './ApDbResolverService.js';
|
|
|
|
import { ApResolverService } from './ApResolverService.js';
|
|
|
|
import { ApAudienceService } from './ApAudienceService.js';
|
|
|
|
import { ApPersonService } from './models/ApPersonService.js';
|
|
|
|
import { ApQuestionService } from './models/ApQuestionService.js';
|
|
|
|
import type { Resolver } from './ApResolverService.js';
|
2023-04-08 05:16:26 +00:00
|
|
|
import type { IAccept, IAdd, IAnnounce, IBlock, ICreate, IDelete, IFlag, IFollow, ILike, IObject, IReject, IRemove, IUndo, IUpdate, IMove } from './type.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class ApInboxService {
|
2022-09-18 18:11:50 +00:00
|
|
|
private logger: Logger;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
@Inject(DI.config)
|
|
|
|
private config: Config,
|
|
|
|
|
|
|
|
@Inject(DI.usersRepository)
|
|
|
|
private usersRepository: UsersRepository,
|
|
|
|
|
|
|
|
@Inject(DI.notesRepository)
|
|
|
|
private notesRepository: NotesRepository,
|
|
|
|
|
|
|
|
@Inject(DI.followingsRepository)
|
|
|
|
private followingsRepository: FollowingsRepository,
|
|
|
|
|
|
|
|
@Inject(DI.abuseUserReportsRepository)
|
|
|
|
private abuseUserReportsRepository: AbuseUserReportsRepository,
|
|
|
|
|
|
|
|
@Inject(DI.followRequestsRepository)
|
|
|
|
private followRequestsRepository: FollowRequestsRepository,
|
|
|
|
|
|
|
|
private userEntityService: UserEntityService,
|
|
|
|
private noteEntityService: NoteEntityService,
|
|
|
|
private utilityService: UtilityService,
|
|
|
|
private idService: IdService,
|
|
|
|
private metaService: MetaService,
|
|
|
|
private userFollowingService: UserFollowingService,
|
|
|
|
private apAudienceService: ApAudienceService,
|
|
|
|
private reactionService: ReactionService,
|
|
|
|
private relayService: RelayService,
|
|
|
|
private notePiningService: NotePiningService,
|
|
|
|
private userBlockingService: UserBlockingService,
|
|
|
|
private noteCreateService: NoteCreateService,
|
|
|
|
private noteDeleteService: NoteDeleteService,
|
|
|
|
private appLockService: AppLockService,
|
|
|
|
private apResolverService: ApResolverService,
|
|
|
|
private apDbResolverService: ApDbResolverService,
|
|
|
|
private apLoggerService: ApLoggerService,
|
2022-09-18 18:08:54 +00:00
|
|
|
private apNoteService: ApNoteService,
|
2022-09-17 18:27:08 +00:00
|
|
|
private apPersonService: ApPersonService,
|
|
|
|
private apQuestionService: ApQuestionService,
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
private accountMoveService: AccountMoveService,
|
|
|
|
private cacheService: CacheService,
|
2022-09-17 18:27:08 +00:00
|
|
|
private queueService: QueueService,
|
|
|
|
) {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger = this.apLoggerService.logger;
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
public async performActivity(actor: RemoteUser, activity: IObject) {
|
2022-09-17 18:27:08 +00:00
|
|
|
if (isCollectionOrOrderedCollection(activity)) {
|
|
|
|
const resolver = this.apResolverService.createResolver();
|
|
|
|
for (const item of toArray(isCollection(activity) ? activity.items : activity.orderedItems)) {
|
|
|
|
const act = await resolver.resolve(item);
|
|
|
|
try {
|
|
|
|
await this.performOneActivity(actor, act);
|
|
|
|
} catch (err) {
|
|
|
|
if (err instanceof Error || typeof err === 'string') {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(err);
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
await this.performOneActivity(actor, activity);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ついでにリモートユーザーの情報が古かったら更新しておく
|
|
|
|
if (actor.uri) {
|
|
|
|
if (actor.lastFetchedAt == null || Date.now() - actor.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
|
|
|
|
setImmediate(() => {
|
|
|
|
this.apPersonService.updatePerson(actor.uri!);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
public async performOneActivity(actor: RemoteUser, activity: IObject): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if (actor.isSuspended) return;
|
|
|
|
|
|
|
|
if (isCreate(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.create(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isDelete(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.delete(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isUpdate(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.update(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isFollow(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.follow(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isAccept(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.accept(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isReject(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.reject(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isAdd(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.add(actor, activity).catch(err => this.logger.error(err));
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isRemove(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.remove(actor, activity).catch(err => this.logger.error(err));
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isAnnounce(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.announce(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isLike(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.like(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isUndo(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.undo(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isBlock(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.block(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (isFlag(activity)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
await this.flag(actor, activity);
|
2023-04-08 05:16:26 +00:00
|
|
|
} else if (isMove(activity)) {
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
await this.move(actor, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else {
|
2023-03-10 23:51:37 +00:00
|
|
|
this.logger.warn(`unrecognized activity type: ${activity.type}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async follow(actor: RemoteUser, activity: IFollow): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const followee = await this.apDbResolverService.getUserFromApId(activity.object);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (followee == null) {
|
|
|
|
return 'skip: followee not found';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (followee.host != null) {
|
|
|
|
return 'skip: フォローしようとしているユーザーはローカルユーザーではありません';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
// don't queue because the sender may attempt again when timeout
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.userFollowingService.follow(actor, followee, activity.id);
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async like(actor: RemoteUser, activity: ILike): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const targetUri = getApId(activity.object);
|
|
|
|
|
|
|
|
const note = await this.apNoteService.fetchNote(targetUri);
|
|
|
|
if (!note) return `skip: target note not found ${targetUri}`;
|
|
|
|
|
|
|
|
await this.apNoteService.extractEmojis(activity.tag ?? [], actor.host).catch(() => null);
|
|
|
|
|
2022-09-18 18:03:11 +00:00
|
|
|
return await this.reactionService.create(actor, note, activity._misskey_reaction ?? activity.content ?? activity.name).catch(err => {
|
|
|
|
if (err.id === '51c42bb4-931a-456b-bff7-e5a8a70dd298') {
|
2022-09-17 18:27:08 +00:00
|
|
|
return 'skip: already reacted';
|
|
|
|
} else {
|
2022-09-18 18:03:11 +00:00
|
|
|
throw err;
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
}).then(() => 'ok');
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async accept(actor: RemoteUser, activity: IAccept): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = activity.id ?? activity;
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Accept: ${uri}`);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const resolver = this.apResolverService.createResolver();
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const object = await resolver.resolve(activity.object).catch(err => {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(`Resolution failed: ${err}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
throw err;
|
|
|
|
});
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
if (isFollow(object)) return await this.acceptFollow(actor, object);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
return `skip: Unknown Accept type: ${getApType(object)}`;
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async acceptFollow(actor: RemoteUser, activity: IFollow): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
// ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある
|
|
|
|
|
|
|
|
const follower = await this.apDbResolverService.getUserFromApId(activity.actor);
|
|
|
|
|
|
|
|
if (follower == null) {
|
|
|
|
return 'skip: follower not found';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (follower.host != null) {
|
|
|
|
return 'skip: follower is not a local user';
|
|
|
|
}
|
|
|
|
|
|
|
|
// relay
|
|
|
|
const match = activity.id?.match(/follow-relay\/(\w+)/);
|
|
|
|
if (match) {
|
|
|
|
return await this.relayService.relayAccepted(match[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.userFollowingService.acceptFollowRequest(actor, follower);
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async add(actor: RemoteUser, activity: IAdd): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
|
|
|
throw new Error('invalid actor');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (activity.target == null) {
|
|
|
|
throw new Error('target is null');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (activity.target === actor.featured) {
|
|
|
|
const note = await this.apNoteService.resolveNote(activity.object);
|
|
|
|
if (note == null) throw new Error('note not found');
|
|
|
|
await this.notePiningService.addPinned(actor, note.id);
|
|
|
|
return;
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
throw new Error(`unknown target: ${activity.target}`);
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async announce(actor: RemoteUser, activity: IAnnounce): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(activity);
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Announce: ${uri}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
const targetUri = getApId(activity.object);
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.announceNote(actor, activity, targetUri);
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async announceNote(actor: RemoteUser, activity: IAnnounce, targetUri: string): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(activity);
|
|
|
|
|
|
|
|
if (actor.isSuspended) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// アナウンス先をブロックしてたら中断
|
|
|
|
const meta = await this.metaService.fetch();
|
2023-01-13 09:21:07 +00:00
|
|
|
if (this.utilityService.isBlockedHost(meta.blockedHosts, this.utilityService.extractDbHost(uri))) return;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
const unlock = await this.appLockService.getApLock(uri);
|
|
|
|
|
|
|
|
try {
|
|
|
|
// 既に同じURIを持つものが登録されていないかチェック
|
|
|
|
const exist = await this.apNoteService.fetchNote(uri);
|
|
|
|
if (exist) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Announce対象をresolve
|
|
|
|
let renote;
|
|
|
|
try {
|
|
|
|
renote = await this.apNoteService.resolveNote(targetUri);
|
2022-09-23 23:41:27 +00:00
|
|
|
if (renote == null) throw new Error('announce target is null');
|
2022-09-17 18:27:08 +00:00
|
|
|
} catch (err) {
|
2022-09-23 23:41:27 +00:00
|
|
|
// 対象が4xxならスキップ
|
2022-09-17 18:27:08 +00:00
|
|
|
if (err instanceof StatusError) {
|
|
|
|
if (err.isClientError) {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.warn(`Ignored announce target ${targetUri} - ${err.statusCode}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.warn(`Error in announce target ${targetUri} - ${err.statusCode ?? err}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
|
2022-09-23 23:41:27 +00:00
|
|
|
if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) {
|
|
|
|
this.logger.warn('skip: invalid actor for this activity');
|
|
|
|
return;
|
|
|
|
}
|
2022-09-17 18:27:08 +00:00
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Creating the (Re)Note: ${uri}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
const activityAudience = await this.apAudienceService.parseAudience(actor, activity.to, activity.cc);
|
|
|
|
|
|
|
|
await this.noteCreateService.create(actor, {
|
|
|
|
createdAt: activity.published ? new Date(activity.published) : null,
|
|
|
|
renote,
|
|
|
|
visibility: activityAudience.visibility,
|
|
|
|
visibleUsers: activityAudience.visibleUsers,
|
|
|
|
uri,
|
|
|
|
});
|
|
|
|
} finally {
|
|
|
|
unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async block(actor: RemoteUser, activity: IBlock): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
// ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず
|
|
|
|
|
|
|
|
const blockee = await this.apDbResolverService.getUserFromApId(activity.object);
|
|
|
|
|
|
|
|
if (blockee == null) {
|
|
|
|
return 'skip: blockee not found';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (blockee.host != null) {
|
|
|
|
return 'skip: ブロックしようとしているユーザーはローカルユーザーではありません';
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.userBlockingService.block(await this.usersRepository.findOneByOrFail({ id: actor.id }), await this.usersRepository.findOneByOrFail({ id: blockee.id }));
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async create(actor: RemoteUser, activity: ICreate): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(activity);
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Create: ${uri}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
// copy audiences between activity <=> object.
|
|
|
|
if (typeof activity.object === 'object') {
|
|
|
|
const to = unique(concat([toArray(activity.to), toArray(activity.object.to)]));
|
|
|
|
const cc = unique(concat([toArray(activity.cc), toArray(activity.object.cc)]));
|
|
|
|
|
|
|
|
activity.to = to;
|
|
|
|
activity.cc = cc;
|
|
|
|
activity.object.to = to;
|
|
|
|
activity.object.cc = cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If there is no attributedTo, use Activity actor.
|
|
|
|
if (typeof activity.object === 'object' && !activity.object.attributedTo) {
|
|
|
|
activity.object.attributedTo = activity.actor;
|
|
|
|
}
|
|
|
|
|
|
|
|
const resolver = this.apResolverService.createResolver();
|
|
|
|
|
|
|
|
const object = await resolver.resolve(activity.object).catch(e => {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(`Resolution failed: ${e}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
throw e;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isPost(object)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.createNote(resolver, actor, object, false, activity);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.warn(`Unknown type: ${getApType(object)}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async createNote(resolver: Resolver, actor: RemoteUser, note: IObject, silent = false, activity?: ICreate): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(note);
|
|
|
|
|
|
|
|
if (typeof note === 'object') {
|
|
|
|
if (actor.uri !== note.attributedTo) {
|
|
|
|
return 'skip: actor.uri !== note.attributedTo';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof note.id === 'string') {
|
|
|
|
if (this.utilityService.extractDbHost(actor.uri) !== this.utilityService.extractDbHost(note.id)) {
|
|
|
|
return 'skip: host in actor.uri !== note.id';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const unlock = await this.appLockService.getApLock(uri);
|
|
|
|
|
|
|
|
try {
|
|
|
|
const exist = await this.apNoteService.fetchNote(note);
|
|
|
|
if (exist) return 'skip: note exists';
|
|
|
|
|
|
|
|
await this.apNoteService.createNote(note, resolver, silent);
|
|
|
|
return 'ok';
|
2022-09-18 18:03:11 +00:00
|
|
|
} catch (err) {
|
|
|
|
if (err instanceof StatusError && err.isClientError) {
|
|
|
|
return `skip ${err.statusCode}`;
|
2022-09-17 18:27:08 +00:00
|
|
|
} else {
|
2022-09-18 18:03:11 +00:00
|
|
|
throw err;
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async delete(actor: RemoteUser, activity: IDelete): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
|
|
|
throw new Error('invalid actor');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
// 削除対象objectのtype
|
|
|
|
let formerType: string | undefined;
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (typeof activity.object === 'string') {
|
|
|
|
// typeが不明だけど、どうせ消えてるのでremote resolveしない
|
|
|
|
formerType = undefined;
|
|
|
|
} else {
|
|
|
|
const object = activity.object as IObject;
|
|
|
|
if (isTombstone(object)) {
|
|
|
|
formerType = toSingle(object.formerType);
|
|
|
|
} else {
|
|
|
|
formerType = toSingle(object.type);
|
|
|
|
}
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(activity.object);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
// type不明でもactorとobjectが同じならばそれはPersonに違いない
|
|
|
|
if (!formerType && actor.uri === uri) {
|
|
|
|
formerType = 'Person';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
// それでもなかったらおそらくNote
|
|
|
|
if (!formerType) {
|
|
|
|
formerType = 'Note';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (validPost.includes(formerType)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
return await this.deleteNote(actor, uri);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else if (validActor.includes(formerType)) {
|
2022-09-18 18:11:50 +00:00
|
|
|
return await this.deleteActor(actor, uri);
|
2022-09-17 18:27:08 +00:00
|
|
|
} else {
|
|
|
|
return `Unknown type ${formerType}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async deleteActor(actor: RemoteUser, uri: string): Promise<string> {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Deleting the Actor: ${uri}`);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (actor.uri !== uri) {
|
|
|
|
return `skip: delete actor ${actor.uri} !== ${uri}`;
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2023-02-24 19:27:37 +00:00
|
|
|
const user = await this.usersRepository.findOneBy({ id: actor.id });
|
|
|
|
if (user == null) {
|
|
|
|
return 'skip: actor not found';
|
|
|
|
} else if (user.isDeleted) {
|
2023-02-20 08:08:05 +00:00
|
|
|
return 'skip: already deleted';
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const job = await this.queueService.createDeleteAccountJob(actor);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.usersRepository.update(actor.id, {
|
|
|
|
isDeleted: true,
|
|
|
|
});
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
return `ok: queued ${job.name} ${job.id}`;
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async deleteNote(actor: RemoteUser, uri: string): Promise<string> {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Deleting the Note: ${uri}`);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const unlock = await this.appLockService.getApLock(uri);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
try {
|
|
|
|
const note = await this.apDbResolverService.getNoteFromApId(uri);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (note == null) {
|
2023-02-15 04:06:06 +00:00
|
|
|
return 'message not found';
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (note.userId !== actor.id) {
|
|
|
|
return '投稿を削除しようとしているユーザーは投稿の作成者ではありません';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.noteDeleteService.delete(actor, note);
|
|
|
|
return 'ok: note deleted';
|
|
|
|
} finally {
|
|
|
|
unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async flag(actor: RemoteUser, activity: IFlag): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
// objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので
|
|
|
|
// 対象ユーザーは一番最初のユーザー として あとはコメントとして格納する
|
|
|
|
const uris = getApIds(activity.object);
|
|
|
|
|
|
|
|
const userIds = uris.filter(uri => uri.startsWith(this.config.url + '/users/')).map(uri => uri.split('/').pop()!);
|
|
|
|
const users = await this.usersRepository.findBy({
|
|
|
|
id: In(userIds),
|
|
|
|
});
|
|
|
|
if (users.length < 1) return 'skip';
|
|
|
|
|
|
|
|
await this.abuseUserReportsRepository.insert({
|
|
|
|
id: this.idService.genId(),
|
|
|
|
createdAt: new Date(),
|
|
|
|
targetUserId: users[0].id,
|
|
|
|
targetUserHost: users[0].host,
|
|
|
|
reporterId: actor.id,
|
|
|
|
reporterHost: actor.host,
|
|
|
|
comment: `${activity.content}\n${JSON.stringify(uris, null, 2)}`,
|
|
|
|
});
|
|
|
|
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async reject(actor: RemoteUser, activity: IReject): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = activity.id ?? activity;
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Reject: ${uri}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
const resolver = this.apResolverService.createResolver();
|
|
|
|
|
|
|
|
const object = await resolver.resolve(activity.object).catch(e => {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(`Resolution failed: ${e}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
throw e;
|
|
|
|
});
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
if (isFollow(object)) return await this.rejectFollow(actor, object);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
return `skip: Unknown Reject type: ${getApType(object)}`;
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async rejectFollow(actor: RemoteUser, activity: IFollow): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
// ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const follower = await this.apDbResolverService.getUserFromApId(activity.actor);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (follower == null) {
|
|
|
|
return 'skip: follower not found';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (!this.userEntityService.isLocalUser(follower)) {
|
|
|
|
return 'skip: follower is not a local user';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
// relay
|
|
|
|
const match = activity.id?.match(/follow-relay\/(\w+)/);
|
|
|
|
if (match) {
|
|
|
|
return await this.relayService.relayRejected(match[1]);
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.userFollowingService.remoteReject(actor, follower);
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async remove(actor: RemoteUser, activity: IRemove): Promise<void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
|
|
|
throw new Error('invalid actor');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (activity.target == null) {
|
|
|
|
throw new Error('target is null');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (activity.target === actor.featured) {
|
|
|
|
const note = await this.apNoteService.resolveNote(activity.object);
|
|
|
|
if (note == null) throw new Error('note not found');
|
|
|
|
await this.notePiningService.removePinned(actor, note.id);
|
|
|
|
return;
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
throw new Error(`unknown target: ${activity.target}`);
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undo(actor: RemoteUser, activity: IUndo): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
|
|
|
throw new Error('invalid actor');
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = activity.id ?? activity;
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.info(`Undo: ${uri}`);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const resolver = this.apResolverService.createResolver();
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const object = await resolver.resolve(activity.object).catch(e => {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(`Resolution failed: ${e}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
throw e;
|
|
|
|
});
|
2023-04-08 05:16:26 +00:00
|
|
|
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
// don't queue because the sender may attempt again when timeout
|
2022-09-18 18:11:50 +00:00
|
|
|
if (isFollow(object)) return await this.undoFollow(actor, object);
|
|
|
|
if (isBlock(object)) return await this.undoBlock(actor, object);
|
|
|
|
if (isLike(object)) return await this.undoLike(actor, object);
|
|
|
|
if (isAnnounce(object)) return await this.undoAnnounce(actor, object);
|
|
|
|
if (isAccept(object)) return await this.undoAccept(actor, object);
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
return `skip: unknown object type ${getApType(object)}`;
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undoAccept(actor: RemoteUser, activity: IAccept): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const follower = await this.apDbResolverService.getUserFromApId(activity.object);
|
|
|
|
if (follower == null) {
|
|
|
|
return 'skip: follower not found';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
const isFollowing = await this.followingsRepository.exist({
|
|
|
|
where: {
|
|
|
|
followerId: follower.id,
|
|
|
|
followeeId: actor.id,
|
|
|
|
},
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
if (isFollowing) {
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.userFollowingService.unfollow(follower, actor);
|
|
|
|
return 'ok: unfollowed';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
return 'skip: フォローされていない';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undoAnnounce(actor: RemoteUser, activity: IAnnounce): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const uri = getApId(activity);
|
|
|
|
|
|
|
|
const note = await this.notesRepository.findOneBy({
|
|
|
|
uri,
|
|
|
|
userId: actor.id,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!note) return 'skip: no such Announce';
|
|
|
|
|
|
|
|
await this.noteDeleteService.delete(actor, note);
|
|
|
|
return 'ok: deleted';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undoBlock(actor: RemoteUser, activity: IBlock): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const blockee = await this.apDbResolverService.getUserFromApId(activity.object);
|
|
|
|
|
|
|
|
if (blockee == null) {
|
|
|
|
return 'skip: blockee not found';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (blockee.host != null) {
|
|
|
|
return 'skip: ブロック解除しようとしているユーザーはローカルユーザーではありません';
|
|
|
|
}
|
|
|
|
|
2023-02-13 06:28:07 +00:00
|
|
|
await this.userBlockingService.unblock(await this.usersRepository.findOneByOrFail({ id: actor.id }), blockee);
|
2022-09-17 18:27:08 +00:00
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undoFollow(actor: RemoteUser, activity: IFollow): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const followee = await this.apDbResolverService.getUserFromApId(activity.object);
|
|
|
|
if (followee == null) {
|
|
|
|
return 'skip: followee not found';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (followee.host != null) {
|
|
|
|
return 'skip: フォロー解除しようとしているユーザーはローカルユーザーではありません';
|
|
|
|
}
|
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
const requestExist = await this.followRequestsRepository.exist({
|
|
|
|
where: {
|
|
|
|
followerId: actor.id,
|
|
|
|
followeeId: followee.id,
|
|
|
|
},
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
const isFollowing = await this.followingsRepository.exist({
|
|
|
|
where: {
|
|
|
|
followerId: actor.id,
|
|
|
|
followeeId: followee.id,
|
|
|
|
},
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
if (requestExist) {
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.userFollowingService.cancelFollowRequest(followee, actor);
|
|
|
|
return 'ok: follow request canceled';
|
|
|
|
}
|
|
|
|
|
2023-07-11 05:58:58 +00:00
|
|
|
if (isFollowing) {
|
2022-09-17 18:27:08 +00:00
|
|
|
await this.userFollowingService.unfollow(actor, followee);
|
|
|
|
return 'ok: unfollowed';
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'skip: リクエストもフォローもされていない';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async undoLike(actor: RemoteUser, activity: ILike): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
const targetUri = getApId(activity.object);
|
|
|
|
|
|
|
|
const note = await this.apNoteService.fetchNote(targetUri);
|
|
|
|
if (!note) return `skip: target note not found ${targetUri}`;
|
|
|
|
|
|
|
|
await this.reactionService.delete(actor, note).catch(e => {
|
|
|
|
if (e.id === '60527ec9-b4cb-4a88-a6bd-32d3ad26817d') return;
|
|
|
|
throw e;
|
|
|
|
});
|
|
|
|
|
|
|
|
return 'ok';
|
|
|
|
}
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
@bindThis
|
2023-02-13 06:50:22 +00:00
|
|
|
private async update(actor: RemoteUser, activity: IUpdate): Promise<string> {
|
2022-09-17 18:27:08 +00:00
|
|
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
|
|
|
return 'skip: invalid actor';
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.debug('Update');
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const resolver = this.apResolverService.createResolver();
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
const object = await resolver.resolve(activity.object).catch(e => {
|
2022-09-18 18:11:50 +00:00
|
|
|
this.logger.error(`Resolution failed: ${e}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
throw e;
|
|
|
|
});
|
2023-04-08 05:16:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (isActor(object)) {
|
|
|
|
await this.apPersonService.updatePerson(actor.uri!, resolver, object);
|
|
|
|
return 'ok: Person updated';
|
|
|
|
} else if (getApType(object) === 'Question') {
|
2022-12-02 21:13:36 +00:00
|
|
|
await this.apQuestionService.updateQuestion(object, resolver).catch(err => console.error(err));
|
2022-09-17 18:27:08 +00:00
|
|
|
return 'ok: Question updated';
|
|
|
|
} else {
|
|
|
|
return `skip: Unknown type: ${getApType(object)}`;
|
|
|
|
}
|
|
|
|
}
|
2023-04-08 05:16:26 +00:00
|
|
|
|
|
|
|
@bindThis
|
|
|
|
private async move(actor: RemoteUser, activity: IMove): Promise<string> {
|
|
|
|
// fetch the new and old accounts
|
|
|
|
const targetUri = getApHrefNullable(activity.target);
|
|
|
|
if (!targetUri) return 'skip: invalid activity target';
|
|
|
|
|
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs
* copy block and mute and update lists when detecting an account has moved
* no need to care promise orders
* refactor updating actor and target
* automatically accept if a locked account had accepted an old account
* fix exception format
* prevent the old account from calling some endpoints
* do not unfollow when moving
* adjust following and follower counts
* check movedToUri when receiving a follow request
* skip if no need to adjust
* Revert "disable account migration"
This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d.
* fix translation specifier
* fix checking alsoKnownAs and uri
* fix updating account
* fix refollowing locked account
* decrease followersCount if followed by the old account
* adjust following and followers counts when unfollowing
* fix copying mutings
* prohibit moved account from moving again
* fix move service
* allow app creation after moving
* fix lint
* remove unnecessary field
* fix cache update
* add e2e test
* add e2e test of accepting the new account automatically
* force follow if any error happens
* remove unnecessary joins
* use Array.map instead of for const of
* ユーザーリストの移行は追加のみを行う
* nanka iroiro
* fix misskey-js?
* :v:
* 移行を行ったアカウントからのフォローリクエストの自動許可を調整
* newUriを外に出す
* newUriを外に出す2
* clean up
* fix newUri
* prevent moving if the destination account has already moved
* set alsoKnownAs via /i/update
* fix database initialization
* add return type
* prohibit updating alsoKnownAs after moving
* skip to add to alsoKnownAs if toUrl is known
* skip adding to the list if it already has
* use Acct.parse instead
* rename error code
* :art:
* 制限を5から10に緩和
* movedTo(Uri), alsoKnownAsはユーザーidを返すように
* test api res
* fix
* 元アカウントはミュートし続ける
* :art:
* unfollow
* fix
* getUserUriをUserEntityServiceに
* ?
* job!
* :art:
* instance => server
* accountMovedShort, forbiddenBecauseYouAreMigrated
* accountMovedShort
* fix test
* import, pin禁止
* 実績を凍結する
* clean up
* :v:
* change message
* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに
* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"
This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.
* validateAlsoKnownAs
* 移行後2時間以内はインポート可能なファイルサイズを拡大
* clean up
* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする
* handle error?
* リモートからの移行処理の条件を是正
* log, port
* fix
* fix
* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように
* refactor (use checkHttps)
* MISSKEY_WEBFINGER_USE_HTTP
* Environment Variable readme
* NEVER USE IN PRODUCTION
* fix punyHost
* fix indent
* fix
* experimental
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
|
|
|
return await this.apPersonService.updatePerson(actor.uri) ?? 'skip: nothing to do';
|
2023-04-08 05:16:26 +00:00
|
|
|
}
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|