speaker-calibration 2.2.174 → 2.2.175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speaker-calibration",
3
- "version": "2.2.174",
3
+ "version": "2.2.175",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -48,6 +48,7 @@ class Speaker extends AudioPeer {
48
48
 
49
49
  uri = '';
50
50
  qrImage;
51
+ shortURL;
51
52
 
52
53
 
53
54
  initPeer = async () => {
@@ -290,13 +291,42 @@ class Speaker extends AudioPeer {
290
291
  const explanation = document.createElement("p");
291
292
  explanation.id = "skipQRExplanation";
292
293
  explanation.style = `
293
- overflow-wrap: break-word; /* Ensure long URLs or text break properly */
294
294
  user-select: text;
295
295
  `;
296
296
 
297
- explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
298
- .replace("xxx", `<b style="user-select: text">${this.uri}</b>`)
299
- .replace("XXX", `<b style="user-select: text">${this.uri}</b>`);
297
+ // Define the URL and options for the request
298
+ const url = 'https://api.short.io/links';
299
+ const options = {
300
+ method: 'POST',
301
+ headers: {
302
+ 'Accept': 'application/json',
303
+ 'Content-Type': 'application/json',
304
+ 'Authorization': 'sk_7Y58e7P68nyqOQ0J'
305
+ },
306
+ body: JSON.stringify({
307
+ domain: 'listeners.link', // Ensure this domain is valid for your account
308
+ originalURL: this.uri
309
+ })
310
+ };
311
+
312
+ // Make the request using fetch
313
+ fetch(url, options)
314
+ .then(response => {
315
+ if (!response.ok) {
316
+ throw new Error(`HTTP error! Status: ${response.status}`);
317
+ }
318
+ return response.json(); // Parse the JSON response
319
+ })
320
+ .then(data => {
321
+ explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
322
+ .replace("xxx", `<b style="user-select: text">${data.shortURL}</b>`)
323
+ .replace("XXX", `<b style="user-select: text">${data.shortURL}</b>`);
324
+ })
325
+ .catch(error => {
326
+ console.error('Error:', error.message); // Handle errors
327
+ });
328
+
329
+
300
330
 
301
331
  const qrImage = new Image(400, 400);
302
332
  qrImage.setAttribute('id', 'compatibilityCheckQRImage');