diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-11-12 02:02:25 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-11-12 02:02:25 +0900 |
| commit | 0e4a111f81cceed275d9bec2695f6e401fb654d8 (patch) | |
| tree | 40874799472fa07416f17b50a398ac33b7771905 /src/client/instance.ts | |
| parent | update deps (diff) | |
| download | sharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.gz sharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.bz2 sharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.zip | |
refactoring
Resolve #7779
Diffstat (limited to 'src/client/instance.ts')
| -rw-r--r-- | src/client/instance.ts | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/client/instance.ts b/src/client/instance.ts deleted file mode 100644 index 6e912aa2e5..0000000000 --- a/src/client/instance.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { computed, reactive } from 'vue'; -import * as Misskey from 'misskey-js'; -import { api } from './os'; - -// TODO: 他のタブと永続化されたstateを同期 - -const data = localStorage.getItem('instance'); - -// TODO: instanceをリアクティブにするかは再考の余地あり - -export const instance: Misskey.entities.InstanceMetadata = reactive(data ? JSON.parse(data) : { - // TODO: set default values -}); - -export async function fetchInstance() { - const meta = await api('meta', { - detail: false - }); - - for (const [k, v] of Object.entries(meta)) { - instance[k] = v; - } - - localStorage.setItem('instance', JSON.stringify(instance)); -} - -export const emojiCategories = computed(() => { - if (instance.emojis == null) return []; - const categories = new Set(); - for (const emoji of instance.emojis) { - categories.add(emoji.category); - } - return Array.from(categories); -}); - -export const emojiTags = computed(() => { - if (instance.emojis == null) return []; - const tags = new Set(); - for (const emoji of instance.emojis) { - for (const tag of emoji.aliases) { - tags.add(tag); - } - } - return Array.from(tags); -}); - -// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない -declare module '@vue/runtime-core' { - interface ComponentCustomProperties { - $instance: typeof instance; - } -} |