feat:移除了弹窗,服务器添加sls

This commit is contained in:
2026-09-08 22:39:45 +08:00
commit 6a295f9a7a
4082 changed files with 1322534 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import { invoke } from '@tauri-apps/api/core'
export type MinecraftNewsItem = {
title: string
category?: string | null
tag?: string | null
date?: string | null
image_url?: string | null
read_more_url: string
}
const NEWS_TTL_MS = 30 * 60 * 1000
let cachedAt = 0
let cached: Promise<MinecraftNewsItem[]> | null = null
export function get_minecraft_news(limit = 12): Promise<MinecraftNewsItem[]> {
if (!cached || Date.now() - cachedAt > NEWS_TTL_MS) {
cachedAt = Date.now()
cached = invoke<MinecraftNewsItem[]>('plugin:utils|get_minecraft_news', { limit }).catch(
(error) => {
cached = null
throw error
},
)
}
return cached
}