Skip to content

Commit

Permalink
Merge pull request #1358 from cdrini/rm-jsonp
Browse files Browse the repository at this point in the history
Disable jsonp usage to make BR work with CSP
  • Loading branch information
cdrini authored Dec 2, 2024
2 parents ce47c72 + 9ba0f7c commit 31b029c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/plugins/plugin.chapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ BookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {
const baseURL = `${olHost}/query.json?type=/type/edition&*=`;
const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;

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

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

return data?.[0];
Expand Down
1 change: 0 additions & 1 deletion src/plugins/search/plugin.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ BookReader.prototype.search = async function(term = '', overrides = {}) {
this.trigger('SearchStarted', { term: this.searchTerm, instance: this });
callSearchResultsCallback(await $.ajax({
url: url,
dataType: 'jsonp',
cache: true,
beforeSend: xhr => { this.searchXHR = xhr; },
}));
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/tts/PageChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export default class PageChunk {
const chunks = await $.ajax({
type: 'GET',
url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`,
dataType:'jsonp',
cache: true,
data: {
path: `${bookPath}_djvu.xml`,
page: leafIndex,
callback: 'false',
},
});
return PageChunk._fromTextWrapperResponse(leafIndex, chunks);
Expand Down

0 comments on commit 31b029c

Please sign in to comment.