diff --git a/komga-webui/src/components/PageHashMatchesTable.vue b/komga-webui/src/components/PageHashMatchesTable.vue
index 8744b325..9536a6e9 100644
--- a/komga-webui/src/components/PageHashMatchesTable.vue
+++ b/komga-webui/src/components/PageHashMatchesTable.vue
@@ -22,8 +22,18 @@
/>
+
+
+ mdi-trash-can-outline
+
+
+
-
+
mdi-refresh
@@ -33,7 +43,7 @@
diff --git a/komga-webui/src/services/komga-pagehashes.service.ts b/komga-webui/src/services/komga-pagehashes.service.ts
index fc1cdc81..4f6b0a1e 100644
--- a/komga-webui/src/services/komga-pagehashes.service.ts
+++ b/komga-webui/src/services/komga-pagehashes.service.ts
@@ -82,18 +82,37 @@ export default class KomgaPageHashesService {
}
}
- async deleteAllMatches(pageHash: PageHashKnownDto) {
+ async deleteAllMatches(pageHash: PageHashDto) {
try {
const params = {
media_type: pageHash.mediaType,
file_size: pageHash.size || -1,
}
- await this.http.post(`${API_PAGE_HASH}/${pageHash.hash}/delete-all`, pageHash, {
+ await this.http.post(`${API_PAGE_HASH}/${pageHash.hash}/delete-all`, null, {
params: params,
paramsSerializer: params => qs.stringify(params, {indices: false}),
})
} catch (e) {
- let msg = `An error occurred while trying to execute perform-delete on page hash ${pageHash}`
+ let msg = `An error occurred while trying to execute delete all matches on page hash ${pageHash}`
+ if (e.response.data.message) {
+ msg += `: ${e.response.data.message}`
+ }
+ throw new Error(msg)
+ }
+ }
+
+ async deleteSingleMatch(pageHash: PageHashDto, match: PageHashMatchDto) {
+ try {
+ const params = {
+ media_type: pageHash.mediaType,
+ file_size: pageHash.size || -1,
+ }
+ await this.http.post(`${API_PAGE_HASH}/${pageHash.hash}/delete-match`, match, {
+ params: params,
+ paramsSerializer: params => qs.stringify(params, {indices: false}),
+ })
+ } catch (e) {
+ let msg = `An error occurred while trying to execute delete single match on page hash ${pageHash}`
if (e.response.data.message) {
msg += `: ${e.response.data.message}`
}
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 1eb3c0e3..39a537d7 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
@@ -146,4 +146,31 @@ class PageHashController(
toRemove.forEach { taskReceiver.removeDuplicatePages(it.key, it.value) }
}
+
+ @PostMapping("{pageHash}/delete-match")
+ @ResponseStatus(HttpStatus.ACCEPTED)
+ fun deleteSingleMatch(
+ @PathVariable pageHash: String,
+ @RequestParam("media_type") mediaType: String,
+ @RequestParam("file_size") size: Long,
+ @RequestBody matchDto: PageHashMatchDto,
+ ) {
+ val hash = pageHashRepository.findKnown(PageHash(pageHash, mediaType, size))
+ ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
+
+ val toRemove = Pair(
+ matchDto.bookId,
+ listOf(
+ BookPageNumbered(
+ fileName = matchDto.fileName,
+ mediaType = hash.mediaType,
+ fileHash = hash.hash,
+ fileSize = hash.size,
+ pageNumber = matchDto.pageNumber,
+ ),
+ ),
+ )
+
+ taskReceiver.removeDuplicatePages(toRemove.first, toRemove.second)
+ }
}