@exezt-/webamp 1.5.0-0x1 → 1.5.0-0x2

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.
@@ -10098,7 +10098,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
10098
10098
  localStorage.setItem('app-state', JSON.stringify(window.__webamp.store.getState()));
10099
10099
  });
10100
10100
 
10101
- defineProperty_default()(this, "getFiles", ln => {
10101
+ defineProperty_default()(this, "getFiles", async ln => {
10102
10102
  const x = new XMLHttpRequest();
10103
10103
  const link = encodeURIComponent(ln);
10104
10104
  x.open('get', `https://cloud-api.yandex.net/v1/disk/public/resources?public_key=${link}`, true);
@@ -10106,7 +10106,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
10106
10106
  x.setRequestHeader('Content-Type', 'application/json');
10107
10107
  x.send();
10108
10108
 
10109
- x.onload = () => {
10109
+ x.onload = async () => {
10110
10110
  if (x.status === 200) {
10111
10111
  var _JSON$parse;
10112
10112
 
@@ -10118,7 +10118,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
10118
10118
  for (const item of data) {
10119
10119
  if (item.size > 0x1400000) {// size too large
10120
10120
  } else {
10121
- fetch(item.file).then(resp => fetch(resp.url)).then(res => {
10121
+ await fetch(item.file).then(resp => fetch(resp.url)).then(res => {
10122
10122
  var _res$body;
10123
10123
 
10124
10124
  console.log(res);
@@ -10147,9 +10147,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
10147
10147
 
10148
10148
  });
10149
10149
  }).then(stream => new Response(stream)).then(response => response.blob()).then(blob => URL.createObjectURL(blob)).then(uri => {
10150
- this.openDb(playlistName, item.name, uri);
10151
- console.log(i);
10152
-
10153
10150
  if (i === 0) {
10154
10151
  window.__webamp.setTracksToPlay([{
10155
10152
  defaultName: item.name,
@@ -10170,19 +10167,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
10170
10167
  };
10171
10168
  });
10172
10169
 
10173
- defineProperty_default()(this, "appendTracks", (openRequest, playlistName, item_name, val) => {
10174
- let data = openRequest.result;
10175
- console.log(data);
10176
-
10177
- try {
10178
- data.createObjectStore(`_${playlistName}`);
10179
- } catch (e) {}
10180
-
10181
- let query = data.transaction([`default`], 'readwrite').objectStore(`_${playlistName}`);
10182
- query.add(val, item_name);
10183
- data.close();
10184
- });
10185
-
10186
10170
  defineProperty_default()(this, "getCookie", name => {
10187
10171
  const regex = new RegExp(`(^| )${name}=([^;]+)`);
10188
10172
  const match = document.cookie.match(regex);
@@ -10247,7 +10231,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
10247
10231
  let lastList = this.getCookie('lastlist');
10248
10232
 
10249
10233
  if (typeof lastList !== "undefined") {
10250
- this.getFiles(lastList);
10234
+ this.getFiles(lastList).catch(err => 0x0);
10251
10235
  }
10252
10236
 
10253
10237
  setTimeout(() => {
@@ -10269,27 +10253,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
10269
10253
  }, 2000);
10270
10254
  }
10271
10255
 
10272
- openDb(playlistName, item_name, val) {
10273
- const openRequest = indexedDB.open(playlistName);
10274
-
10275
- openRequest.onerror = e => {
10276
- console.error(e);
10277
- };
10278
-
10279
- openRequest.onsuccess = () => {
10280
- let db = openRequest.result;
10281
- if (!db.objectStoreNames.contains(`_${playlistName}`)) db.createObjectStore(`_${playlistName}`);
10282
- if (!db.objectStoreNames.contains('last-playlist')) db.createObjectStore('last-playlist');
10283
- this.appendTracks(openRequest, playlistName, item_name, val);
10284
- };
10285
-
10286
- openRequest.onupgradeneeded = ev => {
10287
- let db = openRequest.result;
10288
- if (!db.objectStoreNames.contains(`_${playlistName}`)) db.createObjectStore(`_${playlistName}`);
10289
- if (!db.objectStoreNames.contains('last-playlist')) db.createObjectStore('last-playlist');
10290
- };
10291
- }
10292
-
10293
10256
  saveLastPlaylist(playlistName) {
10294
10257
  document.cookie = `lastlist=${playlistName}; path=/;`;
10295
10258
  }