Merge remote-tracking branch 'pdf/master'

This commit is contained in:
Ozzie Isaacs 2023-02-21 20:52:25 +01:00
commit fc31132f4e
2 changed files with 11 additions and 2 deletions

View File

@ -43,7 +43,9 @@ See https://github.com/adobe-type-tools/cmap-resources
<script type="text/javascript">
window.addEventListener('webviewerloaded', function() {
PDFViewerApplicationOptions.set('disableAutoFetch', true);
PDFViewerApplicationOptions.set('disableRange', true);
PDFViewerApplicationOptions.set('disableRange', false);
PDFViewerApplicationOptions.set('disableStream', true);
PDFViewerApplicationOptions.set('disablePreferences', true);
PDFViewerApplicationOptions.set('cMapUrl', "{{ url_for('static', filename='cmaps/') }}");
PDFViewerApplicationOptions.set('sidebarViewOnLoad', 0);
PDFViewerApplicationOptions.set('imageResourcesPath', "{{ url_for('static', filename='css/images/') }}");

View File

@ -1161,7 +1161,14 @@ def serve_book(book_id, book_format, anyname):
data = calibre_db.get_book_format(book_id, book_format.upper())
if not data:
return "File not in Database"
log.info('Serving book: %s', data.name)
range_header = request.headers.get('Range', None)
if not range_header:
log.info('Serving book: %s', data.name)
response = make_response(send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format))
response.headers['Accept-Ranges'] = 'bytes'
return response
if config.config_use_google_drive:
try:
headers = Headers()