diff --git a/packages/frontend/src/instance.ts b/packages/frontend/src/instance.ts index 9fe0da710f..8e7cfc3440 100644 --- a/packages/frontend/src/instance.ts +++ b/packages/frontend/src/instance.ts @@ -28,7 +28,7 @@ if (providedAt > cachedAt) { // TODO: instanceをリアクティブにするかは再考の余地あり -export const instance: Misskey.entities.MetaResponse = reactive(cachedMeta ?? {}); +export const instance: Misskey.entities.MetaDetailed = reactive(cachedMeta ?? {}); export const serverErrorImageUrl = computed(() => instance.serverErrorImageUrl ?? DEFAULT_SERVER_ERROR_IMAGE_URL); @@ -38,17 +38,17 @@ export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFA export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true); -export async function fetchInstance(force = false): Promise { +export async function fetchInstance(force = false): Promise { if (!force) { const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0; if (Date.now() - cachedAt < 1000 * 60 * 60) { - return; + return instance; } } const meta = await misskeyApi('meta', { - detail: false, + detail: true, }); for (const [k, v] of Object.entries(meta)) { @@ -57,4 +57,5 @@ export async function fetchInstance(force = false): Promise { miLocalStorage.setItem('instance', JSON.stringify(instance)); miLocalStorage.setItem('instanceCachedAt', Date.now().toString()); + return instance; }