Add fixed bugs tab to versions

This commit is contained in:
Misode
2022-11-09 19:08:25 +01:00
parent 46347f1974
commit 6312dfbc71
8 changed files with 84 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ const latestVersion = __LATEST_VERSION__ ?? ''
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'
type McmetaTypes = 'summary' | 'data' | 'data-json' | 'assets' | 'assets-json' | 'registries' | 'atlas'
@@ -235,6 +236,31 @@ export async function fetchChangelogs(): Promise<Change[]> {
}
}
export interface Bugfix {
id: string,
summary: string,
labels: string[],
status: string,
confirmation_status: string,
categories: string[],
priority: string,
fix_versions: string[],
creation_date: string,
resolution_date: string,
updated_date: string,
watches: number,
votes: number,
}
export async function fetchBugfixes(version: VersionId): Promise<Bugfix[]> {
try {
const fixes = await cachedFetch<Bugfix[]>(`${fixesUrl}/main/versions/${version}.json`, { refresh: true })
return fixes
} catch (e) {
throw new Error(`Error occured while fetching bugfixes: ${message(e)}`)
}
}
interface FetchOptions<D> {
decode?: (r: Response) => Promise<D>
refresh?: boolean