Skip to content

Commit

Permalink
fix: Curseforge and modrinth window router is replaced when the mod i…
Browse files Browse the repository at this point in the history
…s open from main frame
  • Loading branch information
ci010 committed May 27, 2023
1 parent 66d6f86 commit cc33ab3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
28 changes: 14 additions & 14 deletions xmcl-keystone-ui/src/views/ModAddResourceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@
folder
</v-icon>
</v-btn>
<v-avatar
<v-btn
v-if="r.metadata.modrinth"
size="30px"
icon
text
@click="goModrinthProject(r.metadata.modrinth.projectId)"
>
<v-icon
size="26"
>
<v-icon>
$vuetify.icons.modrinth
</v-icon>
</v-avatar>
<v-avatar
</v-btn>
<v-btn
v-if="r.metadata.curseforge"
size="30px"
icon
text
@click="goCurseforgeProject(r.metadata.curseforge.projectId, 'mc-mods')"
>
<v-icon
size="26"
>
<v-icon>
$vuetify.icons.curseforge
</v-icon>
</v-avatar>
</v-btn>
<v-avatar
v-if="forge"
size="30px"
Expand Down Expand Up @@ -152,7 +152,7 @@
import { useService } from '@/composables'
import { getCompatibleIcon } from '@/composables/compatibleIcon'
import { kModsContext } from '@/composables/mod'
import { useModCompatibleTooltip } from '@/composables/modCompatibleTooltip'
import { kMarketRoute } from '@/composables/useMarketRoute'
import { injection } from '@/util/inject'
import { getModsCompatiblity } from '@/util/modCompatible'
import { getModDependencies } from '@/util/modDependencies'
Expand Down Expand Up @@ -184,7 +184,7 @@ const showFile = (r: Resource) => {
}
const { runtime } = injection(kModsContext)
const { goCurseforgeProject, goModrinthProject } = injection(kMarketRoute)
const deps = computed(() => props.resources.map(getModDependencies).map(d => getModsCompatiblity(d, runtime.value)))
const coreDeps = computed(() => deps.value.map(v => v.filter(d => d.modId === 'minecraft' || d.modId === 'forge' || d.modId === 'fabric' || d.modId === 'quilt' || d.modId === 'fabricloader')))
Expand Down
8 changes: 6 additions & 2 deletions xmcl-keystone-ui/src/windows/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ app.$mount('#app')
const params = window.location.search.substring(1)
if (params.startsWith('route=')) {
const route = params.substring('route='.length)
router.replace(route)
const base = '/' + route.split('/')[1]
router.replace(base)
if (route !== base) {
router.push(route)
}
}

window.addEventListener('message', (e) => {
if (e.data.route) {
router.replace(e.data.route)
router.push(e.data.route)
}
})

0 comments on commit cc33ab3

Please sign in to comment.