Files
modrinth/packages/api-client/src/modules/launcher-meta/v0.ts
T
aecsocket 57a977f7f3 feat: use v1 version manifest for Quilt (#6650)
* wip: app-side logic

* lints

* fmt

* fmt

* Split Daedalus changes out of frontend branch

* Remove Daedalus changes from frontend branch
2026-07-10 11:17:41 +00:00

36 lines
1.1 KiB
TypeScript

import { AbstractModule } from '../../core/abstract-module'
import type { LauncherMeta } from './types'
export type { LauncherMeta } from './types'
const LAUNCHER_META_BASE_URL = 'https://launcher-meta.modrinth.com'
export class LauncherMetaManifestV0Module extends AbstractModule {
public getModuleID(): string {
return 'launchermeta_manifest_v0'
}
/**
* Get the loader manifest for a given loader platform.
*
* launcher-meta refuses CORS preflights that ask for the `Content-Type`
* header (returns 403), so we strip the default `Content-Type: application/json`
* the abstract client sets — these are body-less GETs and don't need it.
* Without this the browser preflight is rejected and the GET never fires.
*
* @param loader - Loader platform (fabric, forge, quilt, neo)
*/
public async getManifest(
loader: string,
formatVersion = 0,
): Promise<LauncherMeta.Manifest.v0.Manifest> {
return this.client.request<LauncherMeta.Manifest.v0.Manifest>('/manifest.json', {
api: LAUNCHER_META_BASE_URL,
version: `${loader}/v${formatVersion}`,
method: 'GET',
skipAuth: true,
headers: { 'Content-Type': '' },
})
}
}