ローカルのカスタム絵文字については直接オリジナルURLにリクエストするように
This commit is contained in:
parent
bd469420fa
commit
3e112da486
5 changed files with 21 additions and 5 deletions
|
|
@ -2,14 +2,19 @@ import { api } from './os';
|
|||
import { miLocalStorage } from './local-storage';
|
||||
|
||||
const storageCache = miLocalStorage.getItem('emojis');
|
||||
export let customEmojis = storageCache ? JSON.parse(storageCache) : [];
|
||||
export let customEmojis: {
|
||||
name: string;
|
||||
aliases: string[];
|
||||
category: string;
|
||||
url: string;
|
||||
}[] = storageCache ? JSON.parse(storageCache) : [];
|
||||
|
||||
fetchCustomEmojis();
|
||||
|
||||
export async function fetchCustomEmojis() {
|
||||
const now = Date.now();
|
||||
const lastFetchedAt = miLocalStorage.getItem('lastEmojisFetchedAt');
|
||||
if (lastFetchedAt && (now - parseInt(lastFetchedAt)) < 1000 * 60 * 60) return;
|
||||
if (lastFetchedAt && (now - parseInt(lastFetchedAt)) < 1000 * 60 * 60 * 24) return;
|
||||
|
||||
const res = await api('emojis', {});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue