diff --git a/app/src/App.js b/app/src/App.js index 22d7efde..fa946790 100644 --- a/app/src/App.js +++ b/app/src/App.js @@ -20,10 +20,10 @@ import {Dashboard} from "./Dashboard"; import {Donate} from "./components/Donate"; function PageNotFound() { - return ( + return Page Not Found! The page you requested cannot be found - ) + } function Dot() { diff --git a/app/src/components/Files.js b/app/src/components/Files.js index 4c324309..85f55b7c 100644 --- a/app/src/components/Files.js +++ b/app/src/components/Files.js @@ -1,6 +1,7 @@ import React, {useContext} from "react"; import FileBrowser from 'react-keyed-file-browser'; import { + Button as SButton, CardContent, CardDescription, CardHeader, @@ -9,7 +10,9 @@ import { Container, Divider, Dropdown, + Header as SHeader, Image, + Modal, PlaceholderLine, TableCell, TableHeaderCell, @@ -150,29 +153,65 @@ function EbookCard({file}) { let {ebook, suffix} = file; const downloadUrl = `/download/${encodeURIComponent(file.path)}`; - const viewerUrl = `/epub.html?url=${downloadUrl}`; const isEpub = file['mimetype'].startsWith('application/epub'); + const viewerUrl = isEpub ? `/epub.html?url=${downloadUrl}` : null; let cover = ; if (ebook && ebook.cover_path) { const coverSrc = `/media/${encodeURIComponent(ebook.cover_path)}`; - cover = ; + cover = ; } suffix = suffix ? _.trimStart(suffix, '.').toUpperCase() : null; + const downloadButton = + + ; + + const detailsButton = setDetailsOpen(true)} + />; + const [detailsOpen, setDetailsOpen] = React.useState(false); + const detailsModal = setDetailsOpen(false)} + trigger={detailsButton} + > + {ebook.title || file.title} + + Author: {ebook.creator} + {humanFileSize(ebook.size)} + eBook Path + {ebook ? ebook.ebook_path : file.path} + Cover Path + {ebook && ebook.cover_path ? ebook.cover_path : 'N/A'} + + + {downloadButton} + + ; + const color = mimetypeColor(file.mimetype); return {cover} - {ebook ? ebook.title : file.title} + + {ebook ? ebook.title : file.title} + {suffix} - {isEpub && } + {detailsModal} diff --git a/app/src/components/VideoPlayer.js b/app/src/components/VideoPlayer.js index cf53d7f9..b10ce262 100644 --- a/app/src/components/VideoPlayer.js +++ b/app/src/components/VideoPlayer.js @@ -15,13 +15,12 @@ import {VideoCard} from "./Videos"; const MEDIA_PATH = '/media'; -function videoFileLink(video, name, directory = false) { - const path = video[name]; +function videoFileLink(path, directory = false) { if (path) { const href = directory ? `${MEDIA_PATH}/${encodeURIComponent(path)}/` : `${MEDIA_PATH}/${encodeURIComponent(path)}`; - return + return {path} } else { @@ -134,19 +133,19 @@ function VideoPage({videoFile, prevFile, nextFile, setFavorite, ...props}) { let filesPane = { menuItem: 'Files', render: () => Video File - {videoFileLink(video, 'video_path')} + {videoFileLink(video['video_path'])} Info JSON File - {videoFileLink(video, 'info_json_path')} + {videoFileLink(video['info_json_path'])} Caption File - {videoFileLink(video, 'caption_path')} + {videoFileLink(video['caption_path'])} Poster File - {videoFileLink(video, 'poster_path')} + {videoFileLink(video['poster_path'])} Directory - {videoFileLink(video, 'directory', true)} + {videoFileLink(videoFile['directory'], true)} } diff --git a/modules/videos/models.py b/modules/videos/models.py index db42c74a..e078de70 100644 --- a/modules/videos/models.py +++ b/modules/videos/models.py @@ -245,7 +245,6 @@ class Video(ModelHelper, Base): censored=self.censored, channel=self.channel, channel_id=self.channel_id, - directory=self.video_path.parent if self.video_path else None, modification_datetime=self.modification_datetime, duration=self.duration, favorite=self.favorite, diff --git a/nginx.conf b/nginx.conf index 918e7850..39c874b7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -36,6 +36,10 @@ http { alias /opt/wrolpi/icon.png; } + location /epub.html { + alias /opt/wrolpi/app/public/epub.html; + } + location / { # React APP proxy_pass http://127.0.0.1:5000; diff --git a/wrolpi/files/models.py b/wrolpi/files/models.py index d4b1f2d8..4ef5a06e 100644 --- a/wrolpi/files/models.py +++ b/wrolpi/files/models.py @@ -54,6 +54,7 @@ class File(ModelHelper, Base): path = self.path.relative_to(get_media_directory()) d = dict( associated=self.associated, + directory=self.path.parent, full_stem=self.full_stem, key=path, # React browser expects this. mimetype=self.mimetype,
The page you requested cannot be found
{humanFileSize(ebook.size)}
{ebook ? ebook.ebook_path : file.path}
{ebook && ebook.cover_path ? ebook.cover_path : 'N/A'}
{suffix}
{path}