mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 10:00:37 +00:00
Merge remote-tracking branch 'pdf/master'
This commit is contained in:
commit
fc31132f4e
@ -43,7 +43,9 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('webviewerloaded', function() {
|
window.addEventListener('webviewerloaded', function() {
|
||||||
PDFViewerApplicationOptions.set('disableAutoFetch', true);
|
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('cMapUrl', "{{ url_for('static', filename='cmaps/') }}");
|
||||||
PDFViewerApplicationOptions.set('sidebarViewOnLoad', 0);
|
PDFViewerApplicationOptions.set('sidebarViewOnLoad', 0);
|
||||||
PDFViewerApplicationOptions.set('imageResourcesPath', "{{ url_for('static', filename='css/images/') }}");
|
PDFViewerApplicationOptions.set('imageResourcesPath', "{{ url_for('static', filename='css/images/') }}");
|
||||||
|
@ -1161,7 +1161,14 @@ def serve_book(book_id, book_format, anyname):
|
|||||||
data = calibre_db.get_book_format(book_id, book_format.upper())
|
data = calibre_db.get_book_format(book_id, book_format.upper())
|
||||||
if not data:
|
if not data:
|
||||||
return "File not in Database"
|
return "File not in Database"
|
||||||
|
|
||||||
|
range_header = request.headers.get('Range', None)
|
||||||
|
if not range_header:
|
||||||
log.info('Serving book: %s', data.name)
|
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:
|
if config.config_use_google_drive:
|
||||||
try:
|
try:
|
||||||
headers = Headers()
|
headers = Headers()
|
||||||
|
Loading…
Reference in New Issue
Block a user