From 310044fca77127279120f96d2c38b8cb88cdfa32 Mon Sep 17 00:00:00 2001 From: Drini Cami Date: Fri, 22 Nov 2024 16:27:12 -0500 Subject: [PATCH] Disable jsonp usage to make BR work with CSP --- src/plugins/plugin.chapters.js | 4 ++-- src/plugins/search/plugin.search.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/plugin.chapters.js b/src/plugins/plugin.chapters.js index 04df54def..61459249e 100644 --- a/src/plugins/plugin.chapters.js +++ b/src/plugins/plugin.chapters.js @@ -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]; diff --git a/src/plugins/search/plugin.search.js b/src/plugins/search/plugin.search.js index ea90260a3..4d4ac105d 100644 --- a/src/plugins/search/plugin.search.js +++ b/src/plugins/search/plugin.search.js @@ -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; }, }));