wip
This commit is contained in:
@@ -2,6 +2,7 @@ import { apiGet } from './os';
|
||||
import { miLocalStorage } from './local-storage';
|
||||
import { shallowRef, computed, markRaw } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { stream } from '@/stream';
|
||||
|
||||
const storageCache = miLocalStorage.getItem('emojis');
|
||||
export const customEmojis = shallowRef<Misskey.entities.CustomEmoji[]>(storageCache ? JSON.parse(storageCache) : []);
|
||||
@@ -14,7 +15,18 @@ export const customEmojiCategories = computed<string[]>(() => {
|
||||
});
|
||||
|
||||
fetchCustomEmojis();
|
||||
window.setInterval(fetchCustomEmojis, 1000 * 60 * 10);
|
||||
|
||||
stream.on('emojiAdded', emojiData => {
|
||||
customEmojis.value = [ emojiData.emoji, ...customEmojis.value ]
|
||||
});
|
||||
|
||||
stream.on('emojiUpdated', emojiData => {
|
||||
customEmojis.value = customEmojis.value.map(item => emojiData.emojis.find(search => search.name === item.name) as Misskey.entities.CustomEmoji ?? item);
|
||||
});
|
||||
|
||||
stream.on('emojiDeleted', emojiData => {
|
||||
customEmojis.value = customEmojis.value.filter(item => !emojiData.emojis.some(search => search.name === item.name))
|
||||
});
|
||||
|
||||
export async function fetchCustomEmojis() {
|
||||
const now = Date.now();
|
||||
|
@@ -338,11 +338,6 @@ import { fetchCustomEmojis } from './custom-emojis';
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('emojiAdded', emojiData => {
|
||||
// TODO
|
||||
//store.commit('instance/set', );
|
||||
});
|
||||
|
||||
for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
|
||||
import('./plugin').then(({ install }) => {
|
||||
install(plugin);
|
||||
|
Reference in New Issue
Block a user