Bugfix PDF Reader with reverse proxy (#86)

Bugfix Txt Reader
Bugfix for loading covers with reverse proxy
pull/90/head
OzzieIsaacs 8 years ago
parent c33a329f08
commit a8f7fde333

@ -8608,16 +8608,16 @@ if (typeof __webpack_require__ !== 'undefined') {
useRequireEnsure = true; useRequireEnsure = true;
} }
if (typeof requirejs !== 'undefined' && requirejs.toUrl) { if (typeof requirejs !== 'undefined' && requirejs.toUrl) {
workerSrc = requirejs.toUrl('/static/js/pdf.worker.js'); workerSrc = requirejs.toUrl(PDFWORKER_LOCATION);
} }
var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load; var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load;
var fakeWorkerFilesLoader = useRequireEnsure ? (function (callback) { var fakeWorkerFilesLoader = useRequireEnsure ? (function (callback) {
require.ensure([], function () { require.ensure([], function () {
var worker = require('/static/js/pdf.worker.js'); var worker = require(PDFWORKER_LOCATION);
callback(worker.WorkerMessageHandler); callback(worker.WorkerMessageHandler);
}); });
}) : dynamicLoaderSupported ? (function (callback) { }) : dynamicLoaderSupported ? (function (callback) {
requirejs(['/static/js/pdf.worker'], function (worker) { requirejs(['PDFWORKER_LOCATION_JS'], function (worker) {
callback(worker.WorkerMessageHandler); callback(worker.WorkerMessageHandler);
}); });
}) : null; }) : null;

@ -6952,7 +6952,7 @@ var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
function configure(PDFJS) { function configure(PDFJS) {
PDFJS.imageResourcesPath = './images/'; PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '/static/js/pdf.worker.js'; PDFJS.workerSrc = PDFWORKER_LOCATION;
PDFJS.cMapUrl = '../web/cmaps/'; PDFJS.cMapUrl = '../web/cmaps/';
PDFJS.cMapPacked = true; PDFJS.cMapPacked = true;
} }

@ -5,7 +5,7 @@
<div class="col-sm-3 col-lg-3 col-xs-12"> <div class="col-sm-3 col-lg-3 col-xs-12">
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<img src="{{ url_for('get_cover', cover_path=entry.path) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -130,7 +130,7 @@
</button> </button>
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop2"> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop2">
{% for format in entry.data %} {% for format in entry.data %}
{%if format.format|lower == 'epub' or format.format|lower == 'txt' or format.format|lower == 'pdf' %} {%if format.format|lower == 'epub' or format.format|lower == 'txt' or format.format|lower == 'pdf' or format.format|lower == 'cbr' or format.format|lower == 'cbt' or format.format|lower == 'cbz' %}
<li><a target="_blank" href="{{ url_for('read_book', book_id=entry.id, format=format.format|lower) }}">{{format.format}}</a></li> <li><a target="_blank" href="{{ url_for('read_book', book_id=entry.id, format=format.format|lower) }}">{{format.format}}</a></li>
{% endif %} {% endif %}
{%endfor%} {%endfor%}

@ -10,7 +10,7 @@
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', id=entry.id) }}">
<img src="{{ url_for('get_cover', cover_path=entry.path) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a> </a>
{% endif %} {% endif %}
</div> </div>
@ -43,7 +43,7 @@
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', id=entry.id) }}">
<img src="{{ url_for('get_cover', cover_path=entry.path) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a> </a>
{% endif %} {% endif %}
</div> </div>

@ -51,7 +51,9 @@ See https://github.com/adobe-type-tools/cmap-resources
<!--<script src="debugger.js"></script>--> <!--<script src="debugger.js"></script>-->
<script type="text/javascript"> <script type="text/javascript">
var DEFAULT_URL = "{{ url_for('static', filename=pdffile) }}"; var DEFAULT_URL = "{{ url_for('static', filename=pdffile) }}";
//PDFViewerApplication.open("{{ url_for('static', filename=pdffile) }}");/ var PDFWORKER_LOCATION="{{ url_for('static', filename='js/pdf.worker.js') }}";
var PDFWORKER_LOCATION_JS="{{ url_for('static', filename='js/pdf.worker') }}";
</script> </script>
<script src="{{ url_for('static', filename='js/viewer.js') }}"></script> <script src="{{ url_for('static', filename='js/viewer.js') }}"></script>
<!--<script src="viewer.js"></script>--> <!--<script src="viewer.js"></script>-->

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{_(Basic txt Reader)}}</title> <title>{{_('Basic txt Reader')}}</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">

Loading…
Cancel
Save