Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 2, 2024
1 parent 3676ada commit db37ad6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/frontend-embed/src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import '@/style.scss';
import { createApp, defineAsyncComponent } from 'vue';
import lightTheme from '@@/themes/l-light.json5';
import darkTheme from '@@/themes/d-dark.json5';
import { MediaProxy } from '@@/js/media-proxy.js';
import { applyTheme } from './theme.js';
import { fetchCustomEmojis } from './custom-emojis.js';
import { setIframeId } from '@/post-message.js';
import { DI } from './di.js';
import { serverMetadata } from './server-metadata.js';
import { url } from './config.js';
import { parseEmbedParams } from '@/embed-page.js';
import { setIframeId } from '@/post-message.js';

console.info('Misskey Embed');

Expand Down Expand Up @@ -64,9 +68,9 @@ const app = createApp(
defineAsyncComponent(() => import('@/ui.vue')),
);

//#region Embed Provide
app.provide(DI.mediaProxy, new MediaProxy(serverMetadata, url));

app.provide('embedParams', embedParams);
//#endregion

// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
// なぜか2回実行されることがあるため、mountするdivを1つに制限する
Expand Down
13 changes: 13 additions & 0 deletions packages/frontend-embed/src/di.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { InjectionKey } from 'vue';
import * as Misskey from 'misskey-js';
import { MediaProxy } from '@@/js/media-proxy.js';

export const DI = {
serverMetadata: Symbol() as InjectionKey<Misskey.entities.MetaDetailed>,
mediaProxy: Symbol() as InjectionKey<MediaProxy>,
};

0 comments on commit db37ad6

Please sign in to comment.