2023-02-16 14:09:41 +00:00
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
import promiseLimit from 'promise-limit';
|
|
|
|
|
import { DataSource } from 'typeorm';
|
|
|
|
|
import { ModuleRef } from '@nestjs/core';
|
|
|
|
|
import { DI } from '@/di-symbols.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 { BlockingsRepository, MutingsRepository, FollowingsRepository, InstancesRepository, UserProfilesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js';
|
2022-09-20 20:33:11 +00:00
|
|
|
|
import type { Config } from '@/config.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 { LocalUser, RemoteUser } from '@/models/entities/User.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
import { User } from '@/models/entities/User.js';
|
|
|
|
|
import { truncate } from '@/misc/truncate.js';
|
2023-04-04 08:32:09 +00:00
|
|
|
|
import type { CacheService } from '@/core/CacheService.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
|
|
|
|
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
|
|
|
|
import type Logger from '@/logger.js';
|
|
|
|
|
import type { Note } from '@/models/entities/Note.js';
|
|
|
|
|
import type { IdService } from '@/core/IdService.js';
|
|
|
|
|
import type { MfmService } from '@/core/MfmService.js';
|
|
|
|
|
import type { Emoji } from '@/models/entities/Emoji.js';
|
|
|
|
|
import { toArray } from '@/misc/prelude/array.js';
|
|
|
|
|
import type { GlobalEventService } from '@/core/GlobalEventService.js';
|
|
|
|
|
import type { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
|
|
|
|
import type { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js';
|
|
|
|
|
import { UserProfile } from '@/models/entities/UserProfile.js';
|
|
|
|
|
import { UserPublickey } from '@/models/entities/UserPublickey.js';
|
|
|
|
|
import type UsersChart from '@/core/chart/charts/users.js';
|
|
|
|
|
import type InstanceChart from '@/core/chart/charts/instance.js';
|
|
|
|
|
import type { HashtagService } from '@/core/HashtagService.js';
|
|
|
|
|
import { UserNotePining } from '@/models/entities/UserNotePining.js';
|
|
|
|
|
import { StatusError } from '@/misc/status-error.js';
|
|
|
|
|
import type { UtilityService } from '@/core/UtilityService.js';
|
|
|
|
|
import type { UserEntityService } from '@/core/entities/UserEntityService.js';
|
2023-02-03 06:01:31 +00:00
|
|
|
|
import { bindThis } from '@/decorators.js';
|
2023-03-24 10:08:08 +00:00
|
|
|
|
import { MetaService } from '@/core/MetaService.js';
|
2023-04-06 10:48:24 +00:00
|
|
|
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
2023-05-16 03:16:37 +00:00
|
|
|
|
import type { AccountMoveService } from '@/core/AccountMoveService.js';
|
|
|
|
|
import { checkHttps } from '@/misc/check-https.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js';
|
|
|
|
|
import { extractApHashtags } from './tag.js';
|
|
|
|
|
import type { OnModuleInit } from '@nestjs/common';
|
|
|
|
|
import type { ApNoteService } from './ApNoteService.js';
|
|
|
|
|
import type { ApMfmService } from '../ApMfmService.js';
|
|
|
|
|
import type { ApResolverService, Resolver } from '../ApResolverService.js';
|
|
|
|
|
import type { ApLoggerService } from '../ApLoggerService.js';
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
|
|
|
import type { ApImageService } from './ApImageService.js';
|
2023-02-16 14:09:41 +00:00
|
|
|
|
import type { IActor, IObject } from '../type.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
const nameLength = 128;
|
|
|
|
|
const summaryLength = 2048;
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class ApPersonService implements OnModuleInit {
|
|
|
|
|
private utilityService: UtilityService;
|
|
|
|
|
private userEntityService: UserEntityService;
|
2023-04-06 10:48:24 +00:00
|
|
|
|
private driveFileEntityService: DriveFileEntityService;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
private idService: IdService;
|
|
|
|
|
private globalEventService: GlobalEventService;
|
2023-03-24 10:08:08 +00:00
|
|
|
|
private metaService: MetaService;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
private federatedInstanceService: FederatedInstanceService;
|
|
|
|
|
private fetchInstanceMetadataService: FetchInstanceMetadataService;
|
2023-04-04 08:32:09 +00:00
|
|
|
|
private cacheService: CacheService;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
private apResolverService: ApResolverService;
|
|
|
|
|
private apNoteService: ApNoteService;
|
|
|
|
|
private apImageService: ApImageService;
|
|
|
|
|
private apMfmService: ApMfmService;
|
|
|
|
|
private mfmService: MfmService;
|
|
|
|
|
private hashtagService: HashtagService;
|
|
|
|
|
private usersChart: UsersChart;
|
|
|
|
|
private instanceChart: InstanceChart;
|
|
|
|
|
private apLoggerService: ApLoggerService;
|
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;
|
2022-09-18 18:11:50 +00:00
|
|
|
|
private logger: Logger;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private moduleRef: ModuleRef,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.config)
|
|
|
|
|
private config: Config,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.db)
|
|
|
|
|
private db: DataSource,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.usersRepository)
|
|
|
|
|
private usersRepository: UsersRepository,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.userProfilesRepository)
|
|
|
|
|
private userProfilesRepository: UserProfilesRepository,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.userPublickeysRepository)
|
|
|
|
|
private userPublickeysRepository: UserPublickeysRepository,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.instancesRepository)
|
|
|
|
|
private instancesRepository: InstancesRepository,
|
|
|
|
|
|
|
|
|
|
@Inject(DI.followingsRepository)
|
|
|
|
|
private followingsRepository: FollowingsRepository,
|
|
|
|
|
|
|
|
|
|
//private utilityService: UtilityService,
|
|
|
|
|
//private userEntityService: UserEntityService,
|
|
|
|
|
//private idService: IdService,
|
|
|
|
|
//private globalEventService: GlobalEventService,
|
2023-03-24 10:08:08 +00:00
|
|
|
|
//private metaService: MetaService,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
//private federatedInstanceService: FederatedInstanceService,
|
|
|
|
|
//private fetchInstanceMetadataService: FetchInstanceMetadataService,
|
2023-04-04 08:32:09 +00:00
|
|
|
|
//private cacheService: CacheService,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
//private apResolverService: ApResolverService,
|
|
|
|
|
//private apNoteService: ApNoteService,
|
|
|
|
|
//private apImageService: ApImageService,
|
|
|
|
|
//private apMfmService: ApMfmService,
|
|
|
|
|
//private mfmService: MfmService,
|
|
|
|
|
//private hashtagService: HashtagService,
|
|
|
|
|
//private usersChart: UsersChart,
|
|
|
|
|
//private instanceChart: InstanceChart,
|
|
|
|
|
//private apLoggerService: ApLoggerService,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onModuleInit() {
|
|
|
|
|
this.utilityService = this.moduleRef.get('UtilityService');
|
|
|
|
|
this.userEntityService = this.moduleRef.get('UserEntityService');
|
2023-04-06 10:48:24 +00:00
|
|
|
|
this.driveFileEntityService = this.moduleRef.get('DriveFileEntityService');
|
2022-09-17 18:27:08 +00:00
|
|
|
|
this.idService = this.moduleRef.get('IdService');
|
|
|
|
|
this.globalEventService = this.moduleRef.get('GlobalEventService');
|
2023-03-24 10:08:08 +00:00
|
|
|
|
this.metaService = this.moduleRef.get('MetaService');
|
2022-09-17 18:27:08 +00:00
|
|
|
|
this.federatedInstanceService = this.moduleRef.get('FederatedInstanceService');
|
|
|
|
|
this.fetchInstanceMetadataService = this.moduleRef.get('FetchInstanceMetadataService');
|
2023-04-04 08:32:09 +00:00
|
|
|
|
this.cacheService = this.moduleRef.get('CacheService');
|
2022-09-17 18:27:08 +00:00
|
|
|
|
this.apResolverService = this.moduleRef.get('ApResolverService');
|
|
|
|
|
this.apNoteService = this.moduleRef.get('ApNoteService');
|
|
|
|
|
this.apImageService = this.moduleRef.get('ApImageService');
|
|
|
|
|
this.apMfmService = this.moduleRef.get('ApMfmService');
|
|
|
|
|
this.mfmService = this.moduleRef.get('MfmService');
|
|
|
|
|
this.hashtagService = this.moduleRef.get('HashtagService');
|
|
|
|
|
this.usersChart = this.moduleRef.get('UsersChart');
|
|
|
|
|
this.instanceChart = this.moduleRef.get('InstanceChart');
|
|
|
|
|
this.apLoggerService = this.moduleRef.get('ApLoggerService');
|
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
|
|
|
|
this.accountMoveService = this.moduleRef.get('AccountMoveService');
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger = this.apLoggerService.logger;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
private punyHost(url: string): string {
|
|
|
|
|
const urlObj = new URL(url);
|
|
|
|
|
const host = `${this.utilityService.toPuny(urlObj.hostname)}${urlObj.port.length > 0 ? ':' + urlObj.port : ''}`;
|
|
|
|
|
return host;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Validate and convert to actor object
|
|
|
|
|
* @param x Fetched object
|
|
|
|
|
* @param uri Fetch target URI
|
|
|
|
|
*/
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
2022-09-18 18:11:50 +00:00
|
|
|
|
private validateActor(x: IObject, uri: string): IActor {
|
2023-04-29 14:26:47 +00:00
|
|
|
|
const expectHost = this.punyHost(uri);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
if (x == null) {
|
|
|
|
|
throw new Error('invalid Actor: object is null');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isActor(x)) {
|
|
|
|
|
throw new Error(`invalid Actor type '${x.type}'`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(typeof x.id === 'string' && x.id.length > 0)) {
|
|
|
|
|
throw new Error('invalid Actor: wrong id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(typeof x.inbox === 'string' && x.inbox.length > 0)) {
|
|
|
|
|
throw new Error('invalid Actor: wrong inbox');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(typeof x.preferredUsername === 'string' && x.preferredUsername.length > 0 && x.preferredUsername.length <= 128 && /^\w([\w-.]*\w)?$/.test(x.preferredUsername))) {
|
|
|
|
|
throw new Error('invalid Actor: wrong username');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// These fields are only informational, and some AP software allows these
|
|
|
|
|
// fields to be very long. If they are too long, we cut them off. This way
|
|
|
|
|
// we can at least see these users and their activities.
|
|
|
|
|
if (x.name) {
|
|
|
|
|
if (!(typeof x.name === 'string' && x.name.length > 0)) {
|
|
|
|
|
throw new Error('invalid Actor: wrong name');
|
|
|
|
|
}
|
|
|
|
|
x.name = truncate(x.name, nameLength);
|
2023-02-17 08:06:31 +00:00
|
|
|
|
} else if (x.name === '') {
|
|
|
|
|
// Mastodon emits empty string when the name is not set.
|
|
|
|
|
x.name = undefined;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
if (x.summary) {
|
|
|
|
|
if (!(typeof x.summary === 'string' && x.summary.length > 0)) {
|
|
|
|
|
throw new Error('invalid Actor: wrong summary');
|
|
|
|
|
}
|
|
|
|
|
x.summary = truncate(x.summary, summaryLength);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
const idHost = this.punyHost(x.id);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (idHost !== expectHost) {
|
|
|
|
|
throw new Error('invalid Actor: id has different host');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x.publicKey) {
|
|
|
|
|
if (typeof x.publicKey.id !== 'string') {
|
|
|
|
|
throw new Error('invalid Actor: publicKey.id is not a string');
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
const publicKeyIdHost = this.punyHost(x.publicKey.id);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (publicKeyIdHost !== expectHost) {
|
|
|
|
|
throw new Error('invalid Actor: publicKey.id has different host');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
|
* uriからUser(Person)をフェッチします。
|
2022-09-17 18:27:08 +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
|
|
|
|
* Misskeyに対象のPersonが登録されていればそれを返し、登録がなければnullを返します。
|
2022-09-17 18:27:08 +00:00
|
|
|
|
*/
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
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
|
|
|
|
public async fetchPerson(uri: string): Promise<LocalUser | RemoteUser | null> {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (typeof uri !== 'string') throw new Error('uri is not string');
|
|
|
|
|
|
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
|
|
|
|
const cached = this.cacheService.uriPersonCache.get(uri) as LocalUser | RemoteUser | null;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (cached) return cached;
|
|
|
|
|
|
|
|
|
|
// URIがこのサーバーを指しているならデータベースからフェッチ
|
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
|
|
|
|
if (uri.startsWith(`${this.config.url}/`)) {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
const id = uri.split('/').pop();
|
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
|
|
|
|
const u = await this.usersRepository.findOneBy({ id }) as LocalUser;
|
2023-04-04 08:32:09 +00:00
|
|
|
|
if (u) this.cacheService.uriPersonCache.set(uri, u);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
return u;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region このサーバーに既に登録されていたらそれを返す
|
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
|
|
|
|
const exist = await this.usersRepository.findOneBy({ uri }) as LocalUser | RemoteUser;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
if (exist) {
|
2023-04-04 08:32:09 +00:00
|
|
|
|
this.cacheService.uriPersonCache.set(uri, exist);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
return exist;
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Personを作成します。
|
|
|
|
|
*/
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
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
|
|
|
|
public async createPerson(uri: string, resolver?: Resolver): Promise<RemoteUser> {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (typeof uri !== 'string') throw new Error('uri is not string');
|
|
|
|
|
|
|
|
|
|
if (uri.startsWith(this.config.url)) {
|
|
|
|
|
throw new StatusError('cannot resolve local user', 400, 'cannot resolve local user');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (resolver == null) resolver = this.apResolverService.createResolver();
|
|
|
|
|
|
|
|
|
|
const object = await resolver.resolve(uri) as any;
|
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
|
const person = this.validateActor(object, uri);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger.info(`Creating the Person: ${person.id}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
const host = this.punyHost(object.id);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
const { fields } = this.analyzeAttachments(person.attachment ?? []);
|
|
|
|
|
|
|
|
|
|
const tags = extractApHashtags(person.tag).map(tag => normalizeForSearch(tag)).splice(0, 32);
|
|
|
|
|
|
|
|
|
|
const isBot = getApType(object) === 'Service';
|
|
|
|
|
|
|
|
|
|
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
|
|
|
|
|
|
2023-02-07 10:58:58 +00:00
|
|
|
|
const url = getOneApHrefNullable(person.url);
|
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
if (url && !checkHttps(url)) {
|
|
|
|
|
throw new Error('unexpected schema of person url: ' + url);
|
2023-02-07 10:58:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
|
// Create user
|
2023-02-13 06:50:22 +00:00
|
|
|
|
let user: RemoteUser;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
try {
|
|
|
|
|
// Start transaction
|
|
|
|
|
await this.db.transaction(async transactionalEntityManager => {
|
|
|
|
|
user = await transactionalEntityManager.save(new User({
|
|
|
|
|
id: this.idService.genId(),
|
|
|
|
|
avatarId: null,
|
|
|
|
|
bannerId: null,
|
|
|
|
|
createdAt: new Date(),
|
|
|
|
|
lastFetchedAt: new Date(),
|
|
|
|
|
name: truncate(person.name, nameLength),
|
|
|
|
|
isLocked: !!person.manuallyApprovesFollowers,
|
2023-04-08 05:16:26 +00:00
|
|
|
|
movedToUri: person.movedTo,
|
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
|
|
|
|
movedAt: person.movedTo ? new Date() : null,
|
2023-04-08 05:16:26 +00:00
|
|
|
|
alsoKnownAs: person.alsoKnownAs,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
isExplorable: !!person.discoverable,
|
|
|
|
|
username: person.preferredUsername,
|
|
|
|
|
usernameLower: person.preferredUsername!.toLowerCase(),
|
|
|
|
|
host,
|
|
|
|
|
inbox: person.inbox,
|
|
|
|
|
sharedInbox: person.sharedInbox ?? (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
|
|
|
|
followersUri: person.followers ? getApId(person.followers) : undefined,
|
|
|
|
|
featured: person.featured ? getApId(person.featured) : undefined,
|
|
|
|
|
uri: person.id,
|
|
|
|
|
tags,
|
|
|
|
|
isBot,
|
|
|
|
|
isCat: (person as any).isCat === true,
|
2023-02-13 06:50:22 +00:00
|
|
|
|
})) as RemoteUser;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
await transactionalEntityManager.save(new UserProfile({
|
|
|
|
|
userId: user.id,
|
|
|
|
|
description: person.summary ? this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null,
|
2023-02-07 10:58:58 +00:00
|
|
|
|
url: url,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
fields,
|
|
|
|
|
birthday: bday ? bday[0] : null,
|
|
|
|
|
location: person['vcard:Address'] ?? null,
|
|
|
|
|
userHost: host,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
if (person.publicKey) {
|
|
|
|
|
await transactionalEntityManager.save(new UserPublickey({
|
|
|
|
|
userId: user.id,
|
|
|
|
|
keyId: person.publicKey.id,
|
|
|
|
|
keyPem: person.publicKey.publicKeyPem,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// duplicate key error
|
|
|
|
|
if (isDuplicateKeyValueError(e)) {
|
|
|
|
|
// /users/@a => /users/:id のように入力がaliasなときにエラーになることがあるのを対応
|
|
|
|
|
const u = await this.usersRepository.findOneBy({
|
|
|
|
|
uri: person.id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (u) {
|
2023-02-13 06:50:22 +00:00
|
|
|
|
user = u as RemoteUser;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
} else {
|
|
|
|
|
throw new Error('already registered');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger.error(e instanceof Error ? e : new Error(e as string));
|
2022-09-17 18:27:08 +00:00
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register host
|
2023-03-24 10:08:08 +00:00
|
|
|
|
this.federatedInstanceService.fetch(host).then(async i => {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
this.instancesRepository.increment({ id: i.id }, 'usersCount', 1);
|
|
|
|
|
this.fetchInstanceMetadataService.fetchInstanceMetadata(i);
|
2023-03-24 10:08:08 +00:00
|
|
|
|
if ((await this.metaService.fetch()).enableChartsForFederatedInstances) {
|
|
|
|
|
this.instanceChart.newUser(i.host);
|
|
|
|
|
}
|
2022-09-17 18:27:08 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.usersChart.update(user!, true);
|
|
|
|
|
|
|
|
|
|
// ハッシュタグ更新
|
|
|
|
|
this.hashtagService.updateUsertags(user!, tags);
|
|
|
|
|
|
|
|
|
|
//#region アバターとヘッダー画像をフェッチ
|
|
|
|
|
const [avatar, banner] = await Promise.all([
|
|
|
|
|
person.icon,
|
|
|
|
|
person.image,
|
|
|
|
|
].map(img =>
|
|
|
|
|
img == null
|
|
|
|
|
? Promise.resolve(null)
|
|
|
|
|
: this.apImageService.resolveImage(user!, img).catch(() => null),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
const avatarId = avatar ? avatar.id : null;
|
|
|
|
|
const bannerId = banner ? banner.id : null;
|
2023-04-06 10:48:24 +00:00
|
|
|
|
const avatarUrl = avatar ? this.driveFileEntityService.getPublicUrl(avatar, 'avatar') : null;
|
|
|
|
|
const bannerUrl = banner ? this.driveFileEntityService.getPublicUrl(banner) : null;
|
|
|
|
|
const avatarBlurhash = avatar ? avatar.blurhash : null;
|
|
|
|
|
const bannerBlurhash = banner ? banner.blurhash : null;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
await this.usersRepository.update(user!.id, {
|
|
|
|
|
avatarId,
|
|
|
|
|
bannerId,
|
2023-04-06 10:48:24 +00:00
|
|
|
|
avatarUrl,
|
|
|
|
|
bannerUrl,
|
|
|
|
|
avatarBlurhash,
|
|
|
|
|
bannerBlurhash,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
user!.avatarId = avatarId;
|
|
|
|
|
user!.bannerId = bannerId;
|
|
|
|
|
user!.avatarUrl = avatarUrl;
|
|
|
|
|
user!.bannerUrl = bannerUrl;
|
|
|
|
|
user!.avatarBlurhash = avatarBlurhash;
|
|
|
|
|
user!.bannerBlurhash = bannerBlurhash;
|
|
|
|
|
//#endregion
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
//#region カスタム絵文字取得
|
|
|
|
|
const emojis = await this.apNoteService.extractEmojis(person.tag ?? [], host).catch(err => {
|
|
|
|
|
this.logger.info(`extractEmojis: ${err}`);
|
|
|
|
|
return [] as Emoji[];
|
|
|
|
|
});
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
const emojiNames = emojis.map(emoji => emoji.name);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
await this.usersRepository.update(user!.id, {
|
|
|
|
|
emojis: emojiNames,
|
|
|
|
|
});
|
|
|
|
|
//#endregion
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
await this.updateFeatured(user!.id, resolver).catch(err => this.logger.error(err));
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-04-06 10:48:24 +00:00
|
|
|
|
return user!;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Personの情報を更新します。
|
|
|
|
|
* Misskeyに対象のPersonが登録されていなければ無視します。
|
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
|
|
|
|
* もしアカウントの移行が確認された場合、アカウント移行処理を行います。
|
2023-07-07 22:08:16 +00:00
|
|
|
|
*
|
2022-09-17 18:27:08 +00:00
|
|
|
|
* @param uri URI of Person
|
|
|
|
|
* @param resolver Resolver
|
|
|
|
|
* @param hint Hint of Person object (この値が正当なPersonの場合、Remote resolveをせずに更新に利用します)
|
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
|
|
|
|
* @param movePreventUris ここに指定されたURIがPersonのmovedToに指定されていたり10回より多く回っている場合これ以上アカウント移行を行わない(無限ループ防止)
|
2022-09-17 18:27:08 +00:00
|
|
|
|
*/
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
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
|
|
|
|
public async updatePerson(uri: string, resolver?: Resolver | null, hint?: IObject, movePreventUris: string[] = []): Promise<string | void> {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (typeof uri !== 'string') throw new Error('uri is not string');
|
|
|
|
|
|
|
|
|
|
// URIがこのサーバーを指しているならスキップ
|
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
|
|
|
|
if (uri.startsWith(`${this.config.url}/`)) {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region このサーバーに既に登録されているか
|
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
|
|
|
|
const exist = await this.usersRepository.findOneBy({ uri }) as RemoteUser | null;
|
2022-09-17 18:27:08 +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
|
|
|
|
if (exist === null) {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
if (resolver == null) resolver = this.apResolverService.createResolver();
|
|
|
|
|
|
|
|
|
|
const object = hint ?? await resolver.resolve(uri);
|
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
|
const person = this.validateActor(object, uri);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger.info(`Updating the Person: ${person.id}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
// アバターとヘッダー画像をフェッチ
|
|
|
|
|
const [avatar, banner] = await Promise.all([
|
|
|
|
|
person.icon,
|
|
|
|
|
person.image,
|
|
|
|
|
].map(img =>
|
|
|
|
|
img == null
|
|
|
|
|
? Promise.resolve(null)
|
|
|
|
|
: this.apImageService.resolveImage(exist, img).catch(() => null),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
// カスタム絵文字取得
|
|
|
|
|
const emojis = await this.apNoteService.extractEmojis(person.tag ?? [], exist.host).catch(e => {
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger.info(`extractEmojis: ${e}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
return [] as Emoji[];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const emojiNames = emojis.map(emoji => emoji.name);
|
|
|
|
|
|
|
|
|
|
const { fields } = this.analyzeAttachments(person.attachment ?? []);
|
|
|
|
|
|
|
|
|
|
const tags = extractApHashtags(person.tag).map(tag => normalizeForSearch(tag)).splice(0, 32);
|
|
|
|
|
|
|
|
|
|
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
|
|
|
|
|
|
2023-02-07 10:58:58 +00:00
|
|
|
|
const url = getOneApHrefNullable(person.url);
|
|
|
|
|
|
2023-04-29 14:26:47 +00:00
|
|
|
|
if (url && !checkHttps(url)) {
|
|
|
|
|
throw new Error('unexpected schema of person url: ' + url);
|
2023-02-07 10:58:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
|
const updates = {
|
|
|
|
|
lastFetchedAt: new Date(),
|
|
|
|
|
inbox: person.inbox,
|
|
|
|
|
sharedInbox: person.sharedInbox ?? (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
|
|
|
|
followersUri: person.followers ? getApId(person.followers) : undefined,
|
|
|
|
|
featured: person.featured,
|
|
|
|
|
emojis: emojiNames,
|
|
|
|
|
name: truncate(person.name, nameLength),
|
|
|
|
|
tags,
|
|
|
|
|
isBot: getApType(object) === 'Service',
|
|
|
|
|
isCat: (person as any).isCat === true,
|
|
|
|
|
isLocked: !!person.manuallyApprovesFollowers,
|
2023-04-08 05:16:26 +00:00
|
|
|
|
movedToUri: person.movedTo ?? null,
|
|
|
|
|
alsoKnownAs: person.alsoKnownAs ?? null,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
isExplorable: !!person.discoverable,
|
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
|
|
|
|
} as Partial<RemoteUser> & Pick<RemoteUser, 'isBot' | 'isCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;
|
|
|
|
|
|
|
|
|
|
const moving =
|
|
|
|
|
// 移行先がない→ある
|
|
|
|
|
(!exist.movedToUri && updates.movedToUri) ||
|
|
|
|
|
// 移行先がある→別のもの
|
|
|
|
|
(exist.movedToUri !== updates.movedToUri && exist.movedToUri && updates.movedToUri);
|
|
|
|
|
// 移行先がある→ない、ない→ないは無視
|
|
|
|
|
|
|
|
|
|
if (moving) updates.movedAt = new Date();
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
if (avatar) {
|
|
|
|
|
updates.avatarId = avatar.id;
|
2023-04-06 10:48:24 +00:00
|
|
|
|
updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
|
|
|
|
|
updates.avatarBlurhash = avatar.blurhash;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (banner) {
|
|
|
|
|
updates.bannerId = banner.id;
|
2023-04-06 10:48:24 +00:00
|
|
|
|
updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
|
|
|
|
|
updates.bannerBlurhash = banner.blurhash;
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update user
|
|
|
|
|
await this.usersRepository.update(exist.id, updates);
|
|
|
|
|
|
|
|
|
|
if (person.publicKey) {
|
|
|
|
|
await this.userPublickeysRepository.update({ userId: exist.id }, {
|
|
|
|
|
keyId: person.publicKey.id,
|
|
|
|
|
keyPem: person.publicKey.publicKeyPem,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await this.userProfilesRepository.update({ userId: exist.id }, {
|
2023-02-07 10:58:58 +00:00
|
|
|
|
url: url,
|
2022-09-17 18:27:08 +00:00
|
|
|
|
fields,
|
|
|
|
|
description: person.summary ? this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null,
|
|
|
|
|
birthday: bday ? bday[0] : null,
|
|
|
|
|
location: person['vcard:Address'] ?? null,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: exist.id });
|
|
|
|
|
|
|
|
|
|
// ハッシュタグ更新
|
|
|
|
|
this.hashtagService.updateUsertags(exist, tags);
|
|
|
|
|
|
|
|
|
|
// 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
|
|
|
|
|
await this.followingsRepository.update({
|
|
|
|
|
followerId: exist.id,
|
|
|
|
|
}, {
|
|
|
|
|
followerSharedInbox: person.sharedInbox ?? (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
|
|
|
|
});
|
|
|
|
|
|
2022-12-02 21:13:36 +00:00
|
|
|
|
await this.updateFeatured(exist.id, resolver).catch(err => this.logger.error(err));
|
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
|
|
|
|
|
|
|
|
|
const updated = { ...exist, ...updates };
|
|
|
|
|
|
|
|
|
|
this.cacheService.uriPersonCache.set(uri, updated);
|
|
|
|
|
|
|
|
|
|
// 移行処理を行う
|
|
|
|
|
if (updated.movedAt && (
|
|
|
|
|
// 初めて移行する場合はmovedAtがnullなので移行処理を許可
|
|
|
|
|
exist.movedAt == null ||
|
|
|
|
|
// 以前のmovingから14日以上経過した場合のみ移行処理を許可
|
|
|
|
|
// (Mastodonのクールダウン期間は30日だが若干緩めに設定しておく)
|
|
|
|
|
exist.movedAt.getTime() + 1000 * 60 * 60 * 24 * 14 < updated.movedAt.getTime()
|
|
|
|
|
)) {
|
|
|
|
|
this.logger.info(`Start to process Move of @${updated.username}@${updated.host} (${uri})`);
|
|
|
|
|
return this.processRemoteMove(updated, movePreventUris)
|
|
|
|
|
.then(result => {
|
|
|
|
|
this.logger.info(`Processing Move Finished [${result}] @${updated.username}@${updated.host} (${uri})`);
|
|
|
|
|
return result;
|
|
|
|
|
})
|
|
|
|
|
.catch(e => {
|
|
|
|
|
this.logger.info(`Processing Move Failed @${updated.username}@${updated.host} (${uri})`, { stack: e });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 'skip';
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Personを解決します。
|
|
|
|
|
*
|
|
|
|
|
* Misskeyに対象のPersonが登録されていればそれを返し、そうでなければ
|
|
|
|
|
* リモートサーバーからフェッチしてMisskeyに登録しそれを返します。
|
|
|
|
|
*/
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
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
|
|
|
|
public async resolvePerson(uri: string, resolver?: Resolver): Promise<LocalUser | RemoteUser> {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (typeof uri !== 'string') throw new Error('uri is not string');
|
|
|
|
|
|
|
|
|
|
//#region このサーバーに既に登録されていたらそれを返す
|
|
|
|
|
const exist = await this.fetchPerson(uri);
|
|
|
|
|
|
|
|
|
|
if (exist) {
|
|
|
|
|
return exist;
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
// リモートサーバーからフェッチしてきて登録
|
|
|
|
|
if (resolver == null) resolver = this.apResolverService.createResolver();
|
2023-02-13 06:28:07 +00:00
|
|
|
|
return await this.createPerson(uri, resolver);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
2022-09-17 18:27:08 +00:00
|
|
|
|
public analyzeAttachments(attachments: IObject | IObject[] | undefined) {
|
|
|
|
|
const fields: {
|
|
|
|
|
name: string,
|
|
|
|
|
value: string
|
|
|
|
|
}[] = [];
|
|
|
|
|
if (Array.isArray(attachments)) {
|
|
|
|
|
for (const attachment of attachments.filter(isPropertyValue)) {
|
2023-02-03 06:01:31 +00:00
|
|
|
|
fields.push({
|
|
|
|
|
name: attachment.name,
|
|
|
|
|
value: this.mfmService.fromHtml(attachment.value),
|
|
|
|
|
});
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-03 06:01:31 +00:00
|
|
|
|
return { fields };
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 06:03:09 +00:00
|
|
|
|
@bindThis
|
2022-12-02 21:13:36 +00:00
|
|
|
|
public async updateFeatured(userId: User['id'], resolver?: Resolver) {
|
2022-09-17 18:27:08 +00:00
|
|
|
|
const user = await this.usersRepository.findOneByOrFail({ id: userId });
|
|
|
|
|
if (!this.userEntityService.isRemoteUser(user)) return;
|
|
|
|
|
if (!user.featured) return;
|
|
|
|
|
|
2022-09-18 18:11:50 +00:00
|
|
|
|
this.logger.info(`Updating the featured: ${user.uri}`);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
2023-01-25 02:23:57 +00:00
|
|
|
|
const _resolver = resolver ?? this.apResolverService.createResolver();
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
// Resolve to (Ordered)Collection Object
|
2023-01-25 02:23:57 +00:00
|
|
|
|
const collection = await _resolver.resolveCollection(user.featured);
|
2022-09-17 18:27:08 +00:00
|
|
|
|
if (!isCollectionOrOrderedCollection(collection)) throw new Error('Object is not Collection or OrderedCollection');
|
|
|
|
|
|
|
|
|
|
// Resolve to Object(may be Note) arrays
|
|
|
|
|
const unresolvedItems = isCollection(collection) ? collection.items : collection.orderedItems;
|
2023-01-25 02:23:57 +00:00
|
|
|
|
const items = await Promise.all(toArray(unresolvedItems).map(x => _resolver.resolve(x)));
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
// Resolve and regist Notes
|
|
|
|
|
const limit = promiseLimit<Note | null>(2);
|
|
|
|
|
const featuredNotes = await Promise.all(items
|
|
|
|
|
.filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも
|
|
|
|
|
.slice(0, 5)
|
2023-01-25 02:23:57 +00:00
|
|
|
|
.map(item => limit(() => this.apNoteService.resolveNote(item, _resolver))));
|
2022-09-17 18:27:08 +00:00
|
|
|
|
|
|
|
|
|
await this.db.transaction(async transactionalEntityManager => {
|
|
|
|
|
await transactionalEntityManager.delete(UserNotePining, { userId: user.id });
|
|
|
|
|
|
|
|
|
|
// とりあえずidを別の時間で生成して順番を維持
|
|
|
|
|
let td = 0;
|
|
|
|
|
for (const note of featuredNotes.filter(note => note != null)) {
|
|
|
|
|
td -= 1000;
|
|
|
|
|
transactionalEntityManager.insert(UserNotePining, {
|
|
|
|
|
id: this.idService.genId(new Date(Date.now() + td)),
|
|
|
|
|
createdAt: new Date(),
|
|
|
|
|
userId: user.id,
|
|
|
|
|
noteId: note!.id,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* リモート由来のアカウント移行処理を行います
|
|
|
|
|
* @param src 移行元アカウント(リモートかつupdatePerson後である必要がある、というかこれ自体がupdatePersonで呼ばれる前提)
|
|
|
|
|
* @param movePreventUris ここに列挙されたURIにsrc.movedToUriが含まれる場合、移行処理はしない(無限ループ防止)
|
|
|
|
|
*/
|
|
|
|
|
@bindThis
|
|
|
|
|
private async processRemoteMove(src: RemoteUser, movePreventUris: string[] = []): Promise<string> {
|
|
|
|
|
if (!src.movedToUri) return 'skip: no movedToUri';
|
|
|
|
|
if (src.uri === src.movedToUri) return 'skip: movedTo itself (src)'; // ???
|
|
|
|
|
if (movePreventUris.length > 10) return 'skip: too many moves';
|
|
|
|
|
|
|
|
|
|
// まずサーバー内で検索して様子見
|
|
|
|
|
let dst = await this.fetchPerson(src.movedToUri);
|
|
|
|
|
|
|
|
|
|
if (dst && this.userEntityService.isLocalUser(dst)) {
|
|
|
|
|
// targetがローカルユーザーだった場合データベースから引っ張ってくる
|
|
|
|
|
dst = await this.usersRepository.findOneByOrFail({ uri: src.movedToUri }) as LocalUser;
|
|
|
|
|
} else if (dst) {
|
|
|
|
|
if (movePreventUris.includes(src.movedToUri)) return 'skip: circular move';
|
|
|
|
|
|
|
|
|
|
// targetを見つけたことがあるならtargetをupdatePersonする
|
|
|
|
|
await this.updatePerson(src.movedToUri, undefined, undefined, [...movePreventUris, src.uri]);
|
|
|
|
|
dst = await this.fetchPerson(src.movedToUri) ?? dst;
|
|
|
|
|
} else {
|
|
|
|
|
if (src.movedToUri.startsWith(`${this.config.url}/`)) {
|
|
|
|
|
// ローカルユーザーっぽいのにfetchPersonで見つからないということはmovedToUriが間違っている
|
|
|
|
|
return 'failed: movedTo is local but not found';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// targetが知らない人だったらresolvePerson
|
|
|
|
|
// (uriが存在しなかったり応答がなかったりする場合resolvePersonはthrow Errorする)
|
|
|
|
|
dst = await this.resolvePerson(src.movedToUri);
|
|
|
|
|
}
|
2023-07-07 22:08:16 +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
|
|
|
|
if (dst.movedToUri === dst.uri) return 'skip: movedTo itself (dst)'; // ???
|
|
|
|
|
if (src.movedToUri !== dst.uri) return 'skip: missmatch uri'; // ???
|
|
|
|
|
if (dst.movedToUri === src.uri) return 'skip: dst.movedToUri === src.uri';
|
|
|
|
|
if (!dst.alsoKnownAs || dst.alsoKnownAs.length === 0) {
|
|
|
|
|
return 'skip: dst.alsoKnownAs is empty';
|
|
|
|
|
}
|
2023-05-16 03:16:37 +00:00
|
|
|
|
if (!dst.alsoKnownAs.includes(src.uri)) {
|
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 'skip: alsoKnownAs does not include from.uri';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await this.accountMoveService.postMoveProcess(src, dst);
|
|
|
|
|
|
|
|
|
|
return 'ok';
|
|
|
|
|
}
|
2022-09-17 18:27:08 +00:00
|
|
|
|
}
|