Skip to content

Commit

Permalink
fix: Modrinth project search with wrong type
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Oct 13, 2023
1 parent f2a65f4 commit 60ae2e7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion xmcl-keystone-ui/src/composables/modContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function useModItemContextMenuItems(modFile: Ref<ModFile | undefined>, on
items.push({
text: t('mod.searchOnModrinth', { name: file.name }),
onClick: () => {
searchInModrinth(file.name)
searchInModrinth(file.name, 'mod')
},
icon: 'search',
})
Expand Down
4 changes: 2 additions & 2 deletions xmcl-keystone-ui/src/composables/useMarketRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export function useMarketRoute() {
function searchInCurseforge(name: string, type: ProjectType) {
goToCurseforge(`/curseforge/${type}?keyword=${name}`)
}
function searchInModrinth(name: string) {
goToModrinth(`/modrinth?query=${name}`)
function searchInModrinth(name: string, type: 'mod' | 'modpack' | 'resourcepack' | 'shader') {
goToModrinth(`/modrinth?query=${name}&projectType=${type}`)
}
function goCurseforgeProject(projectId: number, type: ProjectType) {
goToCurseforge(`/curseforge/${type}/${projectId}`)
Expand Down
2 changes: 1 addition & 1 deletion xmcl-keystone-ui/src/views/ResourcePackCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const contextMenuItems = computed(() => {
menuItems.push({
text: t('resourcepack.searchOnModrinth', { name: props.pack.name }),
onClick: () => {
searchInModrinth(props.pack.name)
searchInModrinth(props.pack.name, 'resourcepack')
},
icon: 'search',
})
Expand Down
6 changes: 3 additions & 3 deletions xmcl-keystone-ui/src/windows/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ app.$mount('#app')

const params = window.location.search.substring(1)
if (params.startsWith('route=')) {
const route = params.substring('route='.length)
const route = decodeURIComponent(params.substring('route='.length))
const split = route.split('/')
if (split.length > 2) {
const base = split.slice(0, split.length - 1).join('/')
router.push(base)
router.replace(base)
router.push(route)
} else {
router.push(route)
router.replace(route)
}
}

Expand Down
1 change: 1 addition & 0 deletions xmcl-keystone-ui/src/windows/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Vue from 'vue'
Vue.use(Router)

export const router = new Router({
mode: 'history',
routes: [
{
path: '/curseforge/:type',
Expand Down

0 comments on commit 60ae2e7

Please sign in to comment.