Fix forge 1.15.2->1.16.5, Fabric 0.16.0+, and migration issues with Forge (#2232)

* Fix Forge versions, newer fabric, migration breakage

* lint

* fix lint
This commit is contained in:
Geometrically
2024-08-21 21:24:35 -07:00
committed by GitHub
parent 4d0407a3b3
commit 157c27c20d
11 changed files with 84 additions and 45 deletions

View File

@@ -122,7 +122,9 @@ const handleProjectClick = (event, passedInstance) => {
const handleOptionsClick = async (args) => {
switch (args.option) {
case 'play':
await run(args.item.path).catch(handleSevereError)
await run(args.item.path).catch((err) =>
handleSevereError(err, { profilePath: args.item.path }),
)
mixpanel_track('InstanceStart', {
loader: args.item.loader,
game_version: args.item.game_version,

View File

@@ -1,5 +1,5 @@
<script setup>
import { XIcon, IssuesIcon, LogInIcon, UpdatedIcon } from '@modrinth/assets'
import { XIcon, HammerIcon, LogInIcon, UpdatedIcon } from '@modrinth/assets'
import { Modal } from '@modrinth/ui'
import { ChatIcon } from '@/assets/icons'
import { ref } from 'vue'
@@ -8,6 +8,7 @@ import { handleError } from '@/store/notifications.js'
import mixpanel from 'mixpanel-browser'
import { handleSevereError } from '@/store/error.js'
import { cancel_directory_change } from '@/helpers/settings.js'
import { install } from '@/helpers/profile.js'
const errorModal = ref()
const error = ref()
@@ -19,7 +20,7 @@ const supportLink = ref('https://support.modrinth.com')
const metadata = ref({})
defineExpose({
async show(errorVal, canClose = true, source = null) {
async show(errorVal, context, canClose = true, source = null) {
closable.value = canClose
if (errorVal.message && errorVal.message.includes('Minecraft authentication error:')) {
@@ -53,6 +54,11 @@ defineExpose({
if (errorVal.message.includes('Not enough space')) {
metadata.value.notEnoughSpace = true
}
} else if (errorVal.message && errorVal.message.includes('No loader version selected for')) {
title.value = 'No loader selected'
errorType.value = 'no_loader_version'
supportLink.value = 'https://support.modrinth.com'
metadata.value.profilePath = context.profilePath
} else if (source === 'state_init') {
title.value = 'Error initializing Modrinth App'
errorType.value = 'state_init'
@@ -100,6 +106,18 @@ async function cancelDirectoryChange() {
function retryDirectoryChange() {
window.location.reload()
}
const loadingRepair = ref(false)
async function repairInstance() {
loadingRepair.value = true
try {
await install(metadata.value.profilePath, false)
errorModal.value.hide()
} catch (err) {
handleSevereError(err)
}
loadingRepair.value = false
}
</script>
<template>
@@ -216,6 +234,15 @@ function retryDirectoryChange() {
<li>Redownloading the app.</li>
</ul>
</template>
<template v-else-if="errorType === 'no_loader_version'">
<p>The Modrinth App failed to find the loader version for this instance.</p>
<p>To resolve this, you need to repair the instance. Click the button below to do so.</p>
<div class="cta-button">
<button class="btn btn-primary" :disabled="loadingRepair" @click="repairInstance">
<HammerIcon /> Repair instance
</button>
</div>
</template>
<template v-else>
{{ error.message ?? error }}
</template>
@@ -223,7 +250,8 @@ function retryDirectoryChange() {
v-if="
errorType === 'directory_move' ||
errorType === 'minecraft_auth' ||
errorType === 'state_init'
errorType === 'state_init' ||
errorType === 'no_loader_version'
"
>
<hr />

View File

@@ -40,7 +40,9 @@ const checkProcess = async () => {
const play = async (e, context) => {
e?.stopPropagation()
modLoading.value = true
await run(props.instance.path).catch(handleSevereError)
await run(props.instance.path).catch((err) =>
handleSevereError(err, { profilePath: props.instance.path }),
)
modLoading.value = false
mixpanel_track('InstancePlay', {