feat: add download metadata to website (#6034)

* feat: add download metadata to website

* add to project cards
This commit is contained in:
Prospector
2026-05-07 19:20:54 -07:00
committed by GitHub
parent fd5d2797b3
commit 3d7aea5a45
13 changed files with 335 additions and 30 deletions

View File

@@ -39,11 +39,13 @@ import { ButtonStyled, VersionChannelIndicator } from '../index'
const props = defineProps<{
version: Version
decorateDownloadUrl?: (url: string) => string
}>()
const downloadUrl = computed(() => {
const primary: VersionFile = props.version.files.find((x) => x.primary) || props.version.files[0]
return primary.url
const raw = primary.url
return props.decorateDownloadUrl ? props.decorateDownloadUrl(raw) : raw
})
const emit = defineEmits<{

View File

@@ -5,7 +5,7 @@ import { useRoute, useRouter } from 'vue-router'
import { useDebugLogger } from '#ui/composables/debug-logger'
import type { FilterType, FilterValue, ProjectType, SortType } from '#ui/utils/search'
import { useSearch } from '#ui/utils/search'
import { LOADER_FILTER_TYPES, useSearch } from '#ui/utils/search'
import { useServerSearch } from '#ui/utils/server-search'
import type { BrowseSearchResponse } from '../types'
@@ -60,14 +60,6 @@ export interface BrowseSearchState {
onFilterChange: () => void
}
const LOADER_FILTER_TYPES = [
'mod_loader',
'plugin_loader',
'modpack_loader',
'shader_loader',
'plugin_platform',
] as const
export function useBrowseSearch(options: UseBrowseSearchOptions): BrowseSearchState {
const debug = useDebugLogger('BrowseSearch')
const route = useRoute()

View File

@@ -1,8 +1,12 @@
import type { Labrinth } from '@modrinth/api-client'
import type { Ref } from 'vue'
import type { DeepReadonly, Ref } from 'vue'
import { createContext } from '.'
export const PROJECT_DEP_MARKER_QUERY = { dep: '1' } as const
export type CdnDownloadReason = 'standalone' | 'dependency'
export interface ProjectPageContext {
// Data refs
projectV2: Ref<Labrinth.Projects.v2.Project>
@@ -17,6 +21,8 @@ export interface ProjectPageContext {
dependencies: Ref<Labrinth.Projects.v2.DependencyInfo | null>
dependenciesLoading: Ref<boolean>
cdnDownloadReason: DeepReadonly<Ref<CdnDownloadReason>>
// Invalidate all project queries (auto-refetches active ones)
invalidate: () => Promise<void>

View File

@@ -59,6 +59,14 @@ export type FilterValue = {
negative?: boolean
}
export const LOADER_FILTER_TYPES = [
'mod_loader',
'plugin_loader',
'modpack_loader',
'shader_loader',
'plugin_platform',
] as const
export interface GameVersion {
version: string
version_type: 'release' | 'snapshot' | 'alpha' | 'beta'