Skip to content

Commit

Permalink
fix: Curseforge/Modrinth history is missing when first open & Windows…
Browse files Browse the repository at this point in the history
… should be focus when it try to route to another page
  • Loading branch information
ci010 committed Jun 11, 2023
1 parent 915ec60 commit c4bd49e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xmcl-keystone-ui/src/windows/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,19 @@ app.$mount('#app')
const params = window.location.search.substring(1)
if (params.startsWith('route=')) {
const route = params.substring('route='.length)
const base = '/' + route.split('/')[1]
router.replace(base)
if (route !== base) {
const split = route.split('/')
if (split.length > 2) {
const base = split.slice(0, split.length - 1).join('/')
router.push(base)
router.push(route)
} else {
router.push(route)
}
}

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

0 comments on commit c4bd49e

Please sign in to comment.