diff --git a/komga-webui/src/functions/book-format.ts b/komga-webui/src/functions/book-format.ts index 730f4d532..f01b31445 100644 --- a/komga-webui/src/functions/book-format.ts +++ b/komga-webui/src/functions/book-format.ts @@ -1,4 +1,4 @@ -import {BookFormat} from '@/types/komga-books' +import {BookFormat, MediaDto} from '@/types/komga-books' import {lowerCase} from 'lodash' export function getBookFormatFromMediaType(mediaType: string): BookFormat { @@ -19,10 +19,10 @@ export function getBookFormatFromMediaType(mediaType: string): BookFormat { } } -export function getBookReadRouteFromMediaProfile(mediaProfile: string): string { - switch (lowerCase(mediaProfile)) { +export function getBookReadRouteFromMedia(media: MediaDto): string { + switch (lowerCase(media.mediaProfile)) { case 'epub': - return 'read-epub' + return media.epubDivinaCompatible ? 'read-book' : 'read-epub' default: return 'read-book' } diff --git a/komga-webui/src/types/items.ts b/komga-webui/src/types/items.ts index bed08a1b1..f7cd1dda8 100644 --- a/komga-webui/src/types/items.ts +++ b/komga-webui/src/types/items.ts @@ -6,7 +6,7 @@ import i18n from '@/i18n' import {MediaStatus} from '@/types/enum-books' import {getFileSize} from '@/functions/file' import {ReadListDto} from '@/types/komga-readlists' -import {getBookReadRouteFromMediaProfile} from '@/functions/book-format' +import {getBookReadRouteFromMedia} from '@/functions/book-format' export enum ItemTypes { BOOK, SERIES, COLLECTION, READLIST @@ -170,7 +170,7 @@ export class BookItem extends Item { fabTo(): RawLocation { return { - name: getBookReadRouteFromMediaProfile(this.item?.media?.mediaProfile), + name: getBookReadRouteFromMedia(this.item?.media), params: {bookId: this.item.id}, query: {context: this.item?.context?.origin, contextId: this.item?.context?.id}, } diff --git a/komga-webui/src/types/komga-books.ts b/komga-webui/src/types/komga-books.ts index 21e7432a8..a7a4b3ce3 100644 --- a/komga-webui/src/types/komga-books.ts +++ b/komga-webui/src/types/komga-books.ts @@ -29,6 +29,7 @@ export interface MediaDto { pagesCount: number, comment: string, mediaProfile: string, + epubDivinaCompatible: boolean, } export interface PageDto { diff --git a/komga-webui/src/views/BrowseBook.vue b/komga-webui/src/views/BrowseBook.vue index 33aa5312d..e0c4c78a6 100644 --- a/komga-webui/src/views/BrowseBook.vue +++ b/komga-webui/src/views/BrowseBook.vue @@ -409,7 +409,7 @@ import BookActionsMenu from '@/components/menus/BookActionsMenu.vue' import ItemCard from '@/components/ItemCard.vue' import ToolbarSticky from '@/components/bars/ToolbarSticky.vue' import {groupAuthorsByRole} from '@/functions/authors' -import {getBookFormatFromMediaType, getBookReadRouteFromMediaProfile} from '@/functions/book-format' +import {getBookFormatFromMediaType, getBookReadRouteFromMedia} from '@/functions/book-format' import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress' import {getBookTitleCompact} from '@/functions/book-title' import {bookFileUrl, bookThumbnailUrl} from '@/functions/urls' @@ -488,7 +488,7 @@ export default Vue.extend({ }, computed: { readRouteName(): string { - return getBookReadRouteFromMediaProfile(this.book.media.mediaProfile) + return getBookReadRouteFromMedia(this.book.media) }, isAdmin(): boolean { return this.$store.getters.meAdmin diff --git a/komga-webui/src/views/BrowseOneshot.vue b/komga-webui/src/views/BrowseOneshot.vue index a8865d985..9d8a02d67 100644 --- a/komga-webui/src/views/BrowseOneshot.vue +++ b/komga-webui/src/views/BrowseOneshot.vue @@ -484,7 +484,7 @@ import BookActionsMenu from '@/components/menus/BookActionsMenu.vue' import ItemCard from '@/components/ItemCard.vue' import ToolbarSticky from '@/components/bars/ToolbarSticky.vue' import {groupAuthorsByRole} from '@/functions/authors' -import {getBookFormatFromMediaType, getBookReadRouteFromMediaProfile} from '@/functions/book-format' +import {getBookFormatFromMediaType, getBookReadRouteFromMedia} from '@/functions/book-format' import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress' import {getBookTitleCompact} from '@/functions/book-title' import {bookFileUrl, seriesThumbnailUrl} from '@/functions/urls' @@ -597,7 +597,7 @@ export default Vue.extend({ }, computed: { readRouteName(): string { - return getBookReadRouteFromMediaProfile(this.book.media.mediaProfile) + return getBookReadRouteFromMedia(this.book.media) }, isAdmin(): boolean { return this.$store.getters.meAdmin diff --git a/komga-webui/src/views/DivinaReader.vue b/komga-webui/src/views/DivinaReader.vue index 43859ce38..efea372cd 100644 --- a/komga-webui/src/views/DivinaReader.vue +++ b/komga-webui/src/views/DivinaReader.vue @@ -339,7 +339,7 @@ import {SeriesDto} from '@/types/komga-series' import jsFileDownloader from 'js-file-downloader' import screenfull from 'screenfull' import {ItemTypes} from '@/types/items' -import {getBookReadRouteFromMediaProfile} from '@/functions/book-format' +import {getBookReadRouteFromMedia} from '@/functions/book-format' export default Vue.extend({ name: 'DivinaReader', @@ -742,7 +742,7 @@ export default Vue.extend({ if (!this.$_.isEmpty(this.siblingPrevious)) { this.jumpToPreviousBook = false this.$router.push({ - name: getBookReadRouteFromMediaProfile(this.siblingPrevious.media.mediaProfile), + name: getBookReadRouteFromMedia(this.siblingPrevious.media), params: {bookId: this.siblingPrevious.id.toString()}, query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()}, }) @@ -754,7 +754,7 @@ export default Vue.extend({ } else { this.jumpToNextBook = false this.$router.push({ - name: getBookReadRouteFromMediaProfile(this.siblingNext.media.mediaProfile), + name: getBookReadRouteFromMedia(this.siblingNext.media), params: {bookId: this.siblingNext.id.toString()}, query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()}, }) diff --git a/komga-webui/src/views/EpubReader.vue b/komga-webui/src/views/EpubReader.vue index 5b528d33f..35c249e08 100644 --- a/komga-webui/src/views/EpubReader.vue +++ b/komga-webui/src/views/EpubReader.vue @@ -319,7 +319,7 @@ import { import {flattenToc} from '@/functions/toc' import ShortcutHelpDialog from '@/components/dialogs/ShortcutHelpDialog.vue' import screenfull from 'screenfull' -import {getBookReadRouteFromMediaProfile} from '@/functions/book-format' +import {getBookReadRouteFromMedia} from '@/functions/book-format' import SettingsSelect from '@/components/SettingsSelect.vue' import {createR2Progression, r2ProgressionToReadingPosition} from '@/functions/readium' import {debounce} from 'lodash' @@ -462,6 +462,9 @@ export default Vue.extend({ next() }, computed: { + isRtl(): boolean { + return this.effectiveDirection === 'rtl' + }, shortcuts(): any { const shortcuts = [...epubShortcutsSettings, ...epubShortcutsMenus] if (!this.fixedLayout) shortcuts.push(...epubShortcutsSettingsScroll) @@ -614,7 +617,7 @@ export default Vue.extend({ if (!this.$_.isEmpty(this.siblingPrevious)) { this.jumpToPreviousBook = false this.$router.push({ - name: getBookReadRouteFromMediaProfile(this.siblingPrevious.media.mediaProfile), + name: getBookReadRouteFromMedia(this.siblingPrevious.media), params: {bookId: this.siblingPrevious.id.toString()}, query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()}, }) @@ -626,7 +629,7 @@ export default Vue.extend({ } else { this.jumpToNextBook = false this.$router.push({ - name: getBookReadRouteFromMediaProfile(this.siblingNext.media.mediaProfile), + name: getBookReadRouteFromMedia(this.siblingNext.media), params: {bookId: this.siblingNext.id.toString()}, query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()}, }) @@ -686,8 +689,8 @@ export default Vue.extend({ } } else { if (this.settings.navigationClick) { - if (x < this.$vuetify.breakpoint.width / 4) return this.d2Reader.previousPage() - if (x > this.$vuetify.breakpoint.width * .75) return this.d2Reader.nextPage() + if (x < this.$vuetify.breakpoint.width / 4) return this.isRtl ? this.d2Reader.nextPage() : this.d2Reader.previousPage() + if (x > this.$vuetify.breakpoint.width * .75) return this.isRtl ? this.d2Reader.previousPage() : this.d2Reader.nextPage() } } this.toggleToolbars()