@exezt-/webamp 1.5.0-0x1 → 1.5.0-0x3
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/built/webamp.bundle.js
CHANGED
|
@@ -14793,21 +14793,11 @@ function selectAll() {
|
|
|
14793
14793
|
|
|
14794
14794
|
class webamp_telegram_WinampTelegramCustomHandler {
|
|
14795
14795
|
constructor() {
|
|
14796
|
-
defineProperty_default()(this, "window_handlers", ['unload', 'beforeunload', 'pagehide']);
|
|
14797
|
-
|
|
14798
|
-
defineProperty_default()(this, "registerDOMListeners", () => {
|
|
14799
|
-
this.window_handlers.forEach(handler => {
|
|
14800
|
-
window.addEventListener(handler, () => {
|
|
14801
|
-
this.updateAppState();
|
|
14802
|
-
});
|
|
14803
|
-
});
|
|
14804
|
-
});
|
|
14805
|
-
|
|
14806
14796
|
defineProperty_default()(this, "updateAppState", () => {
|
|
14807
14797
|
localStorage.setItem('app-state', JSON.stringify(window.__webamp.store.getState()));
|
|
14808
14798
|
});
|
|
14809
14799
|
|
|
14810
|
-
defineProperty_default()(this, "getFiles", ln => {
|
|
14800
|
+
defineProperty_default()(this, "getFiles", async ln => {
|
|
14811
14801
|
const x = new XMLHttpRequest();
|
|
14812
14802
|
const link = encodeURIComponent(ln);
|
|
14813
14803
|
x.open('get', `https://cloud-api.yandex.net/v1/disk/public/resources?public_key=${link}`, true);
|
|
@@ -14815,7 +14805,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14815
14805
|
x.setRequestHeader('Content-Type', 'application/json');
|
|
14816
14806
|
x.send();
|
|
14817
14807
|
|
|
14818
|
-
x.onload = () => {
|
|
14808
|
+
x.onload = async () => {
|
|
14819
14809
|
if (x.status === 200) {
|
|
14820
14810
|
var _JSON$parse;
|
|
14821
14811
|
|
|
@@ -14827,7 +14817,7 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14827
14817
|
for (const item of data) {
|
|
14828
14818
|
if (item.size > 0x1400000) {// size too large
|
|
14829
14819
|
} else {
|
|
14830
|
-
fetch(item.file).then(resp => fetch(resp.url)).then(res => {
|
|
14820
|
+
await fetch(item.file).then(resp => fetch(resp.url)).then(res => {
|
|
14831
14821
|
var _res$body;
|
|
14832
14822
|
|
|
14833
14823
|
console.log(res);
|
|
@@ -14856,9 +14846,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14856
14846
|
|
|
14857
14847
|
});
|
|
14858
14848
|
}).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
14849
|
if (i === 0) {
|
|
14863
14850
|
window.__webamp.setTracksToPlay([{
|
|
14864
14851
|
defaultName: item.name,
|
|
@@ -14879,19 +14866,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14879
14866
|
};
|
|
14880
14867
|
});
|
|
14881
14868
|
|
|
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
14869
|
defineProperty_default()(this, "getCookie", name => {
|
|
14896
14870
|
const regex = new RegExp(`(^| )${name}=([^;]+)`);
|
|
14897
14871
|
const match = document.cookie.match(regex);
|
|
@@ -14956,12 +14930,11 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14956
14930
|
let lastList = this.getCookie('lastlist');
|
|
14957
14931
|
|
|
14958
14932
|
if (typeof lastList !== "undefined") {
|
|
14959
|
-
this.getFiles(lastList);
|
|
14933
|
+
this.getFiles(lastList).catch(err => 0x0);
|
|
14960
14934
|
}
|
|
14961
14935
|
|
|
14962
14936
|
setTimeout(() => {
|
|
14963
14937
|
if (typeof localStorage.getItem('app-state') !== "undefined") this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
|
|
14964
|
-
this.registerDOMListeners();
|
|
14965
14938
|
|
|
14966
14939
|
window.__webamp.onTrackDidChange(() => {
|
|
14967
14940
|
this.updateAppState();
|
|
@@ -14978,27 +14951,6 @@ class webamp_telegram_WinampTelegramCustomHandler {
|
|
|
14978
14951
|
}, 2000);
|
|
14979
14952
|
}
|
|
14980
14953
|
|
|
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
14954
|
saveLastPlaylist(playlistName) {
|
|
15003
14955
|
document.cookie = `lastlist=${playlistName}; path=/;`;
|
|
15004
14956
|
}
|