feat(webui): ability to read incognito

This commit is contained in:
Gauthier Roebroeck 2021-04-26 16:48:57 +08:00
parent 8549c69166
commit dc0cc13807
3 changed files with 42 additions and 4 deletions

View file

@ -95,7 +95,8 @@
"show_hide_toolbars": "Show/hide toolbars",
"vertical": "Vertical",
"webtoon": "Webtoon"
}
},
"tooltip_incognito": "Read progress will not be saved"
},
"browse_book": {
"comment": "COMMENT",

View file

@ -20,6 +20,13 @@
<v-toolbar-title> {{ bookTitle }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-tooltip bottom v-if="incognito">
<template v-slot:activator="{ on }">
<v-icon v-on="on">mdi-incognito</v-icon>
</template>
<span>{{ $t('bookreader.tooltip_incognito') }}</span>
</v-tooltip>
<v-btn
icon
@click="showHelp = !showHelp">
@ -324,6 +331,7 @@ export default Vue.extend({
series: {} as SeriesDto,
context: {} as Context,
contextName: '',
incognito: false,
siblingPrevious: {} as BookDto,
siblingNext: {} as BookDto,
jumpToNextBook: false,
@ -587,6 +595,9 @@ export default Vue.extend({
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
}
// parse query params to get incognito mode
this.incognito = !!(this.$route.query.incognito && this.$route.query.incognito.toString().toLowerCase() === 'true');
const pageDtos = (await this.$komgaBooks.getBookPages(bookId))
pageDtos.forEach((p: any) => p['url'] = this.getPageUrl(p))
this.pages = pageDtos as PageDtoWithUrl[]
@ -654,7 +665,7 @@ export default Vue.extend({
this.$router.push({
name: 'read-book',
params: {bookId: this.siblingPrevious.id.toString()},
query: {context: this.context.origin, contextId: this.context.id},
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
})
}
},
@ -666,7 +677,7 @@ export default Vue.extend({
this.$router.push({
name: 'read-book',
params: {bookId: this.siblingNext.id.toString()},
query: {context: this.context.origin, contextId: this.context.id},
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
})
}
},
@ -688,6 +699,7 @@ export default Vue.extend({
page: this.page.toString(),
context: this.context.origin,
contextId: this.context.id,
incognito: this.incognito.toString(),
},
} as Location)
},
@ -771,7 +783,8 @@ export default Vue.extend({
this.notification.enabled = true
},
async markProgress(page: number) {
await this.$komgaBooks.updateReadProgress(this.bookId, {page: page})
if (!this.incognito)
await this.$komgaBooks.updateReadProgress(this.bookId, {page: page})
},
downloadCurrentPage() {
new jsFileDownloader({

View file

@ -122,6 +122,18 @@
{{ $t('common.read') }}
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn small
:title="$t('browse_book.read_book')"
:to="{name: 'read-book', params: { bookId: bookId}, query: { context: context.origin, contextId: context.id, incognito: true}}"
:disabled="book.media.status !== 'READY' || !canReadPages"
>
<v-icon left small>mdi-incognito</v-icon>
{{ $t('common.read') }}
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn :title="$t('browse_book.download_file')"
small
@ -155,6 +167,18 @@
{{ $t('common.read') }}
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn small
:title="$t('browse_book.read_book')"
:to="{name: 'read-book', params: { bookId: bookId}, query: { context: context.origin, contextId: context.id, incognito: true}}"
:disabled="book.media.status !== 'READY' || !canReadPages"
>
<v-icon left small>mdi-incognito</v-icon>
{{ $t('common.read') }}
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn :title="$t('browse_book.download_file')"
small