Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert epub #8

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ BOOK_FILE_NAMING_FORMAT="{serie}-{serieIndex}-{title}"
KOBO_PROXY_USE_DEV=0
KOBO_PROXY_USE_EVERYWHERE=0
KOBO_PROXY_ENABLED=1
###< kobo/proxy
###< kobo/proxy
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ TYPESENSE_KEY=xyz

# Disable the proxy for the test env
KOBO_PROXY_USE_EVERYWHERE=0
KOBO_PROXY_ENABLED=0
KOBO_PROXY_ENABLED=0
26 changes: 25 additions & 1 deletion .github/workflows/symfony.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ jobs:
php-version: '8.2'
- uses: actions/checkout@v3
- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
run: |
php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
echo "KEPUBIFY_BIN=/usr/local/bin/kepubify" >> .env.test.local
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
Expand All @@ -42,6 +44,28 @@ jobs:
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Cache kepubify
id: kepubify-cache-restore
uses: actions/cache@v3
with:
path: /usr/local/bin/kepubify
key: ${{ runner.os }}-kepubify-cache
- name: Install kepubify
if: steps.kepubify-cache-restore.outputs.cache-hit != 'true'
run: |
mkdir -p /usr/local/bin/
# Install kepubify (from https://github.com/linuxserver/docker-calibre-web/blob/master/Dockerfile)
KEPUBIFY_RELEASE=$(curl -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]');
curl -o /usr/local/bin/kepubify -L https://github.com/pgaskin/kepubify/releases/download/${KEPUBIFY_RELEASE}/kepubify-linux-64bit
chmod +x /usr/local/bin/kepubify
- name: Cache kepubify
uses: actions/cache/save@v4
if: steps.kepubify-cache-restore.outputs.cache-hit != 'true'
id: kepubify-cache-save
with:
path: /usr/local/bin/kepubify
key: ${{ runner.os }}-kepubify-cache

- name: Create Database
run: |
mkdir -p data
Expand Down
39 changes: 28 additions & 11 deletions assets/ReadEbook.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<template>
<div id="area" style="width: 100vw; height: 100vh; min-height: 95vh;">
<vue-reader
:url="props.file"
:showToc="true"
:getRendition="getRendition"
:backgroundColor="props.bgColor"
@update:location="locationChange"
:location="getInitialLocation()"
/>
<div class="flex">
<div class="area-back" v-if="canGoBack()" style="width: 10vw">
<button @click="goBack" class="arrow pre">
‹‹
</button>
</div>

<div id="area" :style="`width: ${canGoBack() ?80 : 100}vw; height: 100vh; min-height: 95vh;`">
<vue-reader
:url="props.file"
:showToc="true"
:getRendition="getRendition"
:backgroundColor="props.bgColor"
@update:location="locationChange"
:location="getInitialLocation()"
/>
</div>
</div>
</template>

Expand All @@ -17,11 +25,12 @@ const props = defineProps({
'css': String,
'bgColor': String,
'percent': String,
'progressionUrl': String
'progressionUrl': String,
'backUrl': { type: String, default: ''}
})
import { VueReader } from 'vue-book-reader'
const initialCfi = new URLSearchParams(window.location.search).get('cfi');

const initialReferrer = document.referrer
function debounce(func, delay) {
let timeoutId;
return function(...args) {
Expand Down Expand Up @@ -71,4 +80,12 @@ const getRendition = async (rendition) => {
rendition.renderer.setStyles([props.css])
}

const canGoBack = () => {
return initialReferrer !== "" || props.backUrl !== ""
}

const goBack = (e) => {
e.preventDefault()
window.location.href = props.backUrl ?? initialReferrer;
}
</script>
6 changes: 4 additions & 2 deletions assets/read-ebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ document.addEventListener('DOMContentLoaded', () => {
const css = document.getElementById(mountId).getAttribute('data-css')
const bgColor = document.getElementById(mountId).getAttribute('data-background-color')
const percent = document.getElementById(mountId).getAttribute('data-percent')
const progressionUrl = document.getElementById(mountId).getAttribute('data-progressionUrl')
const progressionUrl = document.getElementById(mountId).getAttribute('data-progression-url')
const backUrl = document.getElementById(mountId).getAttribute('data-back-url')
createApp(ReadEBook, {
file: file,
css: css,
bgColor: bgColor,
percent: percent,
progressionUrl: progressionUrl
progressionUrl: progressionUrl,
backUrl: backUrl
}).mount(`#${mountId}`);
});
7 changes: 7 additions & 0 deletions assets/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ body.bg-darker{

#vue-book-reader{
width: 100%;
.flex{
display: flex;
button{
display: block;
}
}

}

/*
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
"symfony/form": "^7.1",
"symfony/framework-bundle": "^6.2",
"symfony/http-client": "^6.2",
"symfony/intl": "^6.2",
"symfony/intl": "^7.1",
"symfony/mailer": "^6.2",
"symfony/messenger": "^6.2",
"symfony/mime": "^7.1",
"symfony/monolog-bundle": "^3.0",
"symfony/notifier": "^7.1",
"symfony/process": "^6.2",
"symfony/property-access": "^6.2",
"symfony/property-info": "^7.1",
"symfony/psr-http-message-bridge": "^6.2",
"symfony/psr-http-message-bridge": "^7.1",
"symfony/runtime": "^6.2",
"symfony/security-bundle": "^6.2",
"symfony/serializer": "^6.2",
Expand All @@ -65,7 +66,7 @@
"symfony/validator": "^6.2",
"symfony/web-link": "^6.2",
"symfony/webpack-encore-bundle": "^2.0",
"symfony/yaml": "^6.2",
"symfony/yaml": "^7.1",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
Expand Down Expand Up @@ -172,10 +173,10 @@
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^7.1",
"symfony/css-selector": "^7.1",
"symfony/debug-bundle": "^6.2",
"symfony/debug-bundle": "^7.1",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^7.0",
"symfony/stopwatch": "^6.2",
"symfony/web-profiler-bundle": "^6.2"
"symfony/web-profiler-bundle": "^7.1"
}
}
Loading
Loading