Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 1, 2024
1 parent c08ccb6 commit cd665be
Show file tree
Hide file tree
Showing 87 changed files with 277 additions and 92 deletions.
4 changes: 3 additions & 1 deletion packages/frontend-embed/src/components/EmCustomEmoji.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, inject, ref } from 'vue';
import { customEmojisMap } from '@/custom-emojis.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
name: string;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend-embed/src/components/EmInstanceTicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, inject } from 'vue';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
instance: {
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { miLocalStorage } from '@/local-storage.js';
import { fetchCustomEmojis } from '@/custom-emojis.js';
import { setupRouter } from '@/router/main.js';
import { createMainRouter } from '@/router/definition.js';
import { DI } from '@/di.js';

export async function common(createVue: () => App<Element>) {
console.info(`Misskey v${version}`);
Expand Down Expand Up @@ -234,8 +235,8 @@ export async function common(createVue: () => App<Element>) {
} catch (err) { /* empty */ }

const app = createVue();
app.provide('serverMetadata', serverMetadata);
app.provide('mediaProxy', new MediaProxy(serverMetadata, url));
app.provide(DI.serverMetadata, serverMetadata);
app.provide(DI.mediaProxy, new MediaProxy(serverMetadata, url));

setupRouter(app, createMainRouter);

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkChannelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import MkChannelPreview from '@/components/MkChannelPreview.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
pagination: Paging;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkCropperDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ import { defaultStore } from '@/store.js';
import { apiUrl } from '@/config.js';
import { i18n } from '@/i18n.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const emit = defineEmits<{
(ev: 'ok', cropped: Misskey.entities.DriveFile): void;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkDonation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { miLocalStorage } from '@/local-storage.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const emit = defineEmits<{
(ev: 'closed'): void;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkFeaturedPhotos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import { inject } from 'vue';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);
</script>

<style lang="scss" module>
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkForgotPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const emit = defineEmits<{
(ev: 'done'): void;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkFormDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ import XFile from './MkFormDialog.file.vue';
import type { Form } from '@/scripts/form.js';
import MkModalWindow from '@/components/MkModalWindow.vue';
import { i18n } from '@/i18n.js';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = defineProps<{
title: string;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkInstanceCardMini.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import * as Misskey from 'misskey-js';
import MkMiniChart from '@/components/MkMiniChart.vue';
import { misskeyApiGet } from '@/scripts/misskey-api.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
instance: Misskey.entities.FederationInstance;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkInstanceTicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, inject } from 'vue';
import { instanceName } from '@/config.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
instance?: {
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import { useTooltip } from '@/scripts/use-tooltip.js';
import * as os from '@/os.js';
import { MkABehavior } from '@/components/global/MkA.vue';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
url: string;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkMediaImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { $i, iAmModerator } from '@/account.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = withDefaults(defineProps<{
image: Misskey.entities.DriveFile;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkMention.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
import { MkABehavior } from '@/components/global/MkA.vue';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
username: string;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ import { type Keymap } from '@/scripts/hotkey.js';
import { focusPrev, focusNext } from '@/scripts/focus.js';
import { getAppearNote } from '@/scripts/get-appear-note.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
note: Misskey.entities.Note;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ import MkButton from '@/components/MkButton.vue';
import { getAppearNote } from '@/scripts/get-appear-note.js';
import { type Keymap } from '@/scripts/hotkey.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
note: Misskey.entities.Note;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkNotes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = defineProps<{
pagination: Paging;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { signinRequired } from '@/account.js';
import { inject } from 'vue';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const $i = signinRequired();

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkNotifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import { notificationTypes } from '@/const.js';
import { inject } from 'vue';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);
import { defaultStore } from '@/store.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import * as Misskey from 'misskey-js';
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function concatMapWithArray(map: MisskeyEntityMap, entities: MisskeyEntity[]): M
</script>
<script lang="ts" setup>
import { inject } from 'vue';
const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);
import MkButton from '@/components/MkButton.vue';

const props = withDefaults(defineProps<{
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ import { claimAchievement } from '@/scripts/achievements.js';
import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const $i = signinRequired();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ import { apiWithDialog, promiseDialog } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

defineProps<{
primary?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkSignupDialog.form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { login } from '@/account.js';
import { i18n } from '@/i18n.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
autoSet?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkSignupDialog.rules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ import MkSwitch from '@/components/MkSwitch.vue';
import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const availableServerRules = serverMetadata.serverRules.length > 0;
const availableTos = serverMetadata.tosUrl != null && serverMetadata.tosUrl !== '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import { i18n } from '@/i18n.js';
import { miLocalStorage } from '@/local-storage.js';
import * as os from '@/os.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const emit = defineEmits<{
(ev: 'closed'): void;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
import { Paging } from '@/components/MkPagination.vue';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
src: BasicTimelineType | 'mentions' | 'directs' | 'list' | 'antenna' | 'channel' | 'role';
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkTutorialDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ import { host } from '@/config.js';
import { claimAchievement } from '@/scripts/achievements.js';
import * as os from '@/os.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = defineProps<{
initialPage?: number;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkUserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import { $i } from '@/account.js';
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
import { defaultStore } from '@/store.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

defineProps<{
user: Misskey.entities.UserDetailed;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkUserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import MkUserInfo from '@/components/MkUserInfo.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const props = withDefaults(defineProps<{
pagination: Paging;
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/components/MkUserPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ import { i18n } from '@/i18n.js';
import { defaultStore } from '@/store.js';
import { $i } from '@/account.js';
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
import { DI } from '@/di.js';

const serverMetadata = inject('serverMetadata');
const mediaProxy = inject('mediaProxy');
const serverMetadata = inject(DI.serverMetadata);
const mediaProxy = inject(DI.mediaProxy);

const props = defineProps<{
showing: boolean;
Expand Down
6 changes: 4 additions & 2 deletions packages/frontend/src/components/MkUserSetupDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ import MkPushNotificationAllowButton from '@/components/MkPushNotificationAllowB
import { defaultStore } from '@/store.js';
import * as os from '@/os.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const emit = defineEmits<{
(ev: 'closed'): void;
}>();

const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();

const page = ref(defaultStore.state.accountSetupWizard);

watch(page, () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkVisitorDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ import MkNumber from '@/components/MkNumber.vue';
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
import { openInstanceMenu } from '@/ui/_common_/common.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

const stats = ref<Misskey.entities.StatsResponse | null>(null);

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/global/MkAd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ import { defaultStore } from '@/store.js';
import * as os from '@/os.js';
import { $i } from '@/account.js';

const serverMetadata = inject('serverMetadata');
import { DI } from '@/di.js';

const serverMetadata = inject(DI.serverMetadata);

type Ad = (typeof serverMetadata)['ads'][number];

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/global/MkAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ import { acct, userPage } from '@/filters/user.js';
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
import { defaultStore } from '@/store.js';

const mediaProxy = inject('mediaProxy');
import { DI } from '@/di.js';

const mediaProxy = inject(DI.mediaProxy);

const animation = ref(defaultStore.state.animation);
const squareAvatars = ref(defaultStore.state.squareAvatars);
Expand Down
Loading

0 comments on commit cd665be

Please sign in to comment.