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 27, 2024
1 parent f311abd commit 310044f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 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 });

Check warning on line 166 in src/plugins/plugin.chapters.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/plugin.chapters.js#L166

Added line #L166 was not covered by tests

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}` });

Check warning on line 170 in src/plugins/plugin.chapters.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/plugin.chapters.js#L170

Added line #L170 was not covered by tests
}

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

0 comments on commit 310044f

Please sign in to comment.