From d3c1926519878155193a1654f49141e515d49683 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Mon, 2 Sep 2024 20:41:58 +0900 Subject: [PATCH] wip --- packages/frontend-embed/src/components/EmCustomEmoji.vue | 2 +- packages/frontend-embed/src/components/EmInstanceTicker.vue | 2 +- packages/frontend/src/components/MkCropperDialog.vue | 2 +- packages/frontend/src/components/MkInstanceCardMini.vue | 2 +- packages/frontend/src/components/MkInstanceTicker.vue | 5 +++-- packages/frontend/src/components/MkMediaImage.vue | 2 +- packages/frontend/src/components/MkMention.vue | 2 +- packages/frontend/src/components/MkTimeline.vue | 2 +- packages/frontend/src/components/MkUserInfo.vue | 2 +- packages/frontend/src/components/MkUserPopup.vue | 2 +- packages/frontend/src/components/global/MkAvatar.vue | 2 +- packages/frontend/src/components/global/MkCustomEmoji.vue | 2 +- packages/frontend/src/pages/instance-info.vue | 2 +- packages/frontend/src/pages/page.vue | 2 +- packages/frontend/src/pages/settings/index.vue | 2 +- packages/frontend/src/pages/user/home.vue | 2 +- packages/frontend/src/pages/user/index.files.vue | 2 +- packages/frontend/src/pages/welcome.entrance.a.vue | 2 +- packages/frontend/src/ui/_common_/statusbar-federation.vue | 2 +- packages/frontend/src/widgets/WidgetFederation.vue | 2 +- packages/frontend/src/widgets/WidgetInstanceCloud.vue | 2 +- packages/frontend/src/widgets/WidgetPhotos.vue | 2 +- 22 files changed, 24 insertions(+), 23 deletions(-) diff --git a/packages/frontend-embed/src/components/EmCustomEmoji.vue b/packages/frontend-embed/src/components/EmCustomEmoji.vue index 6d96f682e4..e4149cf363 100644 --- a/packages/frontend-embed/src/components/EmCustomEmoji.vue +++ b/packages/frontend-embed/src/components/EmCustomEmoji.vue @@ -29,7 +29,7 @@ import { customEmojisMap } from '@/custom-emojis.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ name: string; diff --git a/packages/frontend-embed/src/components/EmInstanceTicker.vue b/packages/frontend-embed/src/components/EmInstanceTicker.vue index 1fa1014276..6bea697a65 100644 --- a/packages/frontend-embed/src/components/EmInstanceTicker.vue +++ b/packages/frontend-embed/src/components/EmInstanceTicker.vue @@ -15,7 +15,7 @@ import { computed, inject } from 'vue'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ instance: { diff --git a/packages/frontend/src/components/MkCropperDialog.vue b/packages/frontend/src/components/MkCropperDialog.vue index 7879e1d982..ad85d03036 100644 --- a/packages/frontend/src/components/MkCropperDialog.vue +++ b/packages/frontend/src/components/MkCropperDialog.vue @@ -44,7 +44,7 @@ import { i18n } from '@/i18n.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const emit = defineEmits<{ (ev: 'ok', cropped: Misskey.entities.DriveFile): void; diff --git a/packages/frontend/src/components/MkInstanceCardMini.vue b/packages/frontend/src/components/MkInstanceCardMini.vue index 36827a0f31..615289eda1 100644 --- a/packages/frontend/src/components/MkInstanceCardMini.vue +++ b/packages/frontend/src/components/MkInstanceCardMini.vue @@ -22,7 +22,7 @@ import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ instance: Misskey.entities.FederationInstance; diff --git a/packages/frontend/src/components/MkInstanceTicker.vue b/packages/frontend/src/components/MkInstanceTicker.vue index c7f4cbe65c..a0f9ac84ed 100644 --- a/packages/frontend/src/components/MkInstanceTicker.vue +++ b/packages/frontend/src/components/MkInstanceTicker.vue @@ -16,7 +16,8 @@ import { instanceName } from '@/config.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const serverMetadata = inject(DI.serverMetadata)!; +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ instance?: { @@ -32,7 +33,7 @@ const instance = props.instance ?? { themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement).content, }; -const faviconUrl = computed(() => props.instance ? mediaProxy.getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : mediaProxy.getProxiedImageUrlNullable(Instance.iconUrl, 'preview') ?? '/favicon.ico'); +const faviconUrl = computed(() => props.instance ? mediaProxy.getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : mediaProxy.getProxiedImageUrlNullable(serverMetadata.iconUrl, 'preview') ?? '/favicon.ico'); const themeColor = instance.themeColor ?? '#777777'; diff --git a/packages/frontend/src/components/MkMediaImage.vue b/packages/frontend/src/components/MkMediaImage.vue index df13eb04b0..623857d9cb 100644 --- a/packages/frontend/src/components/MkMediaImage.vue +++ b/packages/frontend/src/components/MkMediaImage.vue @@ -62,7 +62,7 @@ import { $i, iAmModerator } from '@/account.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = withDefaults(defineProps<{ image: Misskey.entities.DriveFile; diff --git a/packages/frontend/src/components/MkMention.vue b/packages/frontend/src/components/MkMention.vue index 6b6e911dec..4322924d33 100644 --- a/packages/frontend/src/components/MkMention.vue +++ b/packages/frontend/src/components/MkMention.vue @@ -24,7 +24,7 @@ import { MkABehavior } from '@/components/global/MkA.vue'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ username: string; diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index bab93e40bc..caf25b8fa2 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -77,7 +77,7 @@ function prepend(note) { tlNotesCount++; - if (instance.notesPerOneAd > 0 && tlNotesCount % instance.notesPerOneAd === 0) { + if (serverMetadata.notesPerOneAd > 0 && tlNotesCount % serverMetadata.notesPerOneAd === 0) { note._shouldInsertAd_ = true; } diff --git a/packages/frontend/src/components/MkUserInfo.vue b/packages/frontend/src/components/MkUserInfo.vue index e36988a212..14c71c8ec6 100644 --- a/packages/frontend/src/components/MkUserInfo.vue +++ b/packages/frontend/src/components/MkUserInfo.vue @@ -46,7 +46,7 @@ import { defaultStore } from '@/store.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; defineProps<{ user: Misskey.entities.UserDetailed; diff --git a/packages/frontend/src/components/MkUserPopup.vue b/packages/frontend/src/components/MkUserPopup.vue index 5829e8d126..f7a02aefb0 100644 --- a/packages/frontend/src/components/MkUserPopup.vue +++ b/packages/frontend/src/components/MkUserPopup.vue @@ -70,7 +70,7 @@ import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFf import { DI } from '@/di.js'; const serverMetadata = inject(DI.serverMetadata)!; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ showing: boolean; diff --git a/packages/frontend/src/components/global/MkAvatar.vue b/packages/frontend/src/components/global/MkAvatar.vue index c89dabd5ef..4bf7bba205 100644 --- a/packages/frontend/src/components/global/MkAvatar.vue +++ b/packages/frontend/src/components/global/MkAvatar.vue @@ -51,7 +51,7 @@ import { defaultStore } from '@/store.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const animation = ref(defaultStore.state.animation); const squareAvatars = ref(defaultStore.state.squareAvatars); diff --git a/packages/frontend/src/components/global/MkCustomEmoji.vue b/packages/frontend/src/components/global/MkCustomEmoji.vue index 5d033f2a5b..2602882faf 100644 --- a/packages/frontend/src/components/global/MkCustomEmoji.vue +++ b/packages/frontend/src/components/global/MkCustomEmoji.vue @@ -37,7 +37,7 @@ import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialo import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ name: string; diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index c8b43d71af..5e123e53e5 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -157,7 +157,7 @@ import MkTextarea from '@/components/MkTextarea.vue'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ host: string; diff --git a/packages/frontend/src/pages/page.vue b/packages/frontend/src/pages/page.vue index 6c8b9a41c1..5011968157 100644 --- a/packages/frontend/src/pages/page.vue +++ b/packages/frontend/src/pages/page.vue @@ -124,7 +124,7 @@ import { MenuItem } from '@/types/menu'; import { DI } from '@/di.js'; const serverMetadata = inject(DI.serverMetadata)!; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const router = useRouter(); diff --git a/packages/frontend/src/pages/settings/index.vue b/packages/frontend/src/pages/settings/index.vue index e05cc85929..61eb45ef3e 100644 --- a/packages/frontend/src/pages/settings/index.vue +++ b/packages/frontend/src/pages/settings/index.vue @@ -229,7 +229,7 @@ watch(router.currentRef, (to) => { } }); -const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified)); +const emailNotConfigured = computed(() => serverMetadata.enableEmail && ($i.email == null || !$i.emailVerified)); provideMetadataReceiver((metadataGetter) => { const info = metadataGetter(); diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue index ec94782d9b..eb296342d1 100644 --- a/packages/frontend/src/pages/user/home.vue +++ b/packages/frontend/src/pages/user/home.vue @@ -178,7 +178,7 @@ import { useRouter } from '@/router/supplier.js'; import { DI } from '@/di.js'; const serverMetadata = inject(DI.serverMetadata)!; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; function calcAge(birthdate: string): number { const date = new Date(birthdate); diff --git a/packages/frontend/src/pages/user/index.files.vue b/packages/frontend/src/pages/user/index.files.vue index dc5ccda1f3..1cbead15b0 100644 --- a/packages/frontend/src/pages/user/index.files.vue +++ b/packages/frontend/src/pages/user/index.files.vue @@ -44,7 +44,7 @@ import { i18n } from '@/i18n.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ user: Misskey.entities.UserDetailed; diff --git a/packages/frontend/src/pages/welcome.entrance.a.vue b/packages/frontend/src/pages/welcome.entrance.a.vue index 8fb628e929..126676a8e0 100644 --- a/packages/frontend/src/pages/welcome.entrance.a.vue +++ b/packages/frontend/src/pages/welcome.entrance.a.vue @@ -48,7 +48,7 @@ import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue'; import { DI } from '@/di.js'; const serverMetadata = inject(DI.serverMetadata)!; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const instances = ref(); diff --git a/packages/frontend/src/ui/_common_/statusbar-federation.vue b/packages/frontend/src/ui/_common_/statusbar-federation.vue index c32d48a794..c3d2d44cf4 100644 --- a/packages/frontend/src/ui/_common_/statusbar-federation.vue +++ b/packages/frontend/src/ui/_common_/statusbar-federation.vue @@ -39,7 +39,7 @@ import { misskeyApi } from '@/scripts/misskey-api.js'; import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const props = defineProps<{ display?: 'marquee' | 'oneByOne'; diff --git a/packages/frontend/src/widgets/WidgetFederation.vue b/packages/frontend/src/widgets/WidgetFederation.vue index a9f752f9fc..d21836914f 100644 --- a/packages/frontend/src/widgets/WidgetFederation.vue +++ b/packages/frontend/src/widgets/WidgetFederation.vue @@ -58,7 +58,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name, import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const instances = ref([]); const charts = ref([]); diff --git a/packages/frontend/src/widgets/WidgetInstanceCloud.vue b/packages/frontend/src/widgets/WidgetInstanceCloud.vue index 26a259e128..84f9fc58fc 100644 --- a/packages/frontend/src/widgets/WidgetInstanceCloud.vue +++ b/packages/frontend/src/widgets/WidgetInstanceCloud.vue @@ -50,7 +50,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name, import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const cloud = shallowRef | null>(); const activeInstances = shallowRef(null); diff --git a/packages/frontend/src/widgets/WidgetPhotos.vue b/packages/frontend/src/widgets/WidgetPhotos.vue index 0e41f2be84..dcb08c6150 100644 --- a/packages/frontend/src/widgets/WidgetPhotos.vue +++ b/packages/frontend/src/widgets/WidgetPhotos.vue @@ -58,7 +58,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name, import { DI } from '@/di.js'; -const mediaProxy = inject(DI.mediaProxy); +const mediaProxy = inject(DI.mediaProxy)!; const connection = useStream().useChannel('main'); const images = ref([]);