Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/app-frontend/src/providers/content-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ export function createContentInstall(opts: {
project_id: project.id,
version_id: version,
title: project.title,
icon_url: project.icon_url,
icon_url: project.raw_icon_url,
})
const instanceId = installJobInstanceId(job)
if (instanceId) {
Expand Down Expand Up @@ -985,7 +985,7 @@ export function createContentInstall(opts: {
project_id: project.id,
version_id: version,
title: project.title,
icon_url: project.icon_url,
icon_url: project.raw_icon_url,
})
const instanceId = installJobInstanceId(job)
if (instanceId) {
Expand Down
4 changes: 2 additions & 2 deletions apps/app-frontend/src/providers/server-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function createServerInstall(opts: {
gameVersion,
loader: 'vanilla',
loaderVersion: null,
iconPath: project.icon_url ?? null,
iconPath: project.raw_icon_url ?? null,
link: {
type: 'server_project',
project_id: project.id,
Expand Down Expand Up @@ -248,7 +248,7 @@ export function createServerInstall(opts: {
project_id: contentProjectId,
version_id: contentVersionId,
title: project.title,
icon_url: project.icon_url,
icon_url: project.raw_icon_url,
},
{
name: project.title,
Expand Down
25 changes: 10 additions & 15 deletions apps/app-frontend/src/providers/setup/creation-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type UnknownPackWarningModal from '@/components/ui/install_flow/UnknownPa
import type ModpackAlreadyInstalledModal from '@/components/ui/modal/ModpackAlreadyInstalledModal.vue'
import { useAppSettings } from '@/composables/use-app-settings.ts'
import { trackEvent } from '@/helpers/analytics'
import { get_search_results } from '@/helpers/cache.js'
import { get_project, get_search_results } from '@/helpers/cache.js'
import { import_instance } from '@/helpers/import.js'
import {
type CreatePackLocation,
Expand Down Expand Up @@ -66,18 +66,14 @@ export function setupCreationModal(
}
}

async function proceedWithModpackCreation(
projectId: string,
versionId: string,
name: string,
iconUrl?: string,
) {
async function proceedWithModpackCreation(projectId: string, versionId: string, name: string) {
const project = await get_project(projectId, 'bypass')
const job = await install_create_modpack_instance({
type: 'fromVersionId',
project_id: projectId,
version_id: versionId,
title: name,
icon_url: iconUrl,
icon_url: project.raw_icon_url,
})
await navigateToCreatedInstance(job)
trackEvent('InstanceCreate', { source: 'CreationModalModpack' })
Expand All @@ -92,13 +88,13 @@ export function setupCreationModal(
async function handleCreate(config: CreationFlowContextValue) {
try {
if (config.modpackSelection.value) {
const { projectId, versionId, name, iconUrl } = config.modpackSelection.value
const { projectId, versionId, name } = config.modpackSelection.value

const instances = await list().catch(handleError)
const existingInstance = instances?.find((i) => i.link?.project_id === projectId)

if (existingInstance && !appSettings.getFeatureFlag('skip_non_essential_warnings')) {
pendingModpackCreation.value = { projectId, versionId, name, iconUrl }
pendingModpackCreation.value = { projectId, versionId, name }
installationModal.value?.hide()
modpackAlreadyInstalledModal.value?.show(existingInstance.name, existingInstance.id)
return
Expand Down Expand Up @@ -131,8 +127,8 @@ export function setupCreationModal(
}

if (config.modpackSelection.value) {
const { projectId, versionId, name, iconUrl } = config.modpackSelection.value
await proceedWithModpackCreation(projectId, versionId, name, iconUrl)
const { projectId, versionId, name } = config.modpackSelection.value
await proceedWithModpackCreation(projectId, versionId, name)
return
}

Expand Down Expand Up @@ -195,15 +191,14 @@ export function setupCreationModal(
projectId: string
versionId: string
name: string
iconUrl?: string
} | null>(null)

async function handleModpackDuplicateCreateAnyway() {
if (!pendingModpackCreation.value) return
const { projectId, versionId, name, iconUrl } = pendingModpackCreation.value
const { projectId, versionId, name } = pendingModpackCreation.value
pendingModpackCreation.value = null
try {
await proceedWithModpackCreation(projectId, versionId, name, iconUrl)
await proceedWithModpackCreation(projectId, versionId, name)
} catch (error) {
handleError(error as Error)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/src/api/instance/shared/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ pub(super) async fn shared_instance_install_modpack(
.as_ref()
.map(|project| project.title.clone())
.unwrap_or(modpack_version.name),
icon_url: project.and_then(|project| project.icon_url),
icon_url: project.and_then(|project| project.raw_icon_url),
}))
}

Expand Down
2 changes: 2 additions & 0 deletions packages/app-lib/src/state/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ pub struct Project {
pub versions: Vec<String>,

pub icon_url: Option<String>,
#[serde(default)]
pub raw_icon_url: Option<String>,

pub issues_url: Option<String>,
pub source_url: Option<String>,
Expand Down
Loading