From 296b8ce24ba58313e8d413bde7df14957e1dc2b4 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:49:12 +0900 Subject: [PATCH] wip --- packages/frontend-embed/src/config.ts | 6 +++--- packages/frontend-embed/src/custom-emojis.ts | 13 +++++++++++-- packages/frontend-embed/vite.config.ts | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/frontend-embed/src/config.ts b/packages/frontend-embed/src/config.ts index 08f14dfdd8..f9850ba461 100644 --- a/packages/frontend-embed/src/config.ts +++ b/packages/frontend-embed/src/config.ts @@ -10,9 +10,9 @@ export const host = address.host; export const hostname = address.hostname; export const url = address.origin; export const apiUrl = location.origin + '/api'; +export const lang = localStorage.getItem('lang') ?? 'en-US'; export const langs = _LANGS_; -const preParseLocale = miLocalStorage.getItem('locale'); +const preParseLocale = localStorage.getItem('locale'); export const locale = preParseLocale ? JSON.parse(preParseLocale) : null; export const instanceName = siteName === 'Misskey' || siteName == null ? host : siteName; -export const ui = miLocalStorage.getItem('ui'); -export const debug = miLocalStorage.getItem('debug') === 'true'; +export const debug = localStorage.getItem('debug') === 'true'; diff --git a/packages/frontend-embed/src/custom-emojis.ts b/packages/frontend-embed/src/custom-emojis.ts index 0c402da2c0..fad373fe4c 100644 --- a/packages/frontend-embed/src/custom-emojis.ts +++ b/packages/frontend-embed/src/custom-emojis.ts @@ -5,8 +5,17 @@ import { shallowRef, computed, markRaw, watch } from 'vue'; import * as Misskey from 'misskey-js'; -import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js'; -import { get, set } from '@/scripts/idb-proxy.js'; +import { misskeyApi, misskeyApiGet } from '@/misskey-api.js'; + +function get(key: string) { + const value = localStorage.getItem(key); + if (value === null) return null; + return JSON.parse(value); +} + +function set(key: string, value: any) { + localStorage.setItem(key, JSON.stringify(value)); +} const storageCache = await get('emojis'); export const customEmojis = shallowRef(Array.isArray(storageCache) ? storageCache : []); diff --git a/packages/frontend-embed/vite.config.ts b/packages/frontend-embed/vite.config.ts index 6b00b1c2f7..9715751ae8 100644 --- a/packages/frontend-embed/vite.config.ts +++ b/packages/frontend-embed/vite.config.ts @@ -72,6 +72,7 @@ export function getConfig(): UserConfig { extensions, alias: { '@/': __dirname + '/src/', + '/client-assets/': __dirname + '/assets/', '/static-assets/': __dirname + '/../backend/assets/' }, },