@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.
@@ -14807,7 +14807,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
14807
14807
  localStorage.setItem('app-state', JSON.stringify(window.__webamp.store.getState()));
14808
14808
  });
14809
14809
 
14810
- defineProperty_default()(this, "getFiles", ln => {
14810
+ defineProperty_default()(this, "getFiles", async ln => {
14811
14811
  const x = new XMLHttpRequest();
14812
14812
  const link = encodeURIComponent(ln);
14813
14813
  x.open('get', `https://cloud-api.yandex.net/v1/disk/public/resources?public_key=${link}`, true);
@@ -14815,7 +14815,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
14815
14815
  x.setRequestHeader('Content-Type', 'application/json');
14816
14816
  x.send();
14817
14817
 
14818
- x.onload = () => {
14818
+ x.onload = async () => {
14819
14819
  if (x.status === 200) {
14820
14820
  var _JSON$parse;
14821
14821
 
@@ -14827,7 +14827,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
14827
14827
  for (const item of data) {
14828
14828
  if (item.size > 0x1400000) {// size too large
14829
14829
  } else {
14830
- fetch(item.file).then(resp => fetch(resp.url)).then(res => {
14830
+ await fetch(item.file).then(resp => fetch(resp.url)).then(res => {
14831
14831
  var _res$body;
14832
14832
 
14833
14833
  console.log(res);
@@ -14856,9 +14856,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
14856
14856
 
14857
14857
  });
14858
14858
  }).then(stream => new Response(stream)).then(response => response.blob()).then(blob => URL.createObjectURL(blob)).then(uri => {
14859
- this.openDb(playlistName, item.name, uri);
14860
- console.log(i);
14861
-
14862
14859
  if (i === 0) {
14863
14860
  window.__webamp.setTracksToPlay([{
14864
14861
  defaultName: item.name,
@@ -14879,19 +14876,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
14879
14876
  };
14880
14877
  });
14881
14878
 
14882
- defineProperty_default()(this, "appendTracks", (openRequest, playlistName, item_name, val) => {
14883
- let data = openRequest.result;
14884
- console.log(data);
14885
-
14886
- try {
14887
- data.createObjectStore(`_${playlistName}`);
14888
- } catch (e) {}
14889
-
14890
- let query = data.transaction([`default`], 'readwrite').objectStore(`_${playlistName}`);
14891
- query.add(val, item_name);
14892
- data.close();
14893
- });
14894
-
14895
14879
  defineProperty_default()(this, "getCookie", name => {
14896
14880
  const regex = new RegExp(`(^| )${name}=([^;]+)`);
14897
14881
  const match = document.cookie.match(regex);
@@ -14956,7 +14940,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
14956
14940
  let lastList = this.getCookie('lastlist');
14957
14941
 
14958
14942
  if (typeof lastList !== "undefined") {
14959
- this.getFiles(lastList);
14943
+ this.getFiles(lastList).catch(err => 0x0);
14960
14944
  }
14961
14945
 
14962
14946
  setTimeout(() => {
@@ -14978,27 +14962,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
14978
14962
  }, 2000);
14979
14963
  }
14980
14964
 
14981
- openDb(playlistName, item_name, val) {
14982
- const openRequest = indexedDB.open(playlistName);
14983
-
14984
- openRequest.onerror = e => {
14985
- console.error(e);
14986
- };
14987
-
14988
- openRequest.onsuccess = () => {
14989
- let db = openRequest.result;
14990
- if (!db.objectStoreNames.contains(`_${playlistName}`)) db.createObjectStore(`_${playlistName}`);
14991
- if (!db.objectStoreNames.contains('last-playlist')) db.createObjectStore('last-playlist');
14992
- this.appendTracks(openRequest, playlistName, item_name, val);
14993
- };
14994
-
14995
- openRequest.onupgradeneeded = ev => {
14996
- let db = openRequest.result;
14997
- if (!db.objectStoreNames.contains(`_${playlistName}`)) db.createObjectStore(`_${playlistName}`);
14998
- if (!db.objectStoreNames.contains('last-playlist')) db.createObjectStore('last-playlist');
14999
- };
15000
- }
15001
-
15002
14965
  saveLastPlaylist(playlistName) {
15003
14966
  document.cookie = `lastlist=${playlistName}; path=/;`;
15004
14967
  }