Add what's new page

This commit is contained in:
Misode
2023-06-21 02:31:35 +02:00
parent 9b6233ce23
commit 15d6e621f7
8 changed files with 139 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ const mcmetaUrl = 'https://raw.githubusercontent.com/misode/mcmeta'
const mcmetaTarballUrl = 'https://github.com/misode/mcmeta/tarball'
const changesUrl = 'https://raw.githubusercontent.com/misode/technical-changes'
const fixesUrl = 'https://raw.githubusercontent.com/misode/mcfixes'
const whatsNewUrl = 'https://whats-new.misode.workers.dev/'
type McmetaTypes = 'summary' | 'data' | 'data-json' | 'assets' | 'assets-json' | 'registries' | 'atlas'
@@ -280,6 +281,23 @@ export async function fetchBugfixes(version: VersionId): Promise<Bugfix[]> {
}
}
export interface WhatsNewItem {
id: string,
title: string,
body: string,
url: string,
createdAt: string,
}
export async function fetchWhatsNew(): Promise<WhatsNewItem[]> {
try {
const whatsNew = await cachedFetch<WhatsNewItem[]>(whatsNewUrl, { refresh: true })
return whatsNew
} catch (e) {
throw new Error(`Error occured while fetching what's new: ${message(e)}`)
}
}
interface FetchOptions<D> {
decode?: (r: Response) => Promise<D>
refresh?: boolean