2022-02-27 03:07:39 +01:00
|
|
|
import RE2 from 're2';
|
2021-04-02 03:36:11 +02:00
|
|
|
import * as mfm from 'mfm-js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
2022-02-27 03:07:39 +01:00
|
|
|
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
|
|
|
import { extractHashtags } from '@/misc/extract-hashtags.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 17:09:29 +02:00
|
|
|
import * as Acct from '@/misc/acct.js';
|
2022-09-20 22:33:11 +02:00
|
|
|
import type { UsersRepository, DriveFilesRepository, UserProfilesRepository, PagesRepository } from '@/models/index.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import type { User } from '@/models/entities/User.js';
|
|
|
|
import { birthdaySchema, descriptionSchema, locationSchema, nameSchema } from '@/models/entities/User.js';
|
|
|
|
import type { UserProfile } from '@/models/entities/UserProfile.js';
|
2022-02-27 03:07:39 +01:00
|
|
|
import { notificationTypes } from '@/types.js';
|
|
|
|
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
|
|
|
import { langmap } from '@/misc/langmap.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
|
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
|
|
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
|
|
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
|
|
|
import { AccountUpdateService } from '@/core/AccountUpdateService.js';
|
|
|
|
import { HashtagService } from '@/core/HashtagService.js';
|
|
|
|
import { DI } from '@/di-symbols.js';
|
2023-01-14 00:04:38 +01:00
|
|
|
import { RoleService } from '@/core/RoleService.js';
|
2023-04-04 10:32:09 +02:00
|
|
|
import { CacheService } from '@/core/CacheService.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 17:09:29 +02:00
|
|
|
import { AccountMoveService } from '@/core/AccountMoveService.js';
|
|
|
|
import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js';
|
2023-04-06 12:48:24 +02:00
|
|
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.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 17:09:29 +02:00
|
|
|
import { ApiLoggerService } from '../../ApiLoggerService.js';
|
2022-07-07 14:06:37 +02:00
|
|
|
import { ApiError } from '../../error.js';
|
2016-12-28 23:49:51 +01:00
|
|
|
|
2018-07-16 21:36:44 +02:00
|
|
|
export const meta = {
|
2019-02-23 03:20:58 +01:00
|
|
|
tags: ['account'],
|
|
|
|
|
2022-01-18 14:27:10 +01:00
|
|
|
requireCredential: true,
|
2018-07-16 21:36:44 +02:00
|
|
|
|
2019-04-07 14:50:36 +02:00
|
|
|
kind: 'write:account',
|
2018-09-09 19:21:16 +02:00
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
errors: {
|
|
|
|
noSuchAvatar: {
|
|
|
|
message: 'No such avatar file.',
|
|
|
|
code: 'NO_SUCH_AVATAR',
|
2021-12-09 15:58:30 +01:00
|
|
|
id: '539f3a45-f215-4f81-a9a8-31293640207f',
|
2019-02-22 03:46:58 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
noSuchBanner: {
|
|
|
|
message: 'No such banner file.',
|
|
|
|
code: 'NO_SUCH_BANNER',
|
2021-12-09 15:58:30 +01:00
|
|
|
id: '0d8f5629-f210-41c2-9433-735831a58595',
|
2019-02-22 03:46:58 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
avatarNotAnImage: {
|
|
|
|
message: 'The file specified as an avatar is not an image.',
|
|
|
|
code: 'AVATAR_NOT_AN_IMAGE',
|
2021-12-09 15:58:30 +01:00
|
|
|
id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191',
|
2019-02-22 03:46:58 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
bannerNotAnImage: {
|
|
|
|
message: 'The file specified as a banner is not an image.',
|
|
|
|
code: 'BANNER_NOT_AN_IMAGE',
|
2021-12-09 15:58:30 +01:00
|
|
|
id: '75aedb19-2afd-4e6d-87fc-67941256fa60',
|
2019-07-06 23:56:13 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
noSuchPage: {
|
|
|
|
message: 'No such page.',
|
|
|
|
code: 'NO_SUCH_PAGE',
|
2021-12-09 15:58:30 +01:00
|
|
|
id: '8e01b590-7eb9-431b-a239-860e086c408e',
|
2019-07-06 23:56:13 +02:00
|
|
|
},
|
2022-02-10 11:47:46 +01:00
|
|
|
|
|
|
|
invalidRegexp: {
|
|
|
|
message: 'Invalid Regular Expression.',
|
|
|
|
code: 'INVALID_REGEXP',
|
|
|
|
id: '0d786918-10df-41cd-8f33-8dec7d9a89a5',
|
2022-07-07 14:06:37 +02:00
|
|
|
},
|
2023-01-14 00:04:38 +01:00
|
|
|
|
|
|
|
tooManyMutedWords: {
|
|
|
|
message: 'Too many muted words.',
|
|
|
|
code: 'TOO_MANY_MUTED_WORDS',
|
|
|
|
id: '010665b1-a211-42d2-bc64-8f6609d79785',
|
|
|
|
},
|
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 17:09:29 +02:00
|
|
|
|
|
|
|
noSuchUser: {
|
|
|
|
message: 'No such user.',
|
|
|
|
code: 'NO_SUCH_USER',
|
|
|
|
id: 'fcd2eef9-a9b2-4c4f-8624-038099e90aa5',
|
|
|
|
},
|
|
|
|
|
|
|
|
uriNull: {
|
|
|
|
message: 'User ActivityPup URI is null.',
|
|
|
|
code: 'URI_NULL',
|
|
|
|
id: 'bf326f31-d430-4f97-9933-5d61e4d48a23',
|
|
|
|
},
|
|
|
|
|
|
|
|
forbiddenToSetYourself: {
|
|
|
|
message: 'You can\'t set yourself as your own alias.',
|
|
|
|
code: 'FORBIDDEN_TO_SET_YOURSELF',
|
|
|
|
id: '25c90186-4ab0-49c8-9bba-a1fa6c202ba4',
|
|
|
|
},
|
2023-05-05 07:18:06 +02:00
|
|
|
|
|
|
|
restrictedByRole: {
|
|
|
|
message: 'This feature is restricted by your role.',
|
|
|
|
code: 'RESTRICTED_BY_ROLE',
|
|
|
|
id: '8feff0ba-5ab5-585b-31f4-4df816663fad',
|
|
|
|
}
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
res: {
|
2022-01-18 14:27:10 +01:00
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
ref: 'MeDetailed',
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2022-01-18 14:27:10 +01:00
|
|
|
} as const;
|
2018-07-16 21:36:44 +02:00
|
|
|
|
2022-02-20 05:15:40 +01:00
|
|
|
export const paramDef = {
|
2022-02-19 06:05:32 +01:00
|
|
|
type: 'object',
|
|
|
|
properties: {
|
2022-09-17 20:27:08 +02:00
|
|
|
name: { ...nameSchema, nullable: true },
|
|
|
|
description: { ...descriptionSchema, nullable: true },
|
|
|
|
location: { ...locationSchema, nullable: true },
|
|
|
|
birthday: { ...birthdaySchema, nullable: true },
|
2022-09-24 10:02:19 +02:00
|
|
|
lang: { type: 'string', enum: [null, ...Object.keys(langmap)] as string[], nullable: true },
|
2022-02-19 06:05:32 +01:00
|
|
|
avatarId: { type: 'string', format: 'misskey:id', nullable: true },
|
|
|
|
bannerId: { type: 'string', format: 'misskey:id', nullable: true },
|
2022-07-07 14:06:37 +02:00
|
|
|
fields: {
|
|
|
|
type: 'array',
|
2022-02-19 06:05:32 +01:00
|
|
|
minItems: 0,
|
2022-02-20 08:53:06 +01:00
|
|
|
maxItems: 16,
|
2022-02-19 06:05:32 +01:00
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
name: { type: 'string' },
|
|
|
|
value: { type: 'string' },
|
|
|
|
},
|
|
|
|
required: ['name', 'value'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
isLocked: { type: 'boolean' },
|
|
|
|
isExplorable: { type: 'boolean' },
|
|
|
|
hideOnlineStatus: { type: 'boolean' },
|
|
|
|
publicReactions: { type: 'boolean' },
|
|
|
|
carefulBot: { type: 'boolean' },
|
|
|
|
autoAcceptFollowed: { type: 'boolean' },
|
|
|
|
noCrawle: { type: 'boolean' },
|
|
|
|
isBot: { type: 'boolean' },
|
|
|
|
isCat: { type: 'boolean' },
|
|
|
|
showTimelineReplies: { type: 'boolean' },
|
|
|
|
injectFeaturedNote: { type: 'boolean' },
|
|
|
|
receiveAnnouncementEmail: { type: 'boolean' },
|
|
|
|
alwaysMarkNsfw: { type: 'boolean' },
|
2022-07-07 14:06:37 +02:00
|
|
|
autoSensitive: { type: 'boolean' },
|
2022-02-19 06:05:32 +01:00
|
|
|
ffVisibility: { type: 'string', enum: ['public', 'followers', 'private'] },
|
2022-09-24 10:02:19 +02:00
|
|
|
pinnedPageId: { type: 'string', format: 'misskey:id' },
|
2022-02-19 06:05:32 +01:00
|
|
|
mutedWords: { type: 'array' },
|
|
|
|
mutedInstances: { type: 'array', items: {
|
|
|
|
type: 'string',
|
|
|
|
} },
|
|
|
|
mutingNotificationTypes: { type: 'array', items: {
|
|
|
|
type: 'string', enum: notificationTypes,
|
|
|
|
} },
|
|
|
|
emailNotificationTypes: { type: 'array', items: {
|
|
|
|
type: '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 17:09:29 +02:00
|
|
|
alsoKnownAs: {
|
|
|
|
type: 'array',
|
|
|
|
maxItems: 10,
|
|
|
|
uniqueItems: true,
|
|
|
|
items: { type: 'string' },
|
|
|
|
},
|
2022-02-19 06:05:32 +01:00
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
2022-01-02 18:12:50 +01:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-09-17 20:27:08 +02:00
|
|
|
@Injectable()
|
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|
|
|
constructor(
|
|
|
|
@Inject(DI.usersRepository)
|
|
|
|
private usersRepository: UsersRepository,
|
|
|
|
|
|
|
|
@Inject(DI.userProfilesRepository)
|
|
|
|
private userProfilesRepository: UserProfilesRepository,
|
|
|
|
|
|
|
|
@Inject(DI.driveFilesRepository)
|
|
|
|
private driveFilesRepository: DriveFilesRepository,
|
|
|
|
|
|
|
|
@Inject(DI.pagesRepository)
|
|
|
|
private pagesRepository: PagesRepository,
|
|
|
|
|
|
|
|
private userEntityService: UserEntityService,
|
2023-04-06 12:48:24 +02:00
|
|
|
private driveFileEntityService: DriveFileEntityService,
|
2022-09-17 20:27:08 +02:00
|
|
|
private globalEventService: GlobalEventService,
|
|
|
|
private userFollowingService: UserFollowingService,
|
|
|
|
private accountUpdateService: AccountUpdateService,
|
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 17:09:29 +02:00
|
|
|
private accountMoveService: AccountMoveService,
|
|
|
|
private remoteUserResolveService: RemoteUserResolveService,
|
|
|
|
private apiLoggerService: ApiLoggerService,
|
2022-09-17 20:27:08 +02:00
|
|
|
private hashtagService: HashtagService,
|
2023-01-14 00:04:38 +01:00
|
|
|
private roleService: RoleService,
|
2023-04-04 10:32:09 +02:00
|
|
|
private cacheService: CacheService,
|
2022-09-17 20:27:08 +02:00
|
|
|
) {
|
|
|
|
super(meta, paramDef, async (ps, _user, token) => {
|
|
|
|
const user = await this.usersRepository.findOneByOrFail({ id: _user.id });
|
|
|
|
const isSecure = token == null;
|
|
|
|
|
|
|
|
const updates = {} as Partial<User>;
|
|
|
|
const profileUpdates = {} as Partial<UserProfile>;
|
|
|
|
|
|
|
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
|
|
|
|
|
|
|
if (ps.name !== undefined) updates.name = ps.name;
|
|
|
|
if (ps.description !== undefined) profileUpdates.description = ps.description;
|
|
|
|
if (ps.lang !== undefined) profileUpdates.lang = ps.lang;
|
|
|
|
if (ps.location !== undefined) profileUpdates.location = ps.location;
|
|
|
|
if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday;
|
|
|
|
if (ps.ffVisibility !== undefined) profileUpdates.ffVisibility = ps.ffVisibility;
|
|
|
|
if (ps.mutedWords !== undefined) {
|
2023-01-14 00:04:38 +01:00
|
|
|
// TODO: ちゃんと数える
|
|
|
|
const length = JSON.stringify(ps.mutedWords).length;
|
2023-01-15 12:52:53 +01:00
|
|
|
if (length > (await this.roleService.getUserPolicies(user.id)).wordMuteLimit) {
|
2023-01-14 00:04:38 +01:00
|
|
|
throw new ApiError(meta.errors.tooManyMutedWords);
|
|
|
|
}
|
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
// validate regular expression syntax
|
|
|
|
ps.mutedWords.filter(x => !Array.isArray(x)).forEach(x => {
|
|
|
|
const regexp = x.match(/^\/(.+)\/(.*)$/);
|
|
|
|
if (!regexp) throw new ApiError(meta.errors.invalidRegexp);
|
|
|
|
|
|
|
|
try {
|
|
|
|
new RE2(regexp[1], regexp[2]);
|
|
|
|
} catch (err) {
|
|
|
|
throw new ApiError(meta.errors.invalidRegexp);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
profileUpdates.mutedWords = ps.mutedWords;
|
|
|
|
profileUpdates.enableWordMute = ps.mutedWords.length > 0;
|
|
|
|
}
|
|
|
|
if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances;
|
|
|
|
if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = ps.mutingNotificationTypes as typeof notificationTypes[number][];
|
|
|
|
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
|
|
|
|
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
|
|
|
if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus;
|
|
|
|
if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions;
|
|
|
|
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
|
|
|
|
if (typeof ps.showTimelineReplies === 'boolean') updates.showTimelineReplies = ps.showTimelineReplies;
|
|
|
|
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
|
|
|
|
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
|
|
|
|
if (typeof ps.noCrawle === 'boolean') profileUpdates.noCrawle = ps.noCrawle;
|
|
|
|
if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat;
|
|
|
|
if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote;
|
|
|
|
if (typeof ps.receiveAnnouncementEmail === 'boolean') profileUpdates.receiveAnnouncementEmail = ps.receiveAnnouncementEmail;
|
2023-05-05 07:18:06 +02:00
|
|
|
if (typeof ps.alwaysMarkNsfw === 'boolean') {
|
|
|
|
if ((await roleService.getUserPolicies(user.id)).alwaysMarkNsfw) throw new ApiError(meta.errors.restrictedByRole);
|
|
|
|
profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw;
|
|
|
|
}
|
2022-09-17 20:27:08 +02:00
|
|
|
if (typeof ps.autoSensitive === 'boolean') profileUpdates.autoSensitive = ps.autoSensitive;
|
|
|
|
if (ps.emailNotificationTypes !== undefined) profileUpdates.emailNotificationTypes = ps.emailNotificationTypes;
|
|
|
|
|
|
|
|
if (ps.avatarId) {
|
|
|
|
const avatar = await this.driveFilesRepository.findOneBy({ id: ps.avatarId });
|
|
|
|
|
|
|
|
if (avatar == null || avatar.userId !== user.id) throw new ApiError(meta.errors.noSuchAvatar);
|
|
|
|
if (!avatar.type.startsWith('image/')) throw new ApiError(meta.errors.avatarNotAnImage);
|
2023-04-06 12:48:24 +02:00
|
|
|
|
|
|
|
updates.avatarId = avatar.id;
|
|
|
|
updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
|
|
|
|
updates.avatarBlurhash = avatar.blurhash;
|
2023-04-16 08:23:49 +02:00
|
|
|
} else if (ps.avatarId === null) {
|
|
|
|
updates.avatarId = null;
|
|
|
|
updates.avatarUrl = null;
|
|
|
|
updates.avatarBlurhash = null;
|
2022-02-10 11:47:46 +01:00
|
|
|
}
|
2018-05-06 11:04:37 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (ps.bannerId) {
|
|
|
|
const banner = await this.driveFilesRepository.findOneBy({ id: ps.bannerId });
|
2018-05-06 11:04:37 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (banner == null || banner.userId !== user.id) throw new ApiError(meta.errors.noSuchBanner);
|
|
|
|
if (!banner.type.startsWith('image/')) throw new ApiError(meta.errors.bannerNotAnImage);
|
2023-04-06 12:48:24 +02:00
|
|
|
|
|
|
|
updates.bannerId = banner.id;
|
|
|
|
updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
|
|
|
|
updates.bannerBlurhash = banner.blurhash;
|
2023-04-16 08:23:49 +02:00
|
|
|
} else if (ps.bannerId === null) {
|
|
|
|
updates.bannerId = null;
|
|
|
|
updates.bannerUrl = null;
|
|
|
|
updates.bannerBlurhash = null;
|
2022-09-17 20:27:08 +02:00
|
|
|
}
|
2018-06-06 22:14:37 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (ps.pinnedPageId) {
|
|
|
|
const page = await this.pagesRepository.findOneBy({ id: ps.pinnedPageId });
|
2019-07-06 23:56:13 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (page == null || page.userId !== user.id) throw new ApiError(meta.errors.noSuchPage);
|
2019-07-06 23:56:13 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
profileUpdates.pinnedPageId = page.id;
|
|
|
|
} else if (ps.pinnedPageId === null) {
|
|
|
|
profileUpdates.pinnedPageId = null;
|
|
|
|
}
|
2019-07-06 23:56:13 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (ps.fields) {
|
|
|
|
profileUpdates.fields = ps.fields
|
|
|
|
.filter(x => typeof x.name === 'string' && x.name !== '' && typeof x.value === 'string' && x.value !== '')
|
|
|
|
.map(x => {
|
|
|
|
return { name: x.name, value: x.value };
|
|
|
|
});
|
|
|
|
}
|
2019-07-17 17:11:39 +02: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 17:09:29 +02:00
|
|
|
if (ps.alsoKnownAs) {
|
|
|
|
if (_user.movedToUri) {
|
|
|
|
throw new ApiError({
|
|
|
|
message: 'You have moved your account.',
|
|
|
|
code: 'YOUR_ACCOUNT_MOVED',
|
|
|
|
id: '56f20ec9-fd06-4fa5-841b-edd6d7d4fa31',
|
|
|
|
httpStatusCode: 403,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse user's input into the old account
|
|
|
|
const newAlsoKnownAs = new Set<string>();
|
|
|
|
for (const line of ps.alsoKnownAs) {
|
|
|
|
if (!line) throw new ApiError(meta.errors.noSuchUser);
|
|
|
|
const { username, host } = Acct.parse(line);
|
|
|
|
|
|
|
|
// Retrieve the old account
|
|
|
|
const knownAs = await this.remoteUserResolveService.resolveUser(username, host).catch((e) => {
|
|
|
|
this.apiLoggerService.logger.warn(`failed to resolve dstination user: ${e}`);
|
|
|
|
throw new ApiError(meta.errors.noSuchUser);
|
|
|
|
});
|
|
|
|
if (knownAs.id === _user.id) throw new ApiError(meta.errors.forbiddenToSetYourself);
|
|
|
|
|
|
|
|
const toUrl = this.userEntityService.getUserUri(knownAs);
|
|
|
|
if (!toUrl) throw new ApiError(meta.errors.uriNull);
|
|
|
|
|
|
|
|
newAlsoKnownAs.add(toUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
updates.alsoKnownAs = newAlsoKnownAs.size > 0 ? Array.from(newAlsoKnownAs) : null;
|
|
|
|
}
|
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
//#region emojis/tags
|
2019-04-17 07:30:31 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
let emojis = [] as string[];
|
|
|
|
let tags = [] as string[];
|
2018-12-06 02:02:04 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
const newName = updates.name === undefined ? user.name : updates.name;
|
|
|
|
const newDescription = profileUpdates.description === undefined ? profile.description : profileUpdates.description;
|
2019-04-17 07:30:31 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (newName != null) {
|
|
|
|
const tokens = mfm.parseSimple(newName);
|
|
|
|
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens!));
|
|
|
|
}
|
2018-12-06 02:02:04 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (newDescription != null) {
|
|
|
|
const tokens = mfm.parse(newDescription);
|
|
|
|
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens!));
|
|
|
|
tags = extractHashtags(tokens!).map(tag => normalizeForSearch(tag)).splice(0, 32);
|
|
|
|
}
|
2018-12-06 02:02:04 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
updates.emojis = emojis;
|
|
|
|
updates.tags = tags;
|
2019-02-17 15:41:47 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
// ハッシュタグ更新
|
|
|
|
this.hashtagService.updateUsertags(user, tags);
|
|
|
|
//#endregion
|
2018-12-06 02:02:04 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
if (Object.keys(updates).length > 0) await this.usersRepository.update(user.id, updates);
|
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 17:09:29 +02:00
|
|
|
if (Object.keys(updates).includes('alsoKnownAs')) {
|
|
|
|
this.cacheService.uriPersonCache.set(this.userEntityService.genLocalUserUri(user.id), { ...user, ...updates });
|
|
|
|
}
|
2022-09-17 20:27:08 +02:00
|
|
|
if (Object.keys(profileUpdates).length > 0) await this.userProfilesRepository.update(user.id, profileUpdates);
|
2016-12-28 23:49:51 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
const iObj = await this.userEntityService.pack<true, true>(user.id, user, {
|
|
|
|
detail: true,
|
|
|
|
includeSecrets: isSecure,
|
|
|
|
});
|
2016-12-28 23:49:51 +01:00
|
|
|
|
2023-04-04 10:32:09 +02:00
|
|
|
const updatedProfile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
|
|
|
|
|
|
|
this.cacheService.userProfileCache.set(user.id, updatedProfile);
|
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
// Publish meUpdated event
|
|
|
|
this.globalEventService.publishMainStream(user.id, 'meUpdated', iObj);
|
2018-05-31 15:56:02 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
// 鍵垢を解除したとき、溜まっていたフォローリクエストがあるならすべて承認
|
|
|
|
if (user.isLocked && ps.isLocked === false) {
|
|
|
|
this.userFollowingService.acceptAllFollowRequests(user);
|
|
|
|
}
|
2018-09-01 13:17:30 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
// フォロワーにUpdateを配信
|
|
|
|
this.accountUpdateService.publishToFollowers(user.id);
|
2019-02-22 03:46:58 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
return iObj;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|