diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteDonationCard.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteDonationCard.vue index 95a4460..137f397 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteDonationCard.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteDonationCard.vue @@ -3,7 +3,10 @@ import { HeartIcon, SpinnerIcon } from '@modrinth/assets' import { defineMessages, useVIntl } from '@modrinth/ui' import { onMounted, ref } from 'vue' -import { type SkinSiteDonationSummary, skinSiteDonationSummary } from '@/helpers/skin-site-api' +import { + type SkinSitePublicDonationSummary, + skinSitePublicDonationSummary, +} from '@/helpers/skin-site-api' const { formatMessage } = useVIntl() @@ -18,13 +21,13 @@ const messages = defineMessages({ loading: { id: 'app.skin-site.home.donation.loading', defaultMessage: 'Loading…' }, }) -const summary = ref(null) +const summary = ref(null) const loading = ref(true) const failed = ref(false) onMounted(async () => { try { - const result = await skinSiteDonationSummary() + const result = await skinSitePublicDonationSummary() if (result.success) summary.value = result.payload else failed.value = true } catch { diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteDownloadsView.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteDownloadsView.vue index 7c22e2f..3e65ff9 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteDownloadsView.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteDownloadsView.vue @@ -4,11 +4,11 @@ import { defineMessages, injectNotificationManager, useVIntl } from '@modrinth/u import { computed, onMounted, ref } from 'vue' import { - skinSiteDownloadCategories, - type SkinSiteDownloadCategory, - type SkinSiteDownloadItem, - skinSiteDownloadList, - type SkinSiteDownloadStatus, + skinSitePublicDownloadCategories, + type SkinSitePublicDownloadCategory, + type SkinSitePublicDownloadItem, + skinSitePublicDownloadList, + type SkinSitePublicDownloadStatus, } from '@/helpers/skin-site-api' const { formatMessage } = useVIntl() @@ -36,8 +36,8 @@ const messages = defineMessages({ const emit = defineEmits<{ (e: 'back'): void }>() -const items = ref([]) -const categories = ref([]) +const items = ref([]) +const categories = ref([]) const selectedCategory = ref(null) const loading = ref(true) const failed = ref(false) @@ -48,7 +48,7 @@ const filtered = computed(() => : items.value, ) -function statusLabel(status: SkinSiteDownloadStatus): string { +function statusLabel(status: SkinSitePublicDownloadStatus): string { switch (status) { case 'NEW': return formatMessage(messages.statusNew) @@ -68,7 +68,7 @@ async function openUrl(url: string) { await open(url) } -function download(item: SkinSiteDownloadItem) { +function download(item: SkinSitePublicDownloadItem) { const route = item.routes?.[0] void openUrl(route?.url ?? item.url) } @@ -78,8 +78,8 @@ async function load() { failed.value = false try { const [listResult, categoryResult] = await Promise.all([ - skinSiteDownloadList(), - skinSiteDownloadCategories(), + skinSitePublicDownloadList(), + skinSitePublicDownloadCategories(), ]) if (!listResult.success) throw new Error(listResult.errorMessage) items.value = listResult.payload ?? [] diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue index 77fe917..5e1fd17 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue @@ -3,7 +3,7 @@ import { ExternalIcon, SpinnerIcon } from '@modrinth/assets' import { defineMessages, injectNotificationManager, useVIntl } from '@modrinth/ui' import { computed, onMounted, ref, watch } from 'vue' -import { type SkinSiteMapServer, skinSiteMapServers } from '@/helpers/skin-site-api' +import { type SkinSitePublicMapServer, skinSitePublicMapServers } from '@/helpers/skin-site-api' const { formatMessage } = useVIntl() const { handleError } = injectNotificationManager() @@ -23,7 +23,7 @@ const messages = defineMessages({ const emit = defineEmits<{ (e: 'back'): void }>() -const servers = ref([]) +const servers = ref([]) const internal = ref(false) const serverIndex = ref(0) const mapIndex = ref(0) @@ -52,7 +52,7 @@ async function load() { loading.value = true failed.value = false try { - const result = await skinSiteMapServers() + const result = await skinSitePublicMapServers() if (!result.success) throw new Error(result.errorMessage) servers.value = result.payload ?? [] if (!servers.value.some((s) => !s.internal)) internal.value = true diff --git a/apps/app-frontend/src/helpers/skin-site-api.ts b/apps/app-frontend/src/helpers/skin-site-api.ts index a9f1b9e..21fd358 100644 --- a/apps/app-frontend/src/helpers/skin-site-api.ts +++ b/apps/app-frontend/src/helpers/skin-site-api.ts @@ -389,12 +389,12 @@ export function skinSitePasswordReset(payload: { // Donations & announcements // --------------------------------------------------------------------------- -export interface SkinSiteDonationSummary { +export interface SkinSitePublicDonationSummary { totalAmount: string donorCount: number } -export interface SkinSiteDonationEntry { +export interface SkinSitePublicDonationEntry { id: number rank: number username: string @@ -402,14 +402,16 @@ export interface SkinSiteDonationEntry { amount: string } -export interface SkinSiteDonationPage { - items: SkinSiteDonationEntry[] - summary: SkinSiteDonationSummary +export interface SkinSitePublicDonationPage { + items: SkinSitePublicDonationEntry[] + summary: SkinSitePublicDonationSummary hasMore: boolean } -export function skinSiteDonationSummary(): Promise> { - return skinSiteRequest('donation/summary', { auth: false }) +export function skinSitePublicDonationSummary(): Promise< + SkinSiteResponse +> { + return skinSiteRequest('donation/summary', { auth: false }) } export function skinSiteDonationList(offset = 0): Promise> { @@ -487,71 +489,73 @@ export async function skinSiteUploadAvatar(blob: Blob): Promise> { +}): Promise> { const query = new URLSearchParams({ limit: String(options?.limit ?? 200), offset: String(options?.offset ?? 0), }) if (options?.category) query.set('category', options.category) - return skinSiteRequest(`download/list?${query.toString()}`, { + return skinSiteRequest(`download/list?${query.toString()}`, { auth: false, }) } -export function skinSiteDownloadCount(category?: string): Promise> { +export function skinSitePublicDownloadCount(category?: string): Promise> { const suffix = category ? `?category=${encodeURIComponent(category)}` : '' return skinSiteRequest(`download/count${suffix}`, { auth: false }) } -export function skinSiteDownloadCategories(): Promise< - SkinSiteResponse +export function skinSitePublicDownloadCategories(): Promise< + SkinSiteResponse > { - return skinSiteRequest('download/category/list', { auth: false }) + return skinSiteRequest('download/category/list', { + auth: false, + }) } // --------------------------------------------------------------------------- // Maps // --------------------------------------------------------------------------- -export interface SkinSiteMapEntry { +export interface SkinSitePublicMapEntry { name: string url: string } -export interface SkinSiteMapServer { +export interface SkinSitePublicMapServer { name: string internal: boolean - maps: SkinSiteMapEntry[] + maps: SkinSitePublicMapEntry[] } -export function skinSiteMapServers(): Promise> { - return skinSiteRequest('maps', { auth: false }) +export function skinSitePublicMapServers(): Promise> { + return skinSiteRequest('maps', { auth: false }) } // --------------------------------------------------------------------------- // Player review (public side) @@ -1033,7 +1037,6 @@ export function skinSiteAdminUserFrequencyLimit( ) } -export type SkinSiteReviewResult = 'PENDING' | 'PASSED' | 'REJECTED' export type SkinSiteReviewMode = 'AUTO' | 'MANUAL' export interface SkinSiteReviewAnswer {