Merge tag '2023.10.2' into merge-upstream
This commit is contained in:
		| @@ -190,6 +190,9 @@ const patronsWithIcon = [{ | ||||
| }, { | ||||
| 	name: '百日紅', | ||||
| 	icon: 'https://misskey-hub.net/patrons/302dce2898dd457ba03c3f7dc037900b.jpg', | ||||
| }, { | ||||
| 	name: 'taichan', | ||||
| 	icon: 'https://misskey-hub.net/patrons/f981ab0159fb4e2c998e05f7263e1cd9.png', | ||||
| }]; | ||||
|  | ||||
| const patrons = [ | ||||
|   | ||||
| @@ -18,6 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 				<option value="subscribing">{{ i18n.ts.subscribing }}</option> | ||||
| 				<option value="publishing">{{ i18n.ts.publishing }}</option> | ||||
| 				<option value="suspended">{{ i18n.ts.suspended }}</option> | ||||
| 				<option value="silenced">{{ i18n.ts.silence }}</option> | ||||
| 				<option value="blocked">{{ i18n.ts.blocked }}</option> | ||||
| 				<option value="notResponding">{{ i18n.ts.notResponding }}</option> | ||||
| 			</MkSelect> | ||||
| @@ -75,6 +76,7 @@ const pagination = { | ||||
| 			state === 'publishing' ? { publishing: true } : | ||||
| 			state === 'suspended' ? { suspended: true } : | ||||
| 			state === 'blocked' ? { blocked: true } : | ||||
| 			state === 'silenced' ? { silenced: true } : | ||||
| 			state === 'notResponding' ? { notResponding: true } : | ||||
| 			{}), | ||||
| 	})), | ||||
| @@ -83,6 +85,7 @@ const pagination = { | ||||
| function getStatus(instance) { | ||||
| 	if (instance.isSuspended) return 'Suspended'; | ||||
| 	if (instance.isBlocked) return 'Blocked'; | ||||
| 	if (instance.isSilenced) return 'Silenced'; | ||||
| 	if (instance.isNotResponding) return 'Error'; | ||||
| 	return 'Alive'; | ||||
| } | ||||
|   | ||||
| @@ -5,14 +5,17 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
|  | ||||
| <template> | ||||
| <MkStickyContainer> | ||||
| 	<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template> | ||||
| 	<template #header><XHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template> | ||||
| 	<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32"> | ||||
| 		<FormSuspense :p="init"> | ||||
| 			<MkTextarea v-model="blockedHosts"> | ||||
| 			<MkTextarea v-if="tab === 'block'" v-model="blockedHosts"> | ||||
| 				<span>{{ i18n.ts.blockedInstances }}</span> | ||||
| 				<template #caption>{{ i18n.ts.blockedInstancesDescription }}</template> | ||||
| 			</MkTextarea> | ||||
|  | ||||
| 			<MkTextarea v-else-if="tab === 'silence'" v-model="silencedHosts" class="_formBlock"> | ||||
| 				<span>{{ i18n.ts.silencedInstances }}</span> | ||||
| 				<template #caption>{{ i18n.ts.silencedInstancesDescription }}</template> | ||||
| 			</MkTextarea> | ||||
| 			<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton> | ||||
| 		</FormSuspense> | ||||
| 	</MkSpacer> | ||||
| @@ -20,7 +23,6 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| </template> | ||||
|  | ||||
| <script lang="ts" setup> | ||||
| import { } from 'vue'; | ||||
| import XHeader from './_header_.vue'; | ||||
| import MkButton from '@/components/MkButton.vue'; | ||||
| import MkTextarea from '@/components/MkTextarea.vue'; | ||||
| @@ -31,15 +33,20 @@ import { i18n } from '@/i18n.js'; | ||||
| import { definePageMetadata } from '@/scripts/page-metadata.js'; | ||||
|  | ||||
| let blockedHosts: string = $ref(''); | ||||
| let silencedHosts: string = $ref(''); | ||||
| let tab = $ref('block'); | ||||
|  | ||||
| async function init() { | ||||
| 	const meta = await os.api('admin/meta'); | ||||
| 	blockedHosts = meta.blockedHosts.join('\n'); | ||||
| 	silencedHosts = meta.silencedHosts.join('\n'); | ||||
| } | ||||
|  | ||||
| function save() { | ||||
| 	os.apiWithDialog('admin/update-meta', { | ||||
| 		blockedHosts: blockedHosts.split('\n') || [], | ||||
| 		silencedHosts: silencedHosts.split('\n') || [], | ||||
|  | ||||
| 	}).then(() => { | ||||
| 		fetchInstance(); | ||||
| 	}); | ||||
| @@ -47,7 +54,15 @@ function save() { | ||||
|  | ||||
| const headerActions = $computed(() => []); | ||||
|  | ||||
| const headerTabs = $computed(() => []); | ||||
| const headerTabs = $computed(() => [{ | ||||
| 	key: 'block', | ||||
| 	title: i18n.ts.block, | ||||
| 	icon: 'ti ti-ban', | ||||
| }, { | ||||
| 	key: 'silence', | ||||
| 	title: i18n.ts.silence, | ||||
| 	icon: 'ti ti-eye-off', | ||||
| }]); | ||||
|  | ||||
| definePageMetadata({ | ||||
| 	title: i18n.ts.instanceBlocking, | ||||
|   | ||||
| @@ -14,6 +14,7 @@ import * as Misskey from 'misskey-js'; | ||||
| import * as os from '@/os.js'; | ||||
| import { mainRouter } from '@/router.js'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import { defaultStore } from "@/store.js"; | ||||
|  | ||||
| async function follow(user): Promise<void> { | ||||
| 	const { canceled } = await os.confirm({ | ||||
| @@ -28,7 +29,9 @@ async function follow(user): Promise<void> { | ||||
|  | ||||
| 	os.apiWithDialog('following/create', { | ||||
| 		userId: user.id, | ||||
| 		withReplies: defaultStore.state.defaultWithReplies, | ||||
| 	}); | ||||
| 	user.withReplies = defaultStore.state.defaultWithReplies; | ||||
| } | ||||
|  | ||||
| const acct = new URL(location.href).searchParams.get('acct'); | ||||
|   | ||||
| @@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 								<MkUserName :user="post.user" style="display: block;"/> | ||||
| 								<MkAcct :user="post.user"/> | ||||
| 							</div> | ||||
| 							<MkFollowButton v-if="!$i || $i.id != post.user.id" :user="post.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/> | ||||
| 							<MkFollowButton v-if="!$i || $i.id != post.user.id" v-model:user="post.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<MkAd :prefer="['horizontal', 'horizontal-big']"/> | ||||
|   | ||||
| @@ -36,7 +36,8 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 				<div class="_gaps_s"> | ||||
| 					<MkSwitch v-model="suspended" :disabled="!instance" @update:modelValue="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</MkSwitch> | ||||
| 					<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch> | ||||
| 					<MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton> | ||||
|                     <MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch> | ||||
|                     <MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton> | ||||
| 				</div> | ||||
| 			</FormSection> | ||||
|  | ||||
| @@ -147,6 +148,7 @@ let meta = $ref<Misskey.entities.AdminInstanceMetadata | null>(null); | ||||
| let instance = $ref<Misskey.entities.Instance | null>(null); | ||||
| let suspended = $ref(false); | ||||
| let isBlocked = $ref(false); | ||||
| let isSilenced = $ref(false); | ||||
| let faviconUrl = $ref<string | null>(null); | ||||
|  | ||||
| const usersPagination = { | ||||
| @@ -169,7 +171,8 @@ async function fetch(): Promise<void> { | ||||
| 	}); | ||||
| 	suspended = instance.isSuspended; | ||||
| 	isBlocked = instance.isBlocked; | ||||
| 	faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview'); | ||||
|     isSilenced = instance.isSilenced; | ||||
|     faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview'); | ||||
| } | ||||
|  | ||||
| async function toggleBlock(): Promise<void> { | ||||
| @@ -180,7 +183,14 @@ async function toggleBlock(): Promise<void> { | ||||
| 		blockedHosts: isBlocked ? meta.blockedHosts.concat([host]) : meta.blockedHosts.filter(x => x !== host), | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| async function toggleSilenced(): Promise<void> { | ||||
|     if (!meta) throw new Error('No meta?'); | ||||
|     if (!instance) throw new Error('No instance?'); | ||||
|     const { host } = instance; | ||||
|     await os.api('admin/update-meta', { | ||||
|         silencedHosts: isSilenced ? meta.silencedHosts.concat([host]) : meta.silencedHosts.filter(x => x !== host), | ||||
|     }); | ||||
| } | ||||
| async function toggleSuspend(): Promise<void> { | ||||
| 	if (!instance) throw new Error('No instance?'); | ||||
| 	await os.api('admin/federation/update-instance', { | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import XAntenna from './editor.vue'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import { definePageMetadata } from '@/scripts/page-metadata.js'; | ||||
| import { useRouter } from '@/router.js'; | ||||
| import { antennasCache } from '@/cache'; | ||||
| import { antennasCache } from '@/cache.js'; | ||||
|  | ||||
| const router = useRouter(); | ||||
|  | ||||
| @@ -27,6 +27,7 @@ let draft = $ref({ | ||||
| 	excludeKeywords: [], | ||||
| 	withReplies: false, | ||||
| 	caseSensitive: false, | ||||
| 	localOnly: false, | ||||
| 	withFile: false, | ||||
| 	notify: false, | ||||
| }); | ||||
|   | ||||
| @@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 				<template #label>{{ i18n.ts.antennaExcludeKeywords }}</template> | ||||
| 				<template #caption>{{ i18n.ts.antennaKeywordsDescription }}</template> | ||||
| 			</MkTextarea> | ||||
| 			<MkSwitch v-model="localOnly">{{ i18n.ts.localOnly }}</MkSwitch> | ||||
| 			<MkSwitch v-model="caseSensitive">{{ i18n.ts.caseSensitive }}</MkSwitch> | ||||
| 			<MkSwitch v-model="withFile">{{ i18n.ts.withFileAntenna }}</MkSwitch> | ||||
| 			<MkSwitch v-model="notify">{{ i18n.ts.notifyAntenna }}</MkSwitch> | ||||
| @@ -75,6 +76,7 @@ let users: string = $ref(props.antenna.users.join('\n')); | ||||
| let keywords: string = $ref(props.antenna.keywords.map(x => x.join(' ')).join('\n')); | ||||
| let excludeKeywords: string = $ref(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n')); | ||||
| let caseSensitive: boolean = $ref(props.antenna.caseSensitive); | ||||
| let localOnly: boolean = $ref(props.antenna.localOnly); | ||||
| let withReplies: boolean = $ref(props.antenna.withReplies); | ||||
| let withFile: boolean = $ref(props.antenna.withFile); | ||||
| let notify: boolean = $ref(props.antenna.notify); | ||||
| @@ -95,6 +97,7 @@ async function saveAntenna() { | ||||
| 		withFile, | ||||
| 		notify, | ||||
| 		caseSensitive, | ||||
| 		localOnly, | ||||
| 		users: users.trim().split('\n').map(x => x.trim()), | ||||
| 		keywords: keywords.trim().split('\n').map(x => x.trim().split(' ')), | ||||
| 		excludeKeywords: excludeKeywords.trim().split('\n').map(x => x.trim().split(' ')), | ||||
|   | ||||
| @@ -29,6 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 		<div class="_gaps_s"> | ||||
| 			<MkSwitch v-model="showFixedPostForm">{{ i18n.ts.showFixedPostForm }}</MkSwitch> | ||||
| 			<MkSwitch v-model="showFixedPostFormInChannel">{{ i18n.ts.showFixedPostFormInChannel }}</MkSwitch> | ||||
| 			<MkSwitch v-model="defaultWithReplies">{{ i18n.ts.withRepliesByDefaultForNewlyFollowed }}</MkSwitch> | ||||
| 			<MkFolder> | ||||
| 				<template #label>{{ i18n.ts.pinnedList }}</template> | ||||
| 				<!-- 複数ピン止め管理できるようにしたいけどめんどいので一旦ひとつのみ --> | ||||
| @@ -249,6 +250,7 @@ const mediaListWithOneImageAppearance = computed(defaultStore.makeGetterSetter(' | ||||
| const notificationPosition = computed(defaultStore.makeGetterSetter('notificationPosition')); | ||||
| const notificationStackAxis = computed(defaultStore.makeGetterSetter('notificationStackAxis')); | ||||
| const keepScreenOn = computed(defaultStore.makeGetterSetter('keepScreenOn')); | ||||
| const defaultWithReplies = computed(defaultStore.makeGetterSetter('defaultWithReplies')); | ||||
|  | ||||
| watch(lang, () => { | ||||
| 	miLocalStorage.setItem('lang', lang.value as string); | ||||
|   | ||||
| @@ -40,6 +40,9 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 			<MkFolder v-if="$i && !$i.movedTo"> | ||||
| 				<template #label>{{ i18n.ts.import }}</template> | ||||
| 				<template #icon><i class="ti ti-upload"></i></template> | ||||
| 				<MkSwitch v-model="withReplies"> | ||||
| 					{{ i18n.ts._exportOrImport.withReplies }} | ||||
| 				</MkSwitch> | ||||
| 				<MkButton primary :class="$style.button" inline @click="importFollowing($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton> | ||||
| 			</MkFolder> | ||||
| 		</div> | ||||
| @@ -118,9 +121,11 @@ import { selectFile } from '@/scripts/select-file.js'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import { definePageMetadata } from '@/scripts/page-metadata.js'; | ||||
| import { $i } from '@/account.js'; | ||||
| import { defaultStore } from "@/store.js"; | ||||
|  | ||||
| const excludeMutingUsers = ref(false); | ||||
| const excludeInactiveUsers = ref(false); | ||||
| const withReplies = ref(defaultStore.state.defaultWithReplies); | ||||
|  | ||||
| const onExportSuccess = () => { | ||||
| 	os.alert({ | ||||
| @@ -177,7 +182,10 @@ const exportAntennas = () => { | ||||
|  | ||||
| const importFollowing = async (ev) => { | ||||
| 	const file = await selectFile(ev.currentTarget ?? ev.target); | ||||
| 	os.api('i/import-following', { fileId: file.id }).then(onImportSuccess).catch(onError); | ||||
| 	os.api('i/import-following', { | ||||
| 		fileId: file.id, | ||||
| 		withReplies: withReplies.value, | ||||
| 	}).then(onImportSuccess).catch(onError); | ||||
| }; | ||||
|  | ||||
| const importUserLists = async (ev) => { | ||||
|   | ||||
| @@ -43,7 +43,7 @@ import { instance } from '@/instance.js'; | ||||
| import { $i } from '@/account.js'; | ||||
| import { definePageMetadata } from '@/scripts/page-metadata.js'; | ||||
| import { miLocalStorage } from '@/local-storage.js'; | ||||
| import { antennasCache, userListsCache } from '@/cache'; | ||||
| import { antennasCache, userListsCache } from '@/cache.js'; | ||||
|  | ||||
| provide('shouldOmitHeaderTitle', true); | ||||
|  | ||||
| @@ -62,11 +62,15 @@ let queue = $ref(0); | ||||
| let srcWhenNotSignin = $ref(isLocalTimelineAvailable ? 'local' : 'global'); | ||||
| const src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin), set: (x) => saveSrc(x) }); | ||||
| const withRenotes = $ref(true); | ||||
| const withReplies = $ref(false); | ||||
| const withReplies = $ref($i ? defaultStore.state.tlWithReplies : false); | ||||
| const onlyFiles = $ref(false); | ||||
|  | ||||
| watch($$(src), () => queue = 0); | ||||
|  | ||||
| watch($$(withReplies), (x) => { | ||||
| 	if ($i) defaultStore.set('tlWithReplies', x); | ||||
| }); | ||||
|  | ||||
| function queueUpdated(q: number): void { | ||||
| 	queue = q; | ||||
| } | ||||
|   | ||||
| @@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 						<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ i18n.ts.followsYou }}</span> | ||||
| 						<div v-if="$i" class="actions"> | ||||
| 							<button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button> | ||||
| 							<MkFollowButton v-if="$i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/> | ||||
| 							<MkFollowButton v-if="$i.id != user.id" v-model:user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<MkAvatar class="avatar" :user="user" indicator/> | ||||
| @@ -198,6 +198,7 @@ const props = withDefaults(defineProps<{ | ||||
|  | ||||
| const router = useRouter(); | ||||
|  | ||||
| let user = $ref(props.user); | ||||
| let parallaxAnimationId = $ref<null | number>(null); | ||||
| let narrow = $ref<null | boolean>(null); | ||||
| let rootEl = $ref<null | HTMLElement>(null); | ||||
| @@ -232,7 +233,7 @@ const age = $computed(() => { | ||||
| }); | ||||
|  | ||||
| function menu(ev) { | ||||
| 	const { menu, cleanup } = getUserMenu(props.user, router); | ||||
| 	const { menu, cleanup } = getUserMenu(user, router); | ||||
| 	os.popupMenu(menu, ev.currentTarget ?? ev.target).finally(cleanup); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 riku6460
					riku6460