fix: open modrinth project links in the app (#6072)

This commit is contained in:
Prospector
2026-05-11 19:57:39 -07:00
committed by GitHub
parent e0056bfc40
commit 02e10be4db
4 changed files with 134 additions and 1 deletions

View File

@@ -26,6 +26,23 @@ export class LabrinthProjectsV2Module extends AbstractModule {
})
}
/**
* Check that a project slug or ID exists and return its canonical project ID.
*
* @param idOrSlug - Project ID or slug (e.g. `sodium` or `AANobbMI`)
*/
public async check(idOrSlug: string): Promise<Labrinth.Projects.v2.ProjectCheckResponse> {
const encoded = encodeURIComponent(idOrSlug)
return this.client.request<Labrinth.Projects.v2.ProjectCheckResponse>(
`/project/${encoded}/check`,
{
api: 'labrinth',
version: 2,
method: 'GET',
},
)
}
/**
* Get multiple projects by IDs
*

View File

@@ -468,6 +468,10 @@ export namespace Labrinth {
monetization_status: MonetizationStatus
}
export type ProjectCheckResponse = {
id: string
}
export type SearchResultHit = {
project_id: string
project_type: ProjectType