Skip to content

Commit 9ba0f7c

Browse files
committed
Disable jsonp usage to make BR work with CSP
1 parent ce47c72 commit 9ba0f7c

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/plugins/plugin.chapters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ BookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {
163163
const baseURL = `${olHost}/query.json?type=/type/edition&*=`;
164164
const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;
165165

166-
let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });
166+
let data = await $.ajax({ url: fetchUrlByBookId });
167167

168168
if (!data || !data.length) {
169169
// try sourceid
170-
data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}`, dataType: 'jsonp' });
170+
data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}` });
171171
}
172172

173173
return data?.[0];

src/plugins/search/plugin.search.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ BookReader.prototype.search = async function(term = '', overrides = {}) {
222222
this.trigger('SearchStarted', { term: this.searchTerm, instance: this });
223223
callSearchResultsCallback(await $.ajax({
224224
url: url,
225-
dataType: 'jsonp',
226225
cache: true,
227226
beforeSend: xhr => { this.searchXHR = xhr; },
228227
}));

src/plugins/tts/PageChunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export default class PageChunk {
2525
const chunks = await $.ajax({
2626
type: 'GET',
2727
url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`,
28-
dataType:'jsonp',
2928
cache: true,
3029
data: {
3130
path: `${bookPath}_djvu.xml`,
3231
page: leafIndex,
32+
callback: 'false',
3333
},
3434
});
3535
return PageChunk._fromTextWrapperResponse(leafIndex, chunks);

0 commit comments

Comments
 (0)