mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
feat(webui): display KEPUB as book format for kepub files
This commit is contained in:
parent
0fd783c9cd
commit
12e243683f
5 changed files with 11 additions and 10 deletions
|
|
@ -69,7 +69,7 @@
|
|||
import Vue, {PropType} from 'vue'
|
||||
import {TransientBookDto} from '@/types/komga-transientbooks'
|
||||
import {BookDto, PageDto} from '@/types/komga-books'
|
||||
import {getBookFormatFromMediaType} from '@/functions/book-format'
|
||||
import {getBookFormatFromMedia} from '@/functions/book-format'
|
||||
import PagesTable from '@/components/PagesTable.vue'
|
||||
|
||||
export default Vue.extend({
|
||||
|
|
@ -78,7 +78,7 @@ export default Vue.extend({
|
|||
data: () => {
|
||||
return {
|
||||
modal: false,
|
||||
getBookFormatFromMediaType,
|
||||
getBookFormatFromMediaType: getBookFormatFromMedia,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import {BookFormat, MediaDto} from '@/types/komga-books'
|
||||
import {lowerCase} from 'lodash'
|
||||
|
||||
export function getBookFormatFromMediaType(mediaType: string): BookFormat {
|
||||
switch (mediaType) {
|
||||
export function getBookFormatFromMedia(media: MediaDto): BookFormat {
|
||||
switch (media.mediaType) {
|
||||
case 'application/x-rar-compressed':
|
||||
case 'application/x-rar-compressed; version=4':
|
||||
return {type: 'CBR', color: '#03A9F4'}
|
||||
|
|
@ -11,11 +11,11 @@ export function getBookFormatFromMediaType(mediaType: string): BookFormat {
|
|||
case 'application/pdf':
|
||||
return {type: 'PDF', color: '#FF5722'}
|
||||
case 'application/epub+zip':
|
||||
return {type: 'EPUB', color: '#ff5ab1'}
|
||||
return media.epubIsKepub ? {type: 'KEPUB', color: '#ff5ab1'} : {type: 'EPUB', color: '#ff5ab1'}
|
||||
case 'application/x-rar-compressed; version=5':
|
||||
return {type: 'RAR5', color: '#000000'}
|
||||
default:
|
||||
return {type: mediaType, color: '#000000'}
|
||||
return {type: media.mediaType, color: '#000000'}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export interface MediaDto {
|
|||
comment: string,
|
||||
mediaProfile: string,
|
||||
epubDivinaCompatible: boolean,
|
||||
epubIsKepub: boolean,
|
||||
}
|
||||
|
||||
export interface PageDto {
|
||||
|
|
|
|||
|
|
@ -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, getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||
import {getBookFormatFromMedia, 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'
|
||||
|
|
@ -509,7 +509,7 @@ export default Vue.extend({
|
|||
return bookFileUrl(this.bookId)
|
||||
},
|
||||
format(): BookFormat {
|
||||
return getBookFormatFromMediaType(this.book.media.mediaType)
|
||||
return getBookFormatFromMedia(this.book.media)
|
||||
},
|
||||
authorsByRole(): any {
|
||||
return groupAuthorsByRole(this.book.metadata.authors)
|
||||
|
|
|
|||
|
|
@ -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, getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||
import {getBookFormatFromMedia, 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'
|
||||
|
|
@ -618,7 +618,7 @@ export default Vue.extend({
|
|||
return bookFileUrl(this.book.id)
|
||||
},
|
||||
format(): BookFormat {
|
||||
return getBookFormatFromMediaType(this.book.media.mediaType)
|
||||
return getBookFormatFromMedia(this.book.media)
|
||||
},
|
||||
authorsByRole(): any {
|
||||
return groupAuthorsByRole(this.book.metadata.authors)
|
||||
|
|
|
|||
Loading…
Reference in a new issue