Skip to content

Commit

Permalink
Merge branch 'online-reading'
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusa87 committed Aug 5, 2024
2 parents 56aafaa + c74b0a5 commit 78ad920
Show file tree
Hide file tree
Showing 12 changed files with 2,689 additions and 2,370 deletions.
38 changes: 38 additions & 0 deletions assets/ReadEbook.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<div id="area" style="width: 100vw; height: 100vh; min-height: 95vh;">
<vue-reader
:url="props.file"
:showToc="true"
:getRendition="getRendition"
backgroundColor="#000"
@update:location="locationChange"
:location="getInitialLocation()"
/>
</div>
</template>

<script setup>
const props = defineProps({'file': String})
import { VueReader } from 'vue-book-reader'
const initialCfi = new URLSearchParams(window.location.search).get('cfi');
const locationChange = (detail) => {
const { fraction } = detail
console.log('locationChange', fraction, detail)
history.pushState({fraction: fraction, }, document.title, "?cfi=" + encodeURIComponent(detail.cfi) + "#page="+ detail.location.current+"&percent=" + (fraction * 100).toFixed(2));
}
const getInitialLocation = () => {
return initialCfi ?? null
}
const getRendition = async (rendition) => {
rendition.renderer.setStyles([
`
html {
background: #000;
color: #fff;
}`,
])
}
</script>
7 changes: 7 additions & 0 deletions assets/read-ebook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createApp } from 'vue'
import ReadEBook from './ReadEbook.vue'

document.addEventListener('DOMContentLoaded', () => {
const file = document.getElementById('mount').getAttribute('data-file')
createApp(ReadEBook, {file: file}).mount('#mount');
});
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
target: base
command: ["/bin/sh", "-c" , "crontab /var/www/html/config/crontab.txt && apache2-foreground" ]
ports:
- "48480:8080"
- "48480:8080" # Web
- "48181:8181" # NPM
depends_on:
- db
volumes:
Expand All @@ -30,6 +31,11 @@ services:
- 'traefik.http.routers.biblioteca.middlewares=https_redirect'
- 'traefik.http.middlewares.https_redirect.redirectscheme.scheme=https'
- 'traefik.http.middlewares.https_redirect.redirectscheme.permanent=true'
- 'traefik.http.routers.npm.service=npm'
- 'traefik.http.routers.npm.entrypoints=https,http'
- 'traefik.http.routers.npm.rule=Host(`biblioteca-npm.docker.test`)'
- 'traefik.http.services.npm.loadbalancer.server.port=8181'


db:
image: mariadb:10.10
Expand Down
Loading

0 comments on commit 78ad920

Please sign in to comment.