mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 23:56:51 +00:00
Add version mcmeta diff page (#428)
* Add version mcmeta diff page * Add toggle for word wrapping * Fix diff view on mobile * Use full layout width on version details * Show image and audio diffs * Add word_wrap locale
This commit is contained in:
@@ -20,7 +20,8 @@ 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/'
|
||||
const versionDiffUrl = 'https://mcmeta-diff.misode.workers.dev'
|
||||
const whatsNewUrl = 'https://whats-new.misode.workers.dev'
|
||||
|
||||
type McmetaTypes = 'summary' | 'data' | 'data-json' | 'assets' | 'assets-json' | 'registries' | 'atlas'
|
||||
|
||||
@@ -273,12 +274,46 @@ export interface Bugfix {
|
||||
votes: number,
|
||||
}
|
||||
|
||||
export async function fetchBugfixes(version: VersionId): Promise<Bugfix[]> {
|
||||
export async function fetchBugfixes(version: string): 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)}`)
|
||||
throw new Error(`Error occured while fetching bugfixes for version ${version}: ${message(e)}`)
|
||||
}
|
||||
}
|
||||
|
||||
export interface GitHubCommitFile {
|
||||
sha: string,
|
||||
filename: string,
|
||||
previous_filename?: string,
|
||||
status: 'added' | 'modified' | 'removed' | 'renamed',
|
||||
additions: number,
|
||||
deletions: number,
|
||||
changes: number,
|
||||
patch: string,
|
||||
}
|
||||
|
||||
export interface GitHubCommit {
|
||||
sha: string,
|
||||
html_url: string,
|
||||
parents: {
|
||||
sha: string,
|
||||
}[],
|
||||
stats: {
|
||||
total: number,
|
||||
additions: number,
|
||||
deletions: number,
|
||||
},
|
||||
files: GitHubCommitFile[],
|
||||
}
|
||||
|
||||
export async function fetchVersionDiff(version: string) {
|
||||
try {
|
||||
const diff = await cachedFetch<GitHubCommit>(`${versionDiffUrl}/${version}`, { refresh: true })
|
||||
return diff
|
||||
} catch (e) {
|
||||
throw new Error(`Error occured while fetching diff for version ${version}: ${message(e)}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user