Compare commits
23 Commits
c58b1fb20c
...
7d24f44b3d
Author | SHA1 | Date |
---|---|---|
かっこかり | 7d24f44b3d | |
github-actions[bot] | 872cefcfb8 | |
github-actions[bot] | 551040ed0f | |
syuilo | 71bfa85986 | |
かっこかり | 6b97d55165 | |
kakkokari-gtyih | c85dd40871 | |
kakkokari-gtyih | 4a68df9c05 | |
かっこかり | 7159b7dd1f | |
かっこかり | 0a377fabc0 | |
かっこかり | c1bbc6dfcd | |
かっこかり | 2678b7638b | |
kakkokari-gtyih | b3fc288249 | |
kakkokari-gtyih | 3ba272fdb4 | |
kakkokari-gtyih | a3d77f3185 | |
kakkokari-gtyih | 0978aa429a | |
kakkokari-gtyih | 0dc536a3fa | |
kakkokari-gtyih | d96b2b8e9d | |
kakkokari-gtyih | 48719ebb08 | |
kakkokari-gtyih | 438abb6303 | |
kakkokari-gtyih | 52ee21b2ee | |
かっこかり | 4a21edacde | |
かっこかり | 8c9f1bedf2 | |
kakkokari-gtyih | e06a6a1f19 |
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,3 +1,15 @@
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### General
|
||||||
|
-
|
||||||
|
|
||||||
|
### Client
|
||||||
|
-
|
||||||
|
|
||||||
|
### Server
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
## 2024.11.0
|
## 2024.11.0
|
||||||
|
|
||||||
### Note
|
### Note
|
||||||
|
@ -8,6 +20,8 @@
|
||||||
### General
|
### General
|
||||||
- Feat: コンテンツの表示にログインを必須にできるように
|
- Feat: コンテンツの表示にログインを必須にできるように
|
||||||
- Feat: 過去のノートを非公開化/フォロワーのみ表示可能にできるように
|
- Feat: 過去のノートを非公開化/フォロワーのみ表示可能にできるように
|
||||||
|
- Feat: ユーザー登録時に自動で特定のユーザーをフォローすることができるように
|
||||||
|
- フォローさせるユーザーのフォロー解除・ミュート・ブロックができないように指定することもできます
|
||||||
- Enhance: 依存関係の更新
|
- Enhance: 依存関係の更新
|
||||||
- Enhance: l10nの更新
|
- Enhance: l10nの更新
|
||||||
- Fix: お知らせ作成時に画像URL入力欄を空欄に変更できないのを修正 ( #14976 )
|
- Fix: お知らせ作成時に画像URL入力欄を空欄に変更できないのを修正 ( #14976 )
|
||||||
|
|
|
@ -5222,6 +5222,38 @@ export interface Locale extends ILocale {
|
||||||
* 注意事項を理解した上でオンにします。
|
* 注意事項を理解した上でオンにします。
|
||||||
*/
|
*/
|
||||||
"acknowledgeNotesAndEnable": string;
|
"acknowledgeNotesAndEnable": string;
|
||||||
|
/**
|
||||||
|
* デフォルトでフォローするユーザー (ID)
|
||||||
|
*/
|
||||||
|
"defaultFollowedUsers": string;
|
||||||
|
/**
|
||||||
|
* 今後アカウントが作成された際に自動でフォローされるユーザー(解除可能)のユーザーIDを改行区切りで指定します。
|
||||||
|
*/
|
||||||
|
"defaultFollowedUsersDescription": string;
|
||||||
|
/**
|
||||||
|
* 交流を断てないユーザー (ID)
|
||||||
|
*/
|
||||||
|
"forciblyFollowedUsers": string;
|
||||||
|
/**
|
||||||
|
* 今後アカウントが作成された際には自動でフォローされ、フォローの解除やミュート・ブロックができないユーザーのユーザーIDを改行区切りで指定します。
|
||||||
|
*/
|
||||||
|
"forciblyFollowedUsersDescription": string;
|
||||||
|
/**
|
||||||
|
* 「デフォルトでフォローするユーザー」と「交流を絶てないユーザー」が重複しています。
|
||||||
|
*/
|
||||||
|
"defaultFollowedUsersDuplicated": string;
|
||||||
|
/**
|
||||||
|
* サーバー管理者はこのユーザーをフォロー解除することを禁止しています。
|
||||||
|
*/
|
||||||
|
"unfollowThisUserIsProhibited": string;
|
||||||
|
/**
|
||||||
|
* サーバー管理者はこのユーザーをブロックすることを禁止しています。
|
||||||
|
*/
|
||||||
|
"blockThisUserIsProhibited": string;
|
||||||
|
/**
|
||||||
|
* サーバー管理者はこのユーザーをミュートすることを禁止しています。
|
||||||
|
*/
|
||||||
|
"muteThisUserIsProhibited": string;
|
||||||
"_accountSettings": {
|
"_accountSettings": {
|
||||||
/**
|
/**
|
||||||
* コンテンツの表示にログインを必須にする
|
* コンテンツの表示にログインを必須にする
|
||||||
|
|
|
@ -1301,6 +1301,14 @@ lockdown: "ロックダウン"
|
||||||
pleaseSelectAccount: "アカウントを選択してください"
|
pleaseSelectAccount: "アカウントを選択してください"
|
||||||
availableRoles: "利用可能なロール"
|
availableRoles: "利用可能なロール"
|
||||||
acknowledgeNotesAndEnable: "注意事項を理解した上でオンにします。"
|
acknowledgeNotesAndEnable: "注意事項を理解した上でオンにします。"
|
||||||
|
defaultFollowedUsers: "デフォルトでフォローするユーザー (ID)"
|
||||||
|
defaultFollowedUsersDescription: "今後アカウントが作成された際に自動でフォローされるユーザー(解除可能)のユーザーIDを改行区切りで指定します。"
|
||||||
|
forciblyFollowedUsers: "交流を断てないユーザー (ID)"
|
||||||
|
forciblyFollowedUsersDescription: "今後アカウントが作成された際には自動でフォローされ、フォローの解除やミュート・ブロックができないユーザーのユーザーIDを改行区切りで指定します。"
|
||||||
|
defaultFollowedUsersDuplicated: "「デフォルトでフォローするユーザー」と「交流を絶てないユーザー」が重複しています。"
|
||||||
|
unfollowThisUserIsProhibited: "サーバー管理者はこのユーザーをフォロー解除することを禁止しています。"
|
||||||
|
blockThisUserIsProhibited: "サーバー管理者はこのユーザーをブロックすることを禁止しています。"
|
||||||
|
muteThisUserIsProhibited: "サーバー管理者はこのユーザーをミュートすることを禁止しています。"
|
||||||
|
|
||||||
_accountSettings:
|
_accountSettings:
|
||||||
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
|
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
|
||||||
|
|
|
@ -143,8 +143,8 @@ unmarkAsSensitive: "取消标记为敏感内容"
|
||||||
enterFileName: "输入文件名"
|
enterFileName: "输入文件名"
|
||||||
mute: "屏蔽"
|
mute: "屏蔽"
|
||||||
unmute: "解除静音"
|
unmute: "解除静音"
|
||||||
renoteMute: "屏蔽转帖"
|
renoteMute: "隐藏转帖"
|
||||||
renoteUnmute: "解除屏蔽转帖"
|
renoteUnmute: "解除隐藏转帖"
|
||||||
block: "拉黑"
|
block: "拉黑"
|
||||||
unblock: "取消拉黑"
|
unblock: "取消拉黑"
|
||||||
suspend: "冻结"
|
suspend: "冻结"
|
||||||
|
@ -213,7 +213,7 @@ charts: "图表"
|
||||||
perHour: "每小时"
|
perHour: "每小时"
|
||||||
perDay: "每天"
|
perDay: "每天"
|
||||||
stopActivityDelivery: "停止发送活动"
|
stopActivityDelivery: "停止发送活动"
|
||||||
blockThisInstance: "封锁此服务器"
|
blockThisInstance: "屏蔽此服务器"
|
||||||
silenceThisInstance: "静音此服务器"
|
silenceThisInstance: "静音此服务器"
|
||||||
mediaSilenceThisInstance: "隐藏此服务器的媒体文件"
|
mediaSilenceThisInstance: "隐藏此服务器的媒体文件"
|
||||||
operations: "操作"
|
operations: "操作"
|
||||||
|
@ -233,17 +233,17 @@ clearQueueConfirmTitle: "确定清除队列?"
|
||||||
clearQueueConfirmText: "未送达的帖子将不会被投递。 通常无需执行此操作。"
|
clearQueueConfirmText: "未送达的帖子将不会被投递。 通常无需执行此操作。"
|
||||||
clearCachedFiles: "清除缓存"
|
clearCachedFiles: "清除缓存"
|
||||||
clearCachedFilesConfirm: "确定要清除所有缓存的远程文件?"
|
clearCachedFilesConfirm: "确定要清除所有缓存的远程文件?"
|
||||||
blockedInstances: "被封锁的服务器"
|
blockedInstances: "被屏蔽的服务器"
|
||||||
blockedInstancesDescription: "设定要封锁的服务器,以换行分隔。被封锁的服务器将无法与本服务器进行交换通讯。子域名也同样会被封锁。"
|
blockedInstancesDescription: "设定要屏蔽的服务器,以换行分隔。被屏蔽的服务器将无法与本服务器进行交换通讯。子域名也同样会被屏蔽。"
|
||||||
silencedInstances: "被静音的服务器"
|
silencedInstances: "被静音的服务器"
|
||||||
silencedInstancesDescription: "设置要静音的服务器,以换行分隔。被静音的服务器内所有的账户将默认处于「静音」状态,仅能发送关注请求,并且在未关注状态下无法提及本地账户。被阻止的实例不受影响。"
|
silencedInstancesDescription: "设置要静音的服务器,以换行分隔。被静音的服务器内所有的账户将默认处于「静音」状态,仅能发送关注请求,并且在未关注状态下无法提及本地账户。被阻止的实例不受影响。"
|
||||||
mediaSilencedInstances: "已隐藏媒体文件的服务器"
|
mediaSilencedInstances: "已隐藏媒体文件的服务器"
|
||||||
mediaSilencedInstancesDescription: "设置要隐藏媒体文件的服务器,以换行分隔。被设置为隐藏媒体文件服务器内所有账号的文件均按照「敏感内容」处理,且将无法使用自定义表情符号。被阻止的实例不受影响。"
|
mediaSilencedInstancesDescription: "设置要隐藏媒体文件的服务器,以换行分隔。被设置为隐藏媒体文件服务器内所有账号的文件均按照「敏感内容」处理,且将无法使用自定义表情符号。被阻止的实例不受影响。"
|
||||||
federationAllowedHosts: "允许联合的服务器"
|
federationAllowedHosts: "允许联合的服务器"
|
||||||
federationAllowedHostsDescription: "设定允许联合的服务器,以换行分隔。"
|
federationAllowedHostsDescription: "设定允许联合的服务器,以换行分隔。"
|
||||||
muteAndBlock: "静音/拉黑"
|
muteAndBlock: "隐藏和屏蔽"
|
||||||
mutedUsers: "已静音用户"
|
mutedUsers: "已隐藏用户"
|
||||||
blockedUsers: "已拉黑的用户"
|
blockedUsers: "已屏蔽的用户"
|
||||||
noUsers: "无用户"
|
noUsers: "无用户"
|
||||||
editProfile: "编辑资料"
|
editProfile: "编辑资料"
|
||||||
noteDeleteConfirm: "要删除该帖子吗?"
|
noteDeleteConfirm: "要删除该帖子吗?"
|
||||||
|
@ -683,11 +683,11 @@ emptyToDisableSmtpAuth: "用户名和密码留空可以禁用 SMTP 验证"
|
||||||
smtpSecure: "在 SMTP 连接中使用隐式 SSL / TLS"
|
smtpSecure: "在 SMTP 连接中使用隐式 SSL / TLS"
|
||||||
smtpSecureInfo: "使用 STARTTLS 时关闭。"
|
smtpSecureInfo: "使用 STARTTLS 时关闭。"
|
||||||
testEmail: "邮件发送测试"
|
testEmail: "邮件发送测试"
|
||||||
wordMute: "文字屏蔽"
|
wordMute: "隐藏文字"
|
||||||
hardWordMute: "屏蔽关键词"
|
hardWordMute: "屏蔽关键词"
|
||||||
regexpError: "正则表达式错误"
|
regexpError: "正则表达式错误"
|
||||||
regexpErrorDescription: "{tab} 屏蔽文字的第 {line} 行的正则表达式有错误:"
|
regexpErrorDescription: "{tab} 屏蔽文字的第 {line} 行的正则表达式有错误:"
|
||||||
instanceMute: "被屏蔽的服务器"
|
instanceMute: "已隐藏的服务器"
|
||||||
userSaysSomething: "{name} 说了什么,但是被屏蔽词过滤了"
|
userSaysSomething: "{name} 说了什么,但是被屏蔽词过滤了"
|
||||||
makeActive: "启用"
|
makeActive: "启用"
|
||||||
display: "显示"
|
display: "显示"
|
||||||
|
@ -915,8 +915,8 @@ manageAccounts: "管理账户"
|
||||||
makeReactionsPublic: "将回应设置为公开"
|
makeReactionsPublic: "将回应设置为公开"
|
||||||
makeReactionsPublicDescription: "将您发表过的回应设置成公开可见。"
|
makeReactionsPublicDescription: "将您发表过的回应设置成公开可见。"
|
||||||
classic: "经典"
|
classic: "经典"
|
||||||
muteThread: "屏蔽帖子列表"
|
muteThread: "隐藏帖子列表"
|
||||||
unmuteThread: "取消屏蔽帖子列表"
|
unmuteThread: "取消隐藏帖子列表"
|
||||||
followingVisibility: "关注的人的公开范围"
|
followingVisibility: "关注的人的公开范围"
|
||||||
followersVisibility: "关注者的公开范围"
|
followersVisibility: "关注者的公开范围"
|
||||||
continueThread: "查看更多帖子"
|
continueThread: "查看更多帖子"
|
||||||
|
@ -939,7 +939,7 @@ searchByGoogle: "Google"
|
||||||
instanceDefaultLightTheme: "服务器默认浅色主题"
|
instanceDefaultLightTheme: "服务器默认浅色主题"
|
||||||
instanceDefaultDarkTheme: "服务器默认深色主题"
|
instanceDefaultDarkTheme: "服务器默认深色主题"
|
||||||
instanceDefaultThemeDescription: "以对象格式输入主题代码"
|
instanceDefaultThemeDescription: "以对象格式输入主题代码"
|
||||||
mutePeriod: "屏蔽期限"
|
mutePeriod: "隐藏期限"
|
||||||
period: "截止时间"
|
period: "截止时间"
|
||||||
indefinitely: "永久"
|
indefinitely: "永久"
|
||||||
tenMinutes: "10 分钟"
|
tenMinutes: "10 分钟"
|
||||||
|
@ -1779,7 +1779,7 @@ _role:
|
||||||
canUpdateBioMedia: "可以更新头像和横幅"
|
canUpdateBioMedia: "可以更新头像和横幅"
|
||||||
pinMax: "帖子置顶数量限制"
|
pinMax: "帖子置顶数量限制"
|
||||||
antennaMax: "可创建的最大天线数量"
|
antennaMax: "可创建的最大天线数量"
|
||||||
wordMuteMax: "屏蔽词的字数限制"
|
wordMuteMax: "隐藏词的字数限制"
|
||||||
webhookMax: "Webhook 创建数量限制"
|
webhookMax: "Webhook 创建数量限制"
|
||||||
clipMax: "便签创建数量限制"
|
clipMax: "便签创建数量限制"
|
||||||
noteEachClipsMax: "单个便签内的贴文数量限制"
|
noteEachClipsMax: "单个便签内的贴文数量限制"
|
||||||
|
@ -1792,7 +1792,7 @@ _role:
|
||||||
canUseTranslator: "使用翻译功能"
|
canUseTranslator: "使用翻译功能"
|
||||||
avatarDecorationLimit: "可添加头像挂件的最大个数"
|
avatarDecorationLimit: "可添加头像挂件的最大个数"
|
||||||
canImportAntennas: "允许导入天线"
|
canImportAntennas: "允许导入天线"
|
||||||
canImportBlocking: "允许导入拉黑列表"
|
canImportBlocking: "允许导入屏蔽列表"
|
||||||
canImportFollowing: "允许导入关注列表"
|
canImportFollowing: "允许导入关注列表"
|
||||||
canImportMuting: "允许导入屏蔽列表"
|
canImportMuting: "允许导入屏蔽列表"
|
||||||
canImportUserLists: "允许导入用户列表"
|
canImportUserLists: "允许导入用户列表"
|
||||||
|
@ -1942,14 +1942,14 @@ _menuDisplay:
|
||||||
top: "顶部"
|
top: "顶部"
|
||||||
hide: "隐藏"
|
hide: "隐藏"
|
||||||
_wordMute:
|
_wordMute:
|
||||||
muteWords: "禁用词"
|
muteWords: "要隐藏的词"
|
||||||
muteWordsDescription: "AND 条件用空格分隔,OR 条件用换行符分隔。"
|
muteWordsDescription: "AND 条件用空格分隔,OR 条件用换行符分隔。"
|
||||||
muteWordsDescription2: "正则表达式用斜线包裹"
|
muteWordsDescription2: "正则表达式用斜线包裹"
|
||||||
_instanceMute:
|
_instanceMute:
|
||||||
instanceMuteDescription: "屏蔽服务器中的所有帖子和转帖,包括这些服务器上的用户回复。"
|
instanceMuteDescription: "隐藏服务器中的所有帖子和转帖,包括这些服务器上的用户回复。"
|
||||||
instanceMuteDescription2: "一行一个"
|
instanceMuteDescription2: "一行一个"
|
||||||
title: "隐藏服务器已设置的帖子。"
|
title: "隐藏服务器已设置的帖子。"
|
||||||
heading: "屏蔽服务器"
|
heading: "已隐藏的服务器"
|
||||||
_theme:
|
_theme:
|
||||||
explore: "寻找主题"
|
explore: "寻找主题"
|
||||||
install: "安装主题"
|
install: "安装主题"
|
||||||
|
@ -2089,8 +2089,8 @@ _2fa:
|
||||||
_permissions:
|
_permissions:
|
||||||
"read:account": "查看账户信息"
|
"read:account": "查看账户信息"
|
||||||
"write:account": "更改帐户信息"
|
"write:account": "更改帐户信息"
|
||||||
"read:blocks": "查看黑名单"
|
"read:blocks": "查看屏蔽列表"
|
||||||
"write:blocks": "编辑黑名单"
|
"write:blocks": "编辑屏蔽列表"
|
||||||
"read:drive": "查看网盘"
|
"read:drive": "查看网盘"
|
||||||
"write:drive": "管理网盘文件"
|
"write:drive": "管理网盘文件"
|
||||||
"read:favorites": "查看收藏夹"
|
"read:favorites": "查看收藏夹"
|
||||||
|
@ -2099,8 +2099,8 @@ _permissions:
|
||||||
"write:following": "关注/取消关注"
|
"write:following": "关注/取消关注"
|
||||||
"read:messaging": "查看消息"
|
"read:messaging": "查看消息"
|
||||||
"write:messaging": "撰写或删除消息"
|
"write:messaging": "撰写或删除消息"
|
||||||
"read:mutes": "查看屏蔽列表"
|
"read:mutes": "查看隐藏列表"
|
||||||
"write:mutes": "编辑屏蔽列表"
|
"write:mutes": "编辑隐藏列表"
|
||||||
"write:notes": "撰写或删除帖子"
|
"write:notes": "撰写或删除帖子"
|
||||||
"read:notifications": "查看通知"
|
"read:notifications": "查看通知"
|
||||||
"write:notifications": "管理通知"
|
"write:notifications": "管理通知"
|
||||||
|
@ -2300,8 +2300,8 @@ _exportOrImport:
|
||||||
favoritedNotes: "收藏的帖子"
|
favoritedNotes: "收藏的帖子"
|
||||||
clips: "便签"
|
clips: "便签"
|
||||||
followingList: "关注中"
|
followingList: "关注中"
|
||||||
muteList: "屏蔽"
|
muteList: "隐藏"
|
||||||
blockingList: "拉黑"
|
blockingList: "屏蔽"
|
||||||
userLists: "列表"
|
userLists: "列表"
|
||||||
excludeMutingUsers: "排除屏蔽用户"
|
excludeMutingUsers: "排除屏蔽用户"
|
||||||
excludeInactiveUsers: "排除不活跃用户"
|
excludeInactiveUsers: "排除不活跃用户"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "2024.11.0-beta.4",
|
"version": "2024.11.0",
|
||||||
"codename": "nasubi",
|
"codename": "nasubi",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class DefaultFollowUsers1728986848483 {
|
||||||
|
name = 'defaultFollowUsers1728986848483'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "defaultFollowedUsers" character varying(1024) array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "forciblyFollowedUsers" character varying(1024) array NOT NULL DEFAULT '{}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "forciblyFollowedUsers"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "defaultFollowedUsers"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import UsersChart from '@/core/chart/charts/users.js';
|
import UsersChart from '@/core/chart/charts/users.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { UserService } from '@/core/UserService.js';
|
import { UserService } from '@/core/UserService.js';
|
||||||
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SignupService {
|
export class SignupService {
|
||||||
|
@ -39,6 +40,7 @@ export class SignupService {
|
||||||
|
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
|
private userFollowingService: UserFollowingService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
private instanceActorService: InstanceActorService,
|
private instanceActorService: InstanceActorService,
|
||||||
|
@ -151,6 +153,23 @@ export class SignupService {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.usersChart.update(account, true);
|
this.usersChart.update(account, true);
|
||||||
|
|
||||||
|
//#region Default following
|
||||||
|
if (
|
||||||
|
!isTheFirstUser &&
|
||||||
|
(this.meta.defaultFollowedUsers.length > 0 || this.meta.forciblyFollowedUsers.length > 0)
|
||||||
|
) {
|
||||||
|
const userIdsToFollow = [
|
||||||
|
...this.meta.defaultFollowedUsers,
|
||||||
|
...this.meta.forciblyFollowedUsers,
|
||||||
|
];
|
||||||
|
|
||||||
|
await Promise.allSettled(userIdsToFollow.map(async userId => {
|
||||||
|
await this.userFollowingService.follow(account, { id: userId });
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
this.userService.notifySystemWebhook(account, 'userCreated');
|
this.userService.notifySystemWebhook(account, 'userCreated');
|
||||||
|
|
||||||
return { account, secret };
|
return { account, secret };
|
||||||
|
|
|
@ -8,6 +8,8 @@ import { ModuleRef } from '@nestjs/core';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
import type { MiBlocking } from '@/models/Blocking.js';
|
import type { MiBlocking } from '@/models/Blocking.js';
|
||||||
|
import type { MiMeta } from '@/models/Meta.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import { QueueService } from '@/core/QueueService.js';
|
import { QueueService } from '@/core/QueueService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
@ -20,6 +22,7 @@ import { UserWebhookService } from '@/core/UserWebhookService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserBlockingService implements OnModuleInit {
|
export class UserBlockingService implements OnModuleInit {
|
||||||
|
@ -29,6 +32,9 @@ export class UserBlockingService implements OnModuleInit {
|
||||||
constructor(
|
constructor(
|
||||||
private moduleRef: ModuleRef,
|
private moduleRef: ModuleRef,
|
||||||
|
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
@Inject(DI.followRequestsRepository)
|
@Inject(DI.followRequestsRepository)
|
||||||
private followRequestsRepository: FollowRequestsRepository,
|
private followRequestsRepository: FollowRequestsRepository,
|
||||||
|
|
||||||
|
@ -41,6 +47,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||||
@Inject(DI.userListMembershipsRepository)
|
@Inject(DI.userListMembershipsRepository)
|
||||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||||
|
|
||||||
|
private roleService: RoleService,
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
|
@ -59,6 +66,15 @@ export class UserBlockingService implements OnModuleInit {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async block(blocker: MiUser, blockee: MiUser, silent = false) {
|
public async block(blocker: MiUser, blockee: MiUser, silent = false) {
|
||||||
|
// フォロー解除できない(=ブロックもできない)ユーザーの場合
|
||||||
|
if (
|
||||||
|
blocker.host == null &&
|
||||||
|
this.serverSettings.forciblyFollowedUsers.includes(blockee.id) &&
|
||||||
|
!await this.roleService.isModerator(blocker)
|
||||||
|
) {
|
||||||
|
throw new IdentifiableError('e2f04d25-0d94-4ac3-a4d8-ba401062741b', 'You cannot block that user due to server policy.');
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.cancelRequest(blocker, blockee, silent),
|
this.cancelRequest(blocker, blockee, silent),
|
||||||
this.cancelRequest(blockee, blocker, silent),
|
this.cancelRequest(blockee, blocker, silent),
|
||||||
|
|
|
@ -27,6 +27,7 @@ import { CacheService } from '@/core/CacheService.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { AccountMoveService } from '@/core/AccountMoveService.js';
|
import { AccountMoveService } from '@/core/AccountMoveService.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import type { ThinUser } from '@/queue/types.js';
|
import type { ThinUser } from '@/queue/types.js';
|
||||||
import Logger from '../logger.js';
|
import Logger from '../logger.js';
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@Inject(DI.instancesRepository)
|
@Inject(DI.instancesRepository)
|
||||||
private instancesRepository: InstancesRepository,
|
private instancesRepository: InstancesRepository,
|
||||||
|
|
||||||
|
private roleService: RoleService,
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
|
@ -365,13 +367,22 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async unfollow(
|
public async unfollow(
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; isRoot: MiUser['isRoot']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
silent = false,
|
silent = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
// フォロー解除できないユーザーの場合
|
||||||
|
if (
|
||||||
|
follower.host == null &&
|
||||||
|
this.meta.forciblyFollowedUsers.includes(followee.id) &&
|
||||||
|
!await this.roleService.isModerator(follower)
|
||||||
|
) {
|
||||||
|
throw new IdentifiableError('19f25f61-0141-4683-99dc-217a88d633cb', 'You cannot unfollow that user due to server policy.');
|
||||||
|
}
|
||||||
|
|
||||||
const following = await this.followingsRepository.findOne({
|
const following = await this.followingsRepository.findOne({
|
||||||
relations: {
|
relations: {
|
||||||
follower: true,
|
follower: true,
|
||||||
|
|
|
@ -5,19 +5,26 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import type { MutingsRepository, MiMuting } from '@/models/_.js';
|
import type { MutingsRepository, MiMuting } from '@/models/_.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
|
import type { MiMeta } from '@/models/Meta.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserMutingService {
|
export class UserMutingService {
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
@Inject(DI.mutingsRepository)
|
@Inject(DI.mutingsRepository)
|
||||||
private mutingsRepository: MutingsRepository,
|
private mutingsRepository: MutingsRepository,
|
||||||
|
|
||||||
|
private roleService: RoleService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
) {
|
) {
|
||||||
|
@ -25,6 +32,15 @@ export class UserMutingService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async mute(user: MiUser, target: MiUser, expiresAt: Date | null = null): Promise<void> {
|
public async mute(user: MiUser, target: MiUser, expiresAt: Date | null = null): Promise<void> {
|
||||||
|
// フォロー解除できない(=ミュートもできない)ユーザーの場合
|
||||||
|
if (
|
||||||
|
user.host == null &&
|
||||||
|
this.serverSettings.forciblyFollowedUsers.includes(target.id) &&
|
||||||
|
!await this.roleService.isModerator(user)
|
||||||
|
) {
|
||||||
|
throw new IdentifiableError('15273a89-374d-49fa-8df6-8bb3feeea455', 'You cannot mute that user due to server policy.');
|
||||||
|
}
|
||||||
|
|
||||||
await this.mutingsRepository.insert({
|
await this.mutingsRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
expiresAt: expiresAt ?? null,
|
expiresAt: expiresAt ?? null,
|
||||||
|
|
|
@ -10,16 +10,23 @@ import type { MiRenoteMuting } from '@/models/RenoteMuting.js';
|
||||||
|
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
|
import type { MiMeta } from '@/models/Meta.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserRenoteMutingService {
|
export class UserRenoteMutingService {
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
@Inject(DI.renoteMutingsRepository)
|
@Inject(DI.renoteMutingsRepository)
|
||||||
private renoteMutingsRepository: RenoteMutingsRepository,
|
private renoteMutingsRepository: RenoteMutingsRepository,
|
||||||
|
|
||||||
|
private roleService: RoleService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
) {
|
) {
|
||||||
|
@ -27,6 +34,15 @@ export class UserRenoteMutingService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async mute(user: MiUser, target: MiUser, expiresAt: Date | null = null): Promise<void> {
|
public async mute(user: MiUser, target: MiUser, expiresAt: Date | null = null): Promise<void> {
|
||||||
|
// フォロー解除できない(=リノートミュートもできない)ユーザーの場合
|
||||||
|
if (
|
||||||
|
user.host == null &&
|
||||||
|
this.serverSettings.forciblyFollowedUsers.includes(target.id) &&
|
||||||
|
!await this.roleService.isModerator(user)
|
||||||
|
) {
|
||||||
|
throw new IdentifiableError('15273a89-374d-49fa-8df6-8bb3feeea455', 'You cannot mute that user due to server policy.');
|
||||||
|
}
|
||||||
|
|
||||||
await this.renoteMutingsRepository.insert({
|
await this.renoteMutingsRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
muterId: user.id,
|
muterId: user.id,
|
||||||
|
|
|
@ -61,6 +61,22 @@ export class MiMeta {
|
||||||
})
|
})
|
||||||
public pinnedUsers: string[];
|
public pinnedUsers: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* アカウント作成の段階でデフォルトでフォローしているユーザー(あとから解除可能)
|
||||||
|
*/
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 1024, array: true, default: '{}',
|
||||||
|
})
|
||||||
|
public defaultFollowedUsers: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* デフォルトでフォローしていて、フォロー解除・ブロック・ミュートができないユーザー
|
||||||
|
*/
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 1024, array: true, default: '{}',
|
||||||
|
})
|
||||||
|
public forciblyFollowedUsers: string[];
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 1024, array: true, default: '{}',
|
length: 1024, array: true, default: '{}',
|
||||||
})
|
})
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
import type { DbUserImportJobData } from '../types.js';
|
import type { DbUserImportJobData } from '../types.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ImportMutingProcessorService {
|
export class ImportMutingProcessorService {
|
||||||
|
@ -90,7 +91,13 @@ export class ImportMutingProcessorService {
|
||||||
|
|
||||||
this.logger.info(`Mute[${linenum}] ${target.id} ...`);
|
this.logger.info(`Mute[${linenum}] ${target.id} ...`);
|
||||||
|
|
||||||
await this.userMutingService.mute(user, target);
|
await this.userMutingService.mute(user, target).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === '15273a89-374d-49fa-8df6-8bb3feeea455') {
|
||||||
|
// フォロー解除できない(=ミュートもできない)ユーザー。動作は正常のため、エラーを無視する
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.warn(`Error in line:${linenum} ${e}`);
|
this.logger.warn(`Error in line:${linenum} ${e}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||||
import { RelationshipJobData } from '../types.js';
|
import { RelationshipJobData } from '../types.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RelationshipProcessorService {
|
export class RelationshipProcessorService {
|
||||||
|
@ -50,7 +51,13 @@ export class RelationshipProcessorService {
|
||||||
this.usersRepository.findOneByOrFail({ id: job.data.from.id }),
|
this.usersRepository.findOneByOrFail({ id: job.data.from.id }),
|
||||||
this.usersRepository.findOneByOrFail({ id: job.data.to.id }),
|
this.usersRepository.findOneByOrFail({ id: job.data.to.id }),
|
||||||
]) as [MiLocalUser | MiRemoteUser, MiLocalUser | MiRemoteUser];
|
]) as [MiLocalUser | MiRemoteUser, MiLocalUser | MiRemoteUser];
|
||||||
await this.userFollowingService.unfollow(follower, followee, job.data.silent);
|
await this.userFollowingService.unfollow(follower, followee, job.data.silent).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === '19f25f61-0141-4683-99dc-217a88d633cb') {
|
||||||
|
// フォロー解除できないユーザー。動作は正常のため、エラーを無視する
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +68,13 @@ export class RelationshipProcessorService {
|
||||||
this.usersRepository.findOneByOrFail({ id: job.data.from.id }),
|
this.usersRepository.findOneByOrFail({ id: job.data.from.id }),
|
||||||
this.usersRepository.findOneByOrFail({ id: job.data.to.id }),
|
this.usersRepository.findOneByOrFail({ id: job.data.to.id }),
|
||||||
]);
|
]);
|
||||||
await this.userBlockingService.block(blockee, blocker, job.data.silent);
|
await this.userBlockingService.block(blockee, blocker, job.data.silent).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === 'e2f04d25-0d94-4ac3-a4d8-ba401062741b') {
|
||||||
|
// フォロー解除できない(=ブロックもできない)ユーザー。動作は正常のため、エラーを無視する
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,20 @@ export const meta = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultFollowedUsers: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
forciblyFollowedUsers: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
@ -591,6 +605,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
cacheRemoteFiles: instance.cacheRemoteFiles,
|
cacheRemoteFiles: instance.cacheRemoteFiles,
|
||||||
cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles,
|
cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles,
|
||||||
pinnedUsers: instance.pinnedUsers,
|
pinnedUsers: instance.pinnedUsers,
|
||||||
|
defaultFollowedUsers: instance.defaultFollowedUsers,
|
||||||
|
forciblyFollowedUsers: instance.forciblyFollowedUsers,
|
||||||
hiddenTags: instance.hiddenTags,
|
hiddenTags: instance.hiddenTags,
|
||||||
blockedHosts: instance.blockedHosts,
|
blockedHosts: instance.blockedHosts,
|
||||||
silencedHosts: instance.silencedHosts,
|
silencedHosts: instance.silencedHosts,
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable, Inject } from '@nestjs/common';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { MiMeta } from '@/models/Meta.js';
|
import type { MiMeta } from '@/models/Meta.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -15,6 +17,14 @@ export const meta = {
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireAdmin: true,
|
requireAdmin: true,
|
||||||
kind: 'write:admin:meta',
|
kind: 'write:admin:meta',
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
followedUserDuplicated: {
|
||||||
|
message: 'Some items in "defaultFollowedUsers" and "forciblyFollowedUsers" are duplicated.',
|
||||||
|
code: 'FOLLOWED_USER_DUPLICATED',
|
||||||
|
id: 'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d',
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -26,6 +36,18 @@ export const paramDef = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultFollowedUsers: {
|
||||||
|
type: 'array', nullable: true, items: {
|
||||||
|
type: 'string',
|
||||||
|
format: 'misskey:id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
forciblyFollowedUsers: {
|
||||||
|
type: 'array', nullable: true, items: {
|
||||||
|
type: 'string',
|
||||||
|
format: 'misskey:id',
|
||||||
|
},
|
||||||
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: 'array', nullable: true, items: {
|
type: 'array', nullable: true, items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -192,6 +214,9 @@ export const paramDef = {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
private metaService: MetaService,
|
private metaService: MetaService,
|
||||||
private moderationLogService: ModerationLogService,
|
private moderationLogService: ModerationLogService,
|
||||||
) {
|
) {
|
||||||
|
@ -206,6 +231,22 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(ps.defaultFollowedUsers)) {
|
||||||
|
if (ps.defaultFollowedUsers.some(x => this.serverSettings.forciblyFollowedUsers.includes(x) || ps.forciblyFollowedUsers?.includes(x))) {
|
||||||
|
throw new ApiError(meta.errors.followedUserDuplicated);
|
||||||
|
}
|
||||||
|
|
||||||
|
set.defaultFollowedUsers = ps.defaultFollowedUsers.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(ps.forciblyFollowedUsers)) {
|
||||||
|
if (ps.forciblyFollowedUsers.some(x => this.serverSettings.defaultFollowedUsers.includes(x) || ps.defaultFollowedUsers?.includes(x))) {
|
||||||
|
throw new ApiError(meta.errors.followedUserDuplicated);
|
||||||
|
}
|
||||||
|
|
||||||
|
set.forciblyFollowedUsers = ps.forciblyFollowedUsers.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(ps.hiddenTags)) {
|
if (Array.isArray(ps.hiddenTags)) {
|
||||||
set.hiddenTags = ps.hiddenTags.filter(Boolean);
|
set.hiddenTags = ps.hiddenTags.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { GetterService } from '@/server/api/GetterService.js';
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['account'],
|
tags: ['account'],
|
||||||
|
@ -43,6 +44,13 @@ export const meta = {
|
||||||
code: 'ALREADY_BLOCKING',
|
code: 'ALREADY_BLOCKING',
|
||||||
id: '787fed64-acb9-464a-82eb-afbd745b9614',
|
id: '787fed64-acb9-464a-82eb-afbd745b9614',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cannotBlockDueToServerPolicy: {
|
||||||
|
message: 'You cannot block that user due to server policy.',
|
||||||
|
code: 'CANNOT_BLOCK_DUE_TO_SERVER_POLICY',
|
||||||
|
id: 'e2f04d25-0d94-4ac3-a4d8-ba401062741b',
|
||||||
|
httpStatusCode: 403,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -83,7 +91,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
// Get blockee
|
// Get blockee
|
||||||
const blockee = await this.getterService.getUser(ps.userId).catch(err => {
|
const blockee = await this.getterService.getUser(ps.userId).catch(err => {
|
||||||
if (err.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
if (err instanceof IdentifiableError && err.id === '15348ddd-432d-49c2-8a5a-8069753becff') {
|
||||||
|
throw new ApiError(meta.errors.noSuchUser);
|
||||||
|
}
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,7 +109,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.alreadyBlocking);
|
throw new ApiError(meta.errors.alreadyBlocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.userBlockingService.block(blocker, blockee);
|
await this.userBlockingService.block(blocker, blockee).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === meta.errors.cannotBlockDueToServerPolicy.id) {
|
||||||
|
throw new ApiError(meta.errors.cannotBlockDueToServerPolicy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return await this.userEntityService.pack(blockee.id, blocker, {
|
return await this.userEntityService.pack(blockee.id, blocker, {
|
||||||
schema: 'UserDetailedNotMe',
|
schema: 'UserDetailedNotMe',
|
||||||
|
|
|
@ -7,6 +7,7 @@ import ms from 'ms';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { FollowingsRepository } from '@/models/_.js';
|
import type { FollowingsRepository } from '@/models/_.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
@ -43,6 +44,13 @@ export const meta = {
|
||||||
code: 'NOT_FOLLOWING',
|
code: 'NOT_FOLLOWING',
|
||||||
id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09',
|
id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cannotUnfollowDueToServerPolicy: {
|
||||||
|
message: 'You cannot unfollow that user due to server policy.',
|
||||||
|
code: 'CANNOT_UNFOLLOW_DUE_TO_SERVER_POLICY',
|
||||||
|
id: '19f25f61-0141-4683-99dc-217a88d633cb',
|
||||||
|
httpStatusCode: 403,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -96,7 +104,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.notFollowing);
|
throw new ApiError(meta.errors.notFollowing);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.userFollowingService.unfollow(follower, followee);
|
await this.userFollowingService.unfollow(follower, followee).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === meta.errors.cannotUnfollowDueToServerPolicy.id) {
|
||||||
|
throw new ApiError(meta.errors.cannotUnfollowDueToServerPolicy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return await this.userEntityService.pack(followee.id, me);
|
return await this.userEntityService.pack(followee.id, me);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { DI } from '@/di-symbols.js';
|
||||||
import { GetterService } from '@/server/api/GetterService.js';
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
import { UserMutingService } from '@/core/UserMutingService.js';
|
import { UserMutingService } from '@/core/UserMutingService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['account'],
|
tags: ['account'],
|
||||||
|
@ -43,6 +44,13 @@ export const meta = {
|
||||||
code: 'ALREADY_MUTING',
|
code: 'ALREADY_MUTING',
|
||||||
id: '7e7359cb-160c-4956-b08f-4d1c653cd007',
|
id: '7e7359cb-160c-4956-b08f-4d1c653cd007',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cannotMuteDueToServerPolicy: {
|
||||||
|
message: 'You cannot mute that user due to server policy.',
|
||||||
|
code: 'CANNOT_MUTE_DUE_TO_SERVER_POLICY',
|
||||||
|
id: '15273a89-374d-49fa-8df6-8bb3feeea455',
|
||||||
|
httpStatusCode: 403,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -98,7 +106,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.userMutingService.mute(muter, mutee, ps.expiresAt ? new Date(ps.expiresAt) : null);
|
await this.userMutingService.mute(muter, mutee, ps.expiresAt ? new Date(ps.expiresAt) : null).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === meta.errors.cannotMuteDueToServerPolicy.id) {
|
||||||
|
throw new ApiError(meta.errors.cannotMuteDueToServerPolicy);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { GetterService } from '@/server/api/GetterService.js';
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
import { UserRenoteMutingService } from "@/core/UserRenoteMutingService.js";
|
import { UserRenoteMutingService } from '@/core/UserRenoteMutingService.js';
|
||||||
import type { RenoteMutingsRepository } from '@/models/_.js';
|
import type { RenoteMutingsRepository } from '@/models/_.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['account'],
|
tags: ['account'],
|
||||||
|
@ -43,6 +44,13 @@ export const meta = {
|
||||||
code: 'ALREADY_MUTING',
|
code: 'ALREADY_MUTING',
|
||||||
id: 'ccfecbe4-1f1c-4fc2-8a3d-c3ffee61cb7b',
|
id: 'ccfecbe4-1f1c-4fc2-8a3d-c3ffee61cb7b',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cannotMuteDueToServerPolicy: {
|
||||||
|
message: 'You cannot mute that user due to server policy.',
|
||||||
|
code: 'CANNOT_MUTE_DUE_TO_SERVER_POLICY',
|
||||||
|
id: '15273a89-374d-49fa-8df6-8bb3feeea455',
|
||||||
|
httpStatusCode: 403,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -90,7 +98,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create mute
|
// Create mute
|
||||||
await this.userRenoteMutingService.mute(muter, mutee);
|
await this.userRenoteMutingService.mute(muter, mutee).catch((err) => {
|
||||||
|
if (err instanceof IdentifiableError && err.id === meta.errors.cannotMuteDueToServerPolicy.id) {
|
||||||
|
throw new ApiError(meta.errors.cannotMuteDueToServerPolicy);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,14 @@ async function onClick() {
|
||||||
|
|
||||||
await misskeyApi('following/delete', {
|
await misskeyApi('following/delete', {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
|
}).catch((err) => {
|
||||||
|
if (err.id === '19f25f61-0141-4683-99dc-217a88d633cb') {
|
||||||
|
os.alert({
|
||||||
|
type: 'error',
|
||||||
|
title: i18n.ts.permissionDeniedError,
|
||||||
|
text: i18n.ts.unfollowThisUserIsProhibited,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (defaultStore.state.alwaysConfirmFollow) {
|
if (defaultStore.state.alwaysConfirmFollow) {
|
||||||
|
|
|
@ -36,6 +36,23 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder>
|
||||||
|
<template #icon><i class="ti ti-user-star"></i></template>
|
||||||
|
<template #label>{{ i18n.ts.defaultFollowedUsers }}</template>
|
||||||
|
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkTextarea v-model="defaultFollowedUsers">
|
||||||
|
<template #label>{{ i18n.ts.defaultFollowedUsers }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.defaultFollowedUsersDescription }}</template>
|
||||||
|
</MkTextarea>
|
||||||
|
<MkTextarea v-model="forciblyFollowedUsers">
|
||||||
|
<template #label>{{ i18n.ts.forciblyFollowedUsers }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.forciblyFollowedUsersDescription }}</template>
|
||||||
|
</MkTextarea>
|
||||||
|
<MkButton primary @click="save_defaultUsers">{{ i18n.ts.save }}</MkButton>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
<template #icon><i class="ti ti-message-exclamation"></i></template>
|
<template #icon><i class="ti ti-message-exclamation"></i></template>
|
||||||
<template #label>{{ i18n.ts.sensitiveWords }}</template>
|
<template #label>{{ i18n.ts.sensitiveWords }}</template>
|
||||||
|
@ -149,6 +166,8 @@ const prohibitedWords = ref<string>('');
|
||||||
const prohibitedWordsForNameOfUser = ref<string>('');
|
const prohibitedWordsForNameOfUser = ref<string>('');
|
||||||
const hiddenTags = ref<string>('');
|
const hiddenTags = ref<string>('');
|
||||||
const preservedUsernames = ref<string>('');
|
const preservedUsernames = ref<string>('');
|
||||||
|
const defaultFollowedUsers = ref<string>('');
|
||||||
|
const forciblyFollowedUsers = ref<string>('');
|
||||||
const blockedHosts = ref<string>('');
|
const blockedHosts = ref<string>('');
|
||||||
const silencedHosts = ref<string>('');
|
const silencedHosts = ref<string>('');
|
||||||
const mediaSilencedHosts = ref<string>('');
|
const mediaSilencedHosts = ref<string>('');
|
||||||
|
@ -162,6 +181,8 @@ async function init() {
|
||||||
prohibitedWordsForNameOfUser.value = meta.prohibitedWordsForNameOfUser.join('\n');
|
prohibitedWordsForNameOfUser.value = meta.prohibitedWordsForNameOfUser.join('\n');
|
||||||
hiddenTags.value = meta.hiddenTags.join('\n');
|
hiddenTags.value = meta.hiddenTags.join('\n');
|
||||||
preservedUsernames.value = meta.preservedUsernames.join('\n');
|
preservedUsernames.value = meta.preservedUsernames.join('\n');
|
||||||
|
defaultFollowedUsers.value = meta.defaultFollowedUsers.join('\n');
|
||||||
|
forciblyFollowedUsers.value = meta.forciblyFollowedUsers.join('\n');
|
||||||
blockedHosts.value = meta.blockedHosts.join('\n');
|
blockedHosts.value = meta.blockedHosts.join('\n');
|
||||||
silencedHosts.value = meta.silencedHosts?.join('\n') ?? '';
|
silencedHosts.value = meta.silencedHosts?.join('\n') ?? '';
|
||||||
mediaSilencedHosts.value = meta.mediaSilencedHosts.join('\n');
|
mediaSilencedHosts.value = meta.mediaSilencedHosts.join('\n');
|
||||||
|
@ -201,6 +222,19 @@ function save_preservedUsernames() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_defaultUsers() {
|
||||||
|
os.apiWithDialog('admin/update-meta', {
|
||||||
|
defaultFollowedUsers: defaultFollowedUsers.value.split('\n'),
|
||||||
|
forciblyFollowedUsers: forciblyFollowedUsers.value.split('\n'),
|
||||||
|
}, undefined, {
|
||||||
|
'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d': {
|
||||||
|
text: i18n.ts.defaultFollowedUsersDuplicated,
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function save_sensitiveWords() {
|
function save_sensitiveWords() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
sensitiveWords: sensitiveWords.value.split('\n'),
|
sensitiveWords: sensitiveWords.value.split('\n'),
|
||||||
|
|
|
@ -60,6 +60,11 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
|
||||||
os.apiWithDialog('mute/create', {
|
os.apiWithDialog('mute/create', {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
expiresAt,
|
expiresAt,
|
||||||
|
}, undefined, {
|
||||||
|
'15273a89-374d-49fa-8df6-8bb3feeea455': {
|
||||||
|
title: i18n.ts.permissionDeniedError,
|
||||||
|
text: i18n.ts.muteThisUserIsProhibited,
|
||||||
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
user.isMuted = true;
|
user.isMuted = true;
|
||||||
});
|
});
|
||||||
|
@ -69,6 +74,11 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
|
||||||
async function toggleRenoteMute() {
|
async function toggleRenoteMute() {
|
||||||
os.apiWithDialog(user.isRenoteMuted ? 'renote-mute/delete' : 'renote-mute/create', {
|
os.apiWithDialog(user.isRenoteMuted ? 'renote-mute/delete' : 'renote-mute/create', {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
}, undefined, {
|
||||||
|
'15273a89-374d-49fa-8df6-8bb3feeea455': {
|
||||||
|
title: i18n.ts.permissionDeniedError,
|
||||||
|
text: i18n.ts.muteThisUserIsProhibited,
|
||||||
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
user.isRenoteMuted = !user.isRenoteMuted;
|
user.isRenoteMuted = !user.isRenoteMuted;
|
||||||
});
|
});
|
||||||
|
@ -79,6 +89,11 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
|
||||||
|
|
||||||
os.apiWithDialog(user.isBlocking ? 'blocking/delete' : 'blocking/create', {
|
os.apiWithDialog(user.isBlocking ? 'blocking/delete' : 'blocking/create', {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
}, undefined, {
|
||||||
|
'e2f04d25-0d94-4ac3-a4d8-ba401062741b': {
|
||||||
|
title: i18n.ts.permissionDeniedError,
|
||||||
|
text: i18n.ts.blockThisUserIsProhibited,
|
||||||
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
user.isBlocking = !user.isBlocking;
|
user.isBlocking = !user.isBlocking;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"name": "misskey-js",
|
"name": "misskey-js",
|
||||||
"version": "2024.11.0-beta.4",
|
"version": "2024.11.0",
|
||||||
"description": "Misskey SDK for JavaScript",
|
"description": "Misskey SDK for JavaScript",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
|
|
|
@ -5132,6 +5132,8 @@ export type operations = {
|
||||||
silencedHosts?: string[];
|
silencedHosts?: string[];
|
||||||
mediaSilencedHosts: string[];
|
mediaSilencedHosts: string[];
|
||||||
pinnedUsers: string[];
|
pinnedUsers: string[];
|
||||||
|
defaultFollowedUsers: string[];
|
||||||
|
forciblyFollowedUsers: string[];
|
||||||
hiddenTags: string[];
|
hiddenTags: string[];
|
||||||
blockedHosts: string[];
|
blockedHosts: string[];
|
||||||
sensitiveWords: string[];
|
sensitiveWords: string[];
|
||||||
|
@ -9484,6 +9486,8 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
disableRegistration?: boolean | null;
|
disableRegistration?: boolean | null;
|
||||||
pinnedUsers?: string[] | null;
|
pinnedUsers?: string[] | null;
|
||||||
|
defaultFollowedUsers?: string[] | null;
|
||||||
|
forciblyFollowedUsers?: string[] | null;
|
||||||
hiddenTags?: string[] | null;
|
hiddenTags?: string[] | null;
|
||||||
blockedHosts?: string[] | null;
|
blockedHosts?: string[] | null;
|
||||||
sensitiveWords?: string[] | null;
|
sensitiveWords?: string[] | null;
|
||||||
|
|
Loading…
Reference in New Issue