@internetarchive/bookreader 5.0.0-83 → 5.0.0-85

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 5.0.0-85
2
+ - Dev: Disable JSONP requests to archive.org to make BR CSP-compatible @cdrini
3
+
4
+ # 5.0.0-84
5
+ - Fix: Improve/update wording for downloads @rebecca-shoptaw
6
+
1
7
  # 5.0.0-83
2
8
  - Fix: Fix typo in search-results.js @sahalbelam
3
9
  - Dev: Bump cache action to v4 @williamtheaker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-83",
3
+ "version": "5.0.0-85",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "@iiif/presentation-2": "^1.0.4",
49
49
  "@iiif/presentation-3": "^2.1.3",
50
50
  "@open-wc/testing-helpers": "3.0.1",
51
- "@types/jest": "29.5.13",
51
+ "@types/jest": "29.5.14",
52
52
  "@webcomponents/webcomponentsjs": "^2.6.0",
53
53
  "babel-loader": "9.2.1",
54
54
  "concurrently": "9.0.1",
@@ -62,21 +62,9 @@ export class IABookDownloads extends LitElement {
62
62
  `;
63
63
  }
64
64
 
65
- get accessProtectedBook() {
65
+ get installLCPSoftwareMsg() {
66
66
  return html`
67
- <p>To access downloaded books, you need Adobe-compliant software on your device. The Internet Archive will administer this loan, but Adobe may also collect some information.</p>
68
- <a class="ia-button external primary" href="https://www.adobe.com/solutions/ebook/digital-editions/download.html" rel="noopener noreferrer" target="_blank">Install Adobe Digital Editions</a>
69
- `;
70
- }
71
-
72
- get installSimplyEAldikoThoriumMsg() {
73
- return html`
74
- <p>For LCP downloads, make sure you have SimplyE or Aldiko Next installed on mobile or Thorium on desktop.</p>
75
- <ul>
76
- <li><a href="https://librarysimplified.org/simplye/" rel="noopener noreferrer nofollow" target="_blank">Install SimplyE</a></li>
77
- <li><a href="https://www.demarque.com/en-aldiko" rel="noopener noreferrer nofollow" target="_blank">Install Aldiko</a></li>
78
- <li><a href="https://thorium.edrlab.org/" rel="noopener noreferrer nofollow" target="_blank">Install Thorium</a></li>
79
- </ul>
67
+ <p>For LCP downloads, make sure you have LCP software such as <a href="https://thorium.edrlab.org/" rel="noopener noreferrer nofollow" target="_blank">Thorium (desktop)</a>, <a href="https://apps.apple.com/us/app/cantook-by-aldiko/id1476410111" rel="noopener noreferrer nofollow" target="_blank">Cantook (iOS)</a> or <a href="https://play.google.com/store/apps/details?id=com.aldiko.android" rel="noopener noreferrer nofollow" target="_blank">Cantook (Android)</a> installed on your device.</p>
80
68
  `;
81
69
  }
82
70
 
@@ -86,8 +74,8 @@ export class IABookDownloads extends LitElement {
86
74
  ${this.loanExpiryMessage}
87
75
  <ul>${this.renderDownloadOptions()}</ul>
88
76
  ${this.hasLCPOption
89
- ? this.installSimplyEAldikoThoriumMsg
90
- : (this.isBookProtected ? this.accessProtectedBook : nothing)
77
+ ? this.installLCPSoftwareMsg
78
+ : nothing
91
79
  }
92
80
  `;
93
81
  }
@@ -163,11 +163,11 @@ BookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {
163
163
  const baseURL = `${olHost}/query.json?type=/type/edition&*=`;
164
164
  const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;
165
165
 
166
- let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });
166
+ let data = await $.ajax({ url: fetchUrlByBookId });
167
167
 
168
168
  if (!data || !data.length) {
169
169
  // try sourceid
170
- data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}`, dataType: 'jsonp' });
170
+ data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}` });
171
171
  }
172
172
 
173
173
  return data?.[0];
@@ -222,7 +222,6 @@ BookReader.prototype.search = async function(term = '', overrides = {}) {
222
222
  this.trigger('SearchStarted', { term: this.searchTerm, instance: this });
223
223
  callSearchResultsCallback(await $.ajax({
224
224
  url: url,
225
- dataType: 'jsonp',
226
225
  cache: true,
227
226
  beforeSend: xhr => { this.searchXHR = xhr; },
228
227
  }));
@@ -25,11 +25,11 @@ export default class PageChunk {
25
25
  const chunks = await $.ajax({
26
26
  type: 'GET',
27
27
  url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`,
28
- dataType:'jsonp',
29
28
  cache: true,
30
29
  data: {
31
30
  path: `${bookPath}_djvu.xml`,
32
31
  page: leafIndex,
32
+ callback: 'false',
33
33
  },
34
34
  });
35
35
  return PageChunk._fromTextWrapperResponse(leafIndex, chunks);