mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 05:09:58 -05:00
Adding epub.js to allow reading of ebooks in browser.
This commit is contained in:
parent
6dd1119eb0
commit
4286d2414a
5 changed files with 23319 additions and 9 deletions
|
|
@ -147,12 +147,15 @@ export function Files() {
|
|||
|
||||
function EbookCard({file}) {
|
||||
const {s} = useContext(ThemeContext);
|
||||
const downloadUrl = `/download/${encodeURIComponent(file.path)}`;
|
||||
let {ebook, suffix} = file;
|
||||
const coverSrc = ebook && ebook.cover_path ? `/media/${encodeURIComponent(ebook.cover_path)}` : null;
|
||||
|
||||
const downloadUrl = `/download/${encodeURIComponent(file.path)}`;
|
||||
const viewerUrl = `/epub.html?url=${downloadUrl}`;
|
||||
const isEpub = file['mimetype'].startsWith('application/epub');
|
||||
|
||||
let cover = <CardIcon><FileIcon file={file}/></CardIcon>;
|
||||
if (coverSrc) {
|
||||
if (ebook && ebook.cover_path) {
|
||||
const coverSrc = `/media/${encodeURIComponent(ebook.cover_path)}`;
|
||||
cover = <CardPosterLink to={downloadUrl} poster_url={coverSrc} external={true}/>;
|
||||
}
|
||||
|
||||
|
|
@ -167,14 +170,9 @@ function EbookCard({file}) {
|
|||
<ExternalCardLink to={downloadUrl}>{ebook ? ebook.title : file.title}</ExternalCardLink>
|
||||
</Container>
|
||||
</CardHeader>
|
||||
<CardDescription>
|
||||
<Container textAlign='left'>
|
||||
<b {...s}>{ebook ? ebook.creator : null}</b>
|
||||
</Container>
|
||||
</CardDescription>
|
||||
<CardMeta>
|
||||
<p {...s}>{ebook ? humanFileSize(ebook.size) : null}</p>
|
||||
<pre {...s}>{suffix}</pre>
|
||||
{isEpub && <ExternalCardLink to={viewerUrl}><Button content='View'/></ExternalCardLink>}
|
||||
</CardMeta>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue