Skip to content

Commit

Permalink
Disable jsonp usage to make BR work with CSP
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrini committed Nov 22, 2024
1 parent dbbffd1 commit 760a606
Show file tree
Hide file tree
Showing 3 changed files with 2 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
1 change: 0 additions & 1 deletion src/plugins/tts/PageChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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`,
Expand Down

0 comments on commit 760a606

Please sign in to comment.