mirror of
https://github.com/gotson/komga.git
synced 2025-12-19 06:53:55 +01:00
parent
4f79fbf0d2
commit
d168c0a7ac
2 changed files with 20 additions and 16 deletions
|
|
@ -32,18 +32,22 @@ function locationsToR2Location(location: Locations): R2Location {
|
|||
}
|
||||
}
|
||||
|
||||
export function r2ProgressionToReadingPosition(progression: R2Progression): ReadingPosition {
|
||||
return {
|
||||
created: progression.modified,
|
||||
href: progression.locator.href,
|
||||
type: progression.locator.type,
|
||||
title: progression.locator.title,
|
||||
locations: {
|
||||
fragment: progression.locator.locations.fragment ? progression.locator.locations.fragment[0] : undefined,
|
||||
position: progression.locator.locations.position,
|
||||
progression: progression.locator.locations.progression,
|
||||
totalProgression: progression.locator.locations.totalProgression,
|
||||
},
|
||||
text: progression.locator.text,
|
||||
export function r2ProgressionToReadingPosition(progression?: R2Progression): ReadingPosition | undefined {
|
||||
try {
|
||||
return {
|
||||
created: progression.modified,
|
||||
href: progression.locator.href,
|
||||
type: progression.locator.type,
|
||||
title: progression.locator.title,
|
||||
locations: {
|
||||
fragment: progression.locator.locations.fragment ? progression.locator.locations.fragment[0] : undefined,
|
||||
position: progression.locator.locations.position,
|
||||
progression: progression.locator.locations.progression,
|
||||
totalProgression: progression.locator.locations.totalProgression,
|
||||
},
|
||||
text: progression.locator.text,
|
||||
}
|
||||
} catch (e) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import D2Reader, {Locator} from '@d-i-t-a/reader'
|
||||
import D2Reader, {Locator, ReadingPosition} from '@d-i-t-a/reader'
|
||||
import {bookManifestUrl, bookPositionsUrl} from '@/functions/urls'
|
||||
import {BookDto} from '@/types/komga-books'
|
||||
import {getBookTitleCompact} from '@/functions/book-title'
|
||||
|
|
@ -699,8 +699,8 @@ export default Vue.extend({
|
|||
this.book = await this.$komgaBooks.getBook(bookId)
|
||||
this.series = await this.$komgaSeries.getOneSeries(this.book.seriesId)
|
||||
|
||||
let initialLocation = await this.$komgaBooks.getProgression(bookId)
|
||||
if (initialLocation) initialLocation = r2ProgressionToReadingPosition(initialLocation)
|
||||
const progression = await this.$komgaBooks.getProgression(bookId)
|
||||
const initialLocation = r2ProgressionToReadingPosition(progression)
|
||||
|
||||
// parse query params to get context and contextId
|
||||
if (this.$route.query.contextId && this.$route.query.context
|
||||
|
|
|
|||
Loading…
Reference in a new issue