diff --git a/src/plugins/plugin.text_selection.js b/src/plugins/plugin.text_selection.js index 272c27261..54b0d1466 100644 --- a/src/plugins/plugin.text_selection.js +++ b/src/plugins/plugin.text_selection.js @@ -89,6 +89,9 @@ export class TextSelectionPlugin { url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables), dataType: this.options.jsonp ? "jsonp" : "html", cache: true, + xhrFields: { + withCredentials: window.br.protected, + }, error: (e) => undefined, }).then((res) => { try { @@ -115,6 +118,9 @@ export class TextSelectionPlugin { url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }), dataType: this.options.jsonp ? "jsonp" : "html", cache: true, + xhrFields: { + withCredentials: window.br.protected, + }, error: (e) => undefined, }); try { diff --git a/src/plugins/search/plugin.search.js b/src/plugins/search/plugin.search.js index 4d4ac105d..dccf452d4 100644 --- a/src/plugins/search/plugin.search.js +++ b/src/plugins/search/plugin.search.js @@ -223,6 +223,9 @@ BookReader.prototype.search = async function(term = '', overrides = {}) { callSearchResultsCallback(await $.ajax({ url: url, cache: true, + xhrFields: { + withCredentials: this.protected, + }, beforeSend: xhr => { this.searchXHR = xhr; }, })); }; diff --git a/src/plugins/tts/PageChunk.js b/src/plugins/tts/PageChunk.js index 001f97986..f8657e0e0 100644 --- a/src/plugins/tts/PageChunk.js +++ b/src/plugins/tts/PageChunk.js @@ -26,6 +26,9 @@ export default class PageChunk { type: 'GET', url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`, cache: true, + xhrFields: { + withCredentials: window.br.protected, + }, data: { path: `${bookPath}_djvu.xml`, page: leafIndex, diff --git a/tests/jest/plugins/plugin.text_selection.test.js b/tests/jest/plugins/plugin.text_selection.test.js index a0b995364..95a2bfab9 100644 --- a/tests/jest/plugins/plugin.text_selection.test.js +++ b/tests/jest/plugins/plugin.text_selection.test.js @@ -87,7 +87,7 @@ const FAKE_XML_EMPTY = ''; describe("Generic tests", () => { document.body.innerHTML = '
'; - const br = new BookreaderWithTextSelection({ + const br = window.br = new BookreaderWithTextSelection({ data: [ [ { width: 800, height: 1200,