mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 00:29:22 +09:00
wip
This commit is contained in:
parent
d9f3f0c972
commit
0e3022860b
@ -50,7 +50,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
<div :class="$style.noteHeaderInfo">
|
||||
<a :href="url" :class="$style.noteHeaderInstanceIconLink" target="_blank" rel="noopener noreferrer">
|
||||
<img :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.noteHeaderInstanceIcon"/>
|
||||
<img :src="serverMetadataiconUrl || '/favicon.ico'" alt="" :class="$style.noteHeaderInstanceIcon"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -142,7 +142,7 @@ import { userPage } from '@/utils.js';
|
||||
import { notePage } from '@/utils.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { shouldCollapsed } from '@/to-be-shared/collapsed.js';
|
||||
import { instance } from '@/server-metadata.js';
|
||||
import { serverMetadata } from '@/server-metadata.js';
|
||||
import { url } from '@/config.js';
|
||||
import EmMfm from '@/components/EmMfm.js';
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { misskeyApi } from '@/misskey-api.js';
|
||||
|
||||
const providedMetaEl = document.getElementById('misskey_meta');
|
||||
|
||||
const _instance = (providedMetaEl && providedMetaEl.textContent) ? JSON.parse(providedMetaEl.textContent) : null;
|
||||
|
||||
// NOTE: devモードのときしか _instance が null になることは無い
|
||||
export const instance = _instance ?? await misskeyApi('meta', {
|
||||
detail: true,
|
||||
});
|
@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<a :href="url" :class="$style.instanceIconLink" target="_blank" rel="noopener noreferrer">
|
||||
<img
|
||||
:class="$style.instanceIcon"
|
||||
:src="instance.iconUrl || '/favicon.ico'"
|
||||
:src="serverMetadataiconUrl || '/favicon.ico'"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
@ -41,6 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, shallowRef, inject, onActivated } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { scrollToTop } from '@@/js/scroll.js';
|
||||
import type { Paging } from '@/components/EmPagination.vue';
|
||||
import type { ParsedEmbedParams } from '@/embed-page.js';
|
||||
import EmNotes from '@/components/EmNotes.vue';
|
||||
@ -48,9 +49,8 @@ import XNotFound from '@/pages/not-found.vue';
|
||||
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/server-metadata.js';
|
||||
import { serverMetadata } from '@/server-metadata.js';
|
||||
import { url, instanceName } from '@/config.js';
|
||||
import { scrollToTop } from '@@/js/scroll.js';
|
||||
import { isLink } from '@/scripts/is-link.js';
|
||||
import { defaultEmbedParams } from '@/embed-page.js';
|
||||
|
||||
|
@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<a :href="url" :class="$style.instanceIconLink" target="_blank" rel="noopener noreferrer">
|
||||
<img
|
||||
:class="$style.instanceIcon"
|
||||
:src="instance.iconUrl || '/favicon.ico'"
|
||||
:src="serverMetadataiconUrl || '/favicon.ico'"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
@ -39,15 +39,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, shallowRef, inject, onActivated } from 'vue';
|
||||
import { scrollToTop } from '@@/js/scroll.js';
|
||||
import type { Paging } from '@/components/MkPagination.vue';
|
||||
import type { ParsedEmbedParams } from '@/embed-page.js';
|
||||
import EmNotes from '@/components/EmNotes.vue';
|
||||
import XNotFound from '@/pages/not-found.vue';
|
||||
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/server-metadata.js';
|
||||
import { serverMetadata } from '@/server-metadata.js';
|
||||
import { url, instanceName } from '@/config.js';
|
||||
import { scrollToTop } from '@@/js/scroll.js';
|
||||
import { isLink } from '@/scripts/is-link.js';
|
||||
import { defaultEmbedParams } from '@/embed-page.js';
|
||||
|
||||
|
@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<a :href="url" :class="$style.instanceIconLink" target="_blank" rel="noopener noreferrer">
|
||||
<img
|
||||
:class="$style.instanceIcon"
|
||||
:src="instance.iconUrl || '/favicon.ico'"
|
||||
:src="serverMetadataiconUrl || '/favicon.ico'"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
@ -62,7 +62,7 @@ import XNotFound from '@/pages/not-found.vue';
|
||||
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
|
||||
import { misskeyApi } from '@/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/server-metadata.js';
|
||||
import { serverMetadata } from '@/server-metadata.js';
|
||||
import { url, instanceName } from '@/config.js';
|
||||
import { defaultEmbedParams } from '@/embed-page.js';
|
||||
|
||||
|
15
packages/frontend-embed/src/server-metadata.ts
Normal file
15
packages/frontend-embed/src/server-metadata.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { misskeyApi } from '@/misskey-api.js';
|
||||
|
||||
const providedMetaEl = document.getElementById('misskey_meta');
|
||||
|
||||
const _serverMetadata = (providedMetaEl && providedMetaEl.textContent) ? JSON.parse(providedMetaEl.textContent) : null;
|
||||
|
||||
// NOTE: devモードのときしか _serverMetadata が null になることは無い
|
||||
export const serverMetadata = _serverMetadata ?? await misskeyApi('meta', {
|
||||
detail: true,
|
||||
});
|
@ -4,6 +4,8 @@
|
||||
*/
|
||||
import type { ILocale, ParameterizedString } from '../../../locales/index.js';
|
||||
|
||||
type TODO = any;
|
||||
|
||||
type FlattenKeys<T extends ILocale, TPrediction> = keyof {
|
||||
[K in keyof T as T[K] extends ILocale
|
||||
? FlattenKeys<T[K], TPrediction> extends infer C extends string
|
||||
@ -116,7 +118,7 @@ export class I18n<T extends ILocale> {
|
||||
return () => value;
|
||||
}
|
||||
|
||||
return (arg) => {
|
||||
return (arg: TODO) => {
|
||||
let str = quasis[0];
|
||||
|
||||
for (let i = 0; i < expressions.length; i++) {
|
||||
@ -155,7 +157,7 @@ export class I18n<T extends ILocale> {
|
||||
const value = target[k as keyof typeof target];
|
||||
|
||||
if (typeof value === 'object') {
|
||||
result[k] = build(value as ILocale);
|
||||
(result as TODO)[k] = build(value as ILocale);
|
||||
} else if (typeof value === 'string') {
|
||||
const quasis: string[] = [];
|
||||
const expressions: string[] = [];
|
||||
@ -182,7 +184,7 @@ export class I18n<T extends ILocale> {
|
||||
continue;
|
||||
}
|
||||
|
||||
result[k] = (arg) => {
|
||||
(result as TODO)[k] = (arg: TODO) => {
|
||||
let str = quasis[0];
|
||||
|
||||
for (let i = 0; i < expressions.length; i++) {
|
||||
@ -211,7 +213,7 @@ export class I18n<T extends ILocale> {
|
||||
let str: string | ParameterizedString | ILocale = this.locale;
|
||||
|
||||
for (const k of key.split('.')) {
|
||||
str = str[k];
|
||||
str = (str as TODO)[k];
|
||||
|
||||
if (this.devMode) {
|
||||
if (typeof str === 'undefined') {
|
||||
|
Loading…
Reference in New Issue
Block a user