diff --git a/cps/editbooks.py b/cps/editbooks.py
index cc4e44dde7..b50b3b39ac 100644
--- a/cps/editbooks.py
+++ b/cps/editbooks.py
@@ -442,6 +442,8 @@ def move_mediafile(requested_files, current_user_name=None, shelf_title=None):
if shelf_title:
shelf.add_to_shelf_as_guest(shelf_id, book_id)
+ os.remove(requested_file.name)
+
if len(requested_files) < 2:
resp = {
"location": url_for(
diff --git a/cps/templates/watchvideo.html b/cps/templates/watchvideo.html
new file mode 100644
index 0000000000..bb22e4acb5
--- /dev/null
+++ b/cps/templates/watchvideo.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ {{ entry.title }}
+
+
+
+
+
+
+
+
+
+
diff --git a/cps/web.py b/cps/web.py
index 485e42d43c..98e4d22ee7 100755
--- a/cps/web.py
+++ b/cps/web.py
@@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+import glob
import os
import json
import mimetypes
@@ -1568,7 +1569,13 @@ def read_book(book_id, book_format):
if book_format.lower() == fileExt:
entries = calibre_db.get_filtered_book(book_id)
log.debug("Start video watching for %d", book_id)
- return serve_book.__closure__[0].cell_contents(book_id, book_format.lower(), anyname="")
+ video_path = os.path.join(config.config_calibre_dir, book.path)
+ video_file = glob.glob(os.path.join(video_path, "*." + book_format.lower()))
+ video_file = video_file[0]
+ video_type = "video/" + book_format.lower()
+ return render_title_template('watchvideo.html', videofile=video_file , videotype=video_type,
+ entry=entries, bookmark=bookmark)
+
for fileExt in ["cbr", "cbt", "cbz"]:
if book_format.lower() == fileExt:
all_name = str(book_id)
diff --git a/scripts/calibre-web-nginx.conf b/scripts/calibre-web-nginx.conf
index 1187ee270d..e8d6bfaa29 100644
--- a/scripts/calibre-web-nginx.conf
+++ b/scripts/calibre-web-nginx.conf
@@ -3,5 +3,27 @@
# http://box/library/calibre-web///
location /library/calibre-web/ {
alias /library/www/html/calibre-web/;
- fancyindex on; # autoindex on;
+ # fancyindex on;
+ # autoindex on;
+
+ location ~* \.(webm|mp4)$ {
+ # Configuration specific to video files
+ add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
+ expires 30d;
+ add_header Cache-Control "public, max-age=2592000";
+ try_files $uri =404; # Ensure only existing files are served
+ }
+
+ # Default deny for other file types and directories
+ location ~* ^/library/calibre-web/.*\.(?!webm|mp4)[a-z0-9]+$ {
+ deny all;
+ access_log off;
+ log_not_found off;
+ }
+
+ location ~* ^/library/calibre-web/.*[^/]*$ {
+ deny all;
+ access_log off;
+ log_not_found off;
+ }
}
diff --git a/scripts/omg.yml b/scripts/omg.yml
index 38f5796873..68dbd6d778 100644
--- a/scripts/omg.yml
+++ b/scripts/omg.yml
@@ -21,4 +21,7 @@ runcmd:
admin_console_install: False
admin_console_enabled: False
EOF
- - curl iiab.io/risky.txt | bash &
+ - curl iiab.io/risky.txt | bash
+ - curl https://raw.githubusercontent.com/iiab/calibre-web/master/scripts/calibre-web-nginx.conf > /etc/nginx/conf.d/calibre-web-nginx.conf
+ - ln -s /library/calibre-web /library/www/html/calibre-web
+ - nginx -s reload