@exezt-/webamp 1.5.0-0x602 → 1.5.0-0x604
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
|
@@ -14792,19 +14792,13 @@ function selectAll() {
|
|
|
14792
14792
|
// @ts-ignore
|
|
14793
14793
|
|
|
14794
14794
|
class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
14795
|
-
constructor() {
|
|
14795
|
+
constructor(emit) {
|
|
14796
14796
|
defineProperty_default()(this, "webamp", void 0);
|
|
14797
14797
|
|
|
14798
14798
|
defineProperty_default()(this, "telegram", void 0);
|
|
14799
14799
|
|
|
14800
|
-
defineProperty_default()(this, "initializeTelegramWebAppEvents", () => {
|
|
14801
|
-
this.telegram.offEvent("deactivated", () => {
|
|
14802
|
-
this.updateAppState();
|
|
14803
|
-
});
|
|
14804
|
-
});
|
|
14805
|
-
|
|
14806
14800
|
defineProperty_default()(this, "updateAppState", () => {
|
|
14807
|
-
localStorage.setItem("app-state", JSON.stringify(
|
|
14801
|
+
localStorage.setItem("app-state", JSON.stringify(this.webamp.store.getState()));
|
|
14808
14802
|
});
|
|
14809
14803
|
|
|
14810
14804
|
defineProperty_default()(this, "getFiles", async ln => {
|
|
@@ -14828,15 +14822,13 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
14828
14822
|
console.info(`File ${item.name} can't be loaded due oversize`);
|
|
14829
14823
|
} else {
|
|
14830
14824
|
await fetch(item.file).then(response => response).then(resp => fetch(resp.url)).then(async response => {
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
// } else {
|
|
14839
|
-
return response; // }
|
|
14825
|
+
if (response.status === 302) {
|
|
14826
|
+
return await fetch(response.headers.get('Location'), {
|
|
14827
|
+
headers: [['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'], ['Content-Type', 'application/octet-stream']]
|
|
14828
|
+
});
|
|
14829
|
+
} else {
|
|
14830
|
+
return response;
|
|
14831
|
+
}
|
|
14840
14832
|
}).then(res => {
|
|
14841
14833
|
var _res$body;
|
|
14842
14834
|
|
|
@@ -14867,12 +14859,12 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
14867
14859
|
});
|
|
14868
14860
|
}).then(stream => new Response(stream)).then(response => response.blob()).then(blob => URL.createObjectURL(blob)).then(uri => {
|
|
14869
14861
|
if (i === 0) {
|
|
14870
|
-
|
|
14862
|
+
this.webamp.setTracksToPlay([{
|
|
14871
14863
|
defaultName: item.name,
|
|
14872
14864
|
url: uri
|
|
14873
14865
|
}]);
|
|
14874
14866
|
} else {
|
|
14875
|
-
|
|
14867
|
+
this.webamp.appendTracks([{
|
|
14876
14868
|
defaultName: item.name,
|
|
14877
14869
|
url: uri
|
|
14878
14870
|
}]);
|
|
@@ -14916,87 +14908,117 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
14916
14908
|
let eq11 = opts.equalizer.sliders["16000"];
|
|
14917
14909
|
let equal = [eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, eq11];
|
|
14918
14910
|
let bands = [60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000];
|
|
14919
|
-
|
|
14920
|
-
window.__webamp.store.dispatch({
|
|
14911
|
+
this.webamp.store.dispatch({
|
|
14921
14912
|
type: "SET_VOLUME",
|
|
14922
14913
|
volume: clamp(vol, 0, 100)
|
|
14923
14914
|
});
|
|
14924
|
-
|
|
14925
|
-
window.__webamp.store.dispatch({
|
|
14915
|
+
this.webamp.store.dispatch({
|
|
14926
14916
|
type: "SET_BALANCE",
|
|
14927
14917
|
balance: balance
|
|
14928
14918
|
});
|
|
14929
|
-
|
|
14930
|
-
window.__webamp.store.dispatch({
|
|
14919
|
+
this.webamp.store.dispatch({
|
|
14931
14920
|
type: "SET_BAND_VALUE",
|
|
14932
14921
|
band: "preamp",
|
|
14933
14922
|
value: opts.equalizer.sliders.preamp
|
|
14934
14923
|
});
|
|
14935
14924
|
|
|
14936
14925
|
for (const band of bands) {
|
|
14937
|
-
|
|
14926
|
+
this.webamp.store.dispatch({
|
|
14938
14927
|
type: "SET_BAND_VALUE",
|
|
14939
14928
|
band: band,
|
|
14940
14929
|
value: equal[i]
|
|
14941
14930
|
});
|
|
14942
|
-
|
|
14943
14931
|
i++;
|
|
14944
14932
|
}
|
|
14945
14933
|
|
|
14946
14934
|
if (window.__webamp.store.getState().media.shuffle !== opts.media.shuffle) {
|
|
14947
|
-
|
|
14935
|
+
this.webamp.store.dispatch({
|
|
14948
14936
|
type: "TOGGLE_SHUFFLE"
|
|
14949
14937
|
});
|
|
14950
14938
|
}
|
|
14951
14939
|
|
|
14952
14940
|
if (window.__webamp.store.getState().media.repeat !== opts.media.repeat) {
|
|
14953
|
-
|
|
14941
|
+
this.webamp.store.dispatch({
|
|
14954
14942
|
type: "TOGGLE_REPEAT"
|
|
14955
14943
|
});
|
|
14956
14944
|
}
|
|
14957
14945
|
});
|
|
14958
14946
|
|
|
14959
|
-
|
|
14947
|
+
if (emit !== false) {
|
|
14948
|
+
var _window, _window$Telegram, _window2, _window2$Telegram;
|
|
14960
14949
|
|
|
14961
|
-
|
|
14962
|
-
this.getFiles(lastList);
|
|
14963
|
-
}
|
|
14950
|
+
const lastList = this.getCookie('lastlist'); // @ts-ignore | because no global var telegram avail in project types
|
|
14964
14951
|
|
|
14965
|
-
|
|
14966
|
-
}
|
|
14952
|
+
this.telegram = (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp;
|
|
14967
14953
|
|
|
14968
|
-
|
|
14969
|
-
|
|
14954
|
+
if (typeof lastList !== "undefined") {
|
|
14955
|
+
this.getFiles(lastList);
|
|
14956
|
+
}
|
|
14970
14957
|
|
|
14971
|
-
|
|
14972
|
-
|
|
14958
|
+
if (!window.__webamp) {
|
|
14959
|
+
throw new Error("Webamp __webamp is undefined!!");
|
|
14960
|
+
} else {
|
|
14961
|
+
this.webamp = window.__webamp;
|
|
14962
|
+
} // @ts-ignore | because no global var telegram avail in project types
|
|
14973
14963
|
|
|
14974
|
-
if (!window.__webamp) {
|
|
14975
|
-
throw new Error("Webamp __webamp is undefined!!");
|
|
14976
|
-
} // @ts-ignore | because no global var telegram avail in project types
|
|
14977
14964
|
|
|
14965
|
+
if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
|
|
14966
|
+
console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
|
|
14967
|
+
}
|
|
14978
14968
|
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14969
|
+
if (typeof localStorage.getItem('app-state') !== "undefined") {
|
|
14970
|
+
this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
|
|
14971
|
+
}
|
|
14982
14972
|
|
|
14983
|
-
|
|
14973
|
+
this.initializeApplicationHandlers();
|
|
14974
|
+
}
|
|
14975
|
+
}
|
|
14984
14976
|
|
|
14985
|
-
|
|
14977
|
+
initializeTelegramWebAppEvents() {
|
|
14978
|
+
this.telegram.offEvent("deactivated", () => {
|
|
14986
14979
|
this.updateAppState();
|
|
14987
14980
|
});
|
|
14981
|
+
}
|
|
14988
14982
|
|
|
14989
|
-
|
|
14983
|
+
initializeApplicationHandlers() {
|
|
14984
|
+
const window_handlers = ['unload', 'beforeunload', 'pagehide'];
|
|
14985
|
+
window_handlers.forEach(handler => {
|
|
14986
|
+
window.addEventListener(handler, () => {
|
|
14987
|
+
this.updateAppState();
|
|
14988
|
+
});
|
|
14989
|
+
});
|
|
14990
|
+
this.webamp.onTrackDidChange(() => {
|
|
14990
14991
|
this.updateAppState();
|
|
14991
14992
|
});
|
|
14992
|
-
|
|
14993
|
-
|
|
14993
|
+
this.webamp.onWillClose(() => {
|
|
14994
|
+
this.updateAppState();
|
|
14995
|
+
});
|
|
14996
|
+
this.webamp.onClose(() => {
|
|
14997
|
+
this.updateAppState();
|
|
14998
|
+
});
|
|
14999
|
+
this.webamp.onMinimize(() => {
|
|
15000
|
+
this.updateAppState();
|
|
15001
|
+
});
|
|
15002
|
+
this.webamp.store.dispatch({
|
|
14994
15003
|
type: "ENABLE_MILKDROP",
|
|
14995
15004
|
open: false
|
|
14996
15005
|
});
|
|
15006
|
+
const ev = ['ended', 'playing', 'timeupdate', 'fileLoaded', 'waiting', 'stopWaiting'];
|
|
15007
|
+
|
|
15008
|
+
this.webamp.__onStateChange(() => {
|
|
15009
|
+
this.updateAppState();
|
|
15010
|
+
}); // this.webamp._actionEmitter.on('')
|
|
15011
|
+
|
|
15012
|
+
|
|
15013
|
+
ev.forEach(ev => this.webamp.media.on(ev, () => {
|
|
15014
|
+
this.updateAppState();
|
|
15015
|
+
}));
|
|
14997
15016
|
}
|
|
14998
15017
|
|
|
14999
15018
|
}
|
|
15019
|
+
setTimeout(() => {
|
|
15020
|
+
new webamp_telegram_handler_WinampTelegramCustomHandler(true);
|
|
15021
|
+
}, 1000);
|
|
15000
15022
|
// CONCATENATED MODULE: ./js/actionCreators/files.ts
|
|
15001
15023
|
|
|
15002
15024
|
|
|
@@ -15409,7 +15431,7 @@ function files_addFilesFromUrl(atIndex = 0) {
|
|
|
15409
15431
|
return async (dispatch, getState, {
|
|
15410
15432
|
handleAddUrlEvent
|
|
15411
15433
|
}) => {
|
|
15412
|
-
await new webamp_telegram_handler_WinampTelegramCustomHandler().getFiles(prompt('Enter playlist link'));
|
|
15434
|
+
await new webamp_telegram_handler_WinampTelegramCustomHandler(false).getFiles(prompt('Enter playlist link'));
|
|
15413
15435
|
};
|
|
15414
15436
|
}
|
|
15415
15437
|
function files_addFilesFromList() {
|