From ca401f8b69bcd7ff0b8fb4a8ea78c12f3b9ee323 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Tue, 8 Feb 2022 12:20:32 +0800 Subject: [PATCH] refactor: change page-hash matches endpoint --- komga-webui/src/components/PageHashKnownCard.vue | 2 +- komga-webui/src/components/PageHashMatchesTable.vue | 2 +- komga-webui/src/services/komga-pagehashes.service.ts | 4 ++-- .../gotson/komga/interfaces/api/rest/PageHashController.kt | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/komga-webui/src/components/PageHashKnownCard.vue b/komga-webui/src/components/PageHashKnownCard.vue index 06b0e4eaf..2a89e7e8c 100644 --- a/komga-webui/src/components/PageHashKnownCard.vue +++ b/komga-webui/src/components/PageHashKnownCard.vue @@ -137,7 +137,7 @@ export default Vue.extend({ methods: { async getMatchCount() { if (this.hash?.action === PageHashAction.DELETE_MANUAL) - this.matchCount = (await this.$komgaPageHashes.getUnknownPageHashMatches(this.hash, {size: 0})).totalElements + this.matchCount = (await this.$komgaPageHashes.getPageHashMatches(this.hash, {size: 0})).totalElements else this.matchCount = undefined }, diff --git a/komga-webui/src/components/PageHashMatchesTable.vue b/komga-webui/src/components/PageHashMatchesTable.vue index 144e24020..8744b325b 100644 --- a/komga-webui/src/components/PageHashMatchesTable.vue +++ b/komga-webui/src/components/PageHashMatchesTable.vue @@ -89,7 +89,7 @@ export default Vue.extend({ pageRequest.sort!!.push(`${sortBy[i]},${sortDesc[i] ? 'desc' : 'asc'}`) } - const elementsPage = await this.$komgaPageHashes.getUnknownPageHashMatches(hash, pageRequest) + const elementsPage = await this.$komgaPageHashes.getPageHashMatches(hash, pageRequest) this.totalElements = elementsPage.totalElements this.elements = elementsPage.content diff --git a/komga-webui/src/services/komga-pagehashes.service.ts b/komga-webui/src/services/komga-pagehashes.service.ts index 1504cab32..45d55085f 100644 --- a/komga-webui/src/services/komga-pagehashes.service.ts +++ b/komga-webui/src/services/komga-pagehashes.service.ts @@ -50,14 +50,14 @@ export default class KomgaPageHashesService { } } - async getUnknownPageHashMatches(pageHash: PageHashDto, pageRequest?: PageRequest): Promise> { + async getPageHashMatches(pageHash: PageHashDto, pageRequest?: PageRequest): Promise> { try { const params = { ...pageRequest, media_type: pageHash.mediaType, file_size: pageHash.size || -1, } - return (await this.http.get(`${API_PAGE_HASH}/unknown/${pageHash.hash}`, { + return (await this.http.get(`${API_PAGE_HASH}/${pageHash.hash}`, { params: params, paramsSerializer: params => qs.stringify(params, {indices: false}), })).data diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/PageHashController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/PageHashController.kt index 546a49339..60f3e88e0 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/PageHashController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/PageHashController.kt @@ -70,9 +70,9 @@ class PageHashController( ): Page = pageHashRepository.findAllUnknown(page).map { it.toDto() } - @GetMapping("unknown/{pageHash}") + @GetMapping("{pageHash}") @PageableAsQueryParam - fun getUnknownPageHashMatches( + fun getPageHashMatches( @PathVariable pageHash: String, @RequestParam("media_type") mediaType: String, @RequestParam("file_size") size: Long,