feat: media silence (#13842)
* feat: media silence * fix: lint * feat: deny creating custom emoji reaction and using custom emoji from media silenced hosts * chore: メディアサイレンスの説明にカスタム絵文字の話を追加 * Update locales/ja-JP.yml Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> * chore: update index.d.ts * docs(changelog): update changelog --------- Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
This commit is contained in:
		| @@ -128,6 +128,16 @@ export const meta = { | ||||
| 					nullable: false, | ||||
| 				}, | ||||
| 			}, | ||||
| 			mediaSilencedHosts: { | ||||
| 				type: 'array', | ||||
| 				optional: false, | ||||
| 				nullable: false, | ||||
| 				items: { | ||||
| 					type: 'string', | ||||
| 					optional: false, | ||||
| 					nullable: false, | ||||
| 				}, | ||||
| 			}, | ||||
| 			pinnedUsers: { | ||||
| 				type: 'array', | ||||
| 				optional: false, nullable: false, | ||||
| @@ -552,6 +562,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- | ||||
| 				hiddenTags: instance.hiddenTags, | ||||
| 				blockedHosts: instance.blockedHosts, | ||||
| 				silencedHosts: instance.silencedHosts, | ||||
| 				mediaSilencedHosts: instance.mediaSilencedHosts, | ||||
| 				sensitiveWords: instance.sensitiveWords, | ||||
| 				prohibitedWords: instance.prohibitedWords, | ||||
| 				preservedUsernames: instance.preservedUsernames, | ||||
|   | ||||
| @@ -150,6 +150,13 @@ export const paramDef = { | ||||
| 				type: 'string', | ||||
| 			}, | ||||
| 		}, | ||||
| 		mediaSilencedHosts: { | ||||
| 			type: 'array', | ||||
| 			nullable: true, | ||||
| 			items: { | ||||
| 				type: 'string', | ||||
| 			}, | ||||
| 		}, | ||||
| 		summalyProxy: { | ||||
| 			type: 'string', nullable: true, | ||||
| 			description: '[Deprecated] Use "urlPreviewSummaryProxyUrl" instead.', | ||||
| @@ -203,6 +210,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- | ||||
| 					return h !== '' && h !== lv && !set.blockedHosts?.includes(h); | ||||
| 				}); | ||||
| 			} | ||||
| 			if (Array.isArray(ps.mediaSilencedHosts)) { | ||||
| 				let lastValue = ''; | ||||
| 				set.mediaSilencedHosts = ps.mediaSilencedHosts.sort().filter((h) => { | ||||
| 					const lv = lastValue; | ||||
| 					lastValue = h; | ||||
| 					return h !== '' && h !== lv && !set.blockedHosts?.includes(h); | ||||
| 				}); | ||||
| 			} | ||||
| 			if (ps.themeColor !== undefined) { | ||||
| 				set.themeColor = ps.themeColor; | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 anatawa12
					anatawa12