@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.
|
@@ -10083,19 +10083,13 @@ function selectAll() {
|
|
|
10083
10083
|
// @ts-ignore
|
|
10084
10084
|
|
|
10085
10085
|
class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
10086
|
-
constructor() {
|
|
10086
|
+
constructor(emit) {
|
|
10087
10087
|
defineProperty_default()(this, "webamp", void 0);
|
|
10088
10088
|
|
|
10089
10089
|
defineProperty_default()(this, "telegram", void 0);
|
|
10090
10090
|
|
|
10091
|
-
defineProperty_default()(this, "initializeTelegramWebAppEvents", () => {
|
|
10092
|
-
this.telegram.offEvent("deactivated", () => {
|
|
10093
|
-
this.updateAppState();
|
|
10094
|
-
});
|
|
10095
|
-
});
|
|
10096
|
-
|
|
10097
10091
|
defineProperty_default()(this, "updateAppState", () => {
|
|
10098
|
-
localStorage.setItem("app-state", JSON.stringify(
|
|
10092
|
+
localStorage.setItem("app-state", JSON.stringify(this.webamp.store.getState()));
|
|
10099
10093
|
});
|
|
10100
10094
|
|
|
10101
10095
|
defineProperty_default()(this, "getFiles", async ln => {
|
|
@@ -10119,15 +10113,13 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
10119
10113
|
console.info(`File ${item.name} can't be loaded due oversize`);
|
|
10120
10114
|
} else {
|
|
10121
10115
|
await fetch(item.file).then(response => response).then(resp => fetch(resp.url)).then(async response => {
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
// } else {
|
|
10130
|
-
return response; // }
|
|
10116
|
+
if (response.status === 302) {
|
|
10117
|
+
return await fetch(response.headers.get('Location'), {
|
|
10118
|
+
headers: [['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'], ['Content-Type', 'application/octet-stream']]
|
|
10119
|
+
});
|
|
10120
|
+
} else {
|
|
10121
|
+
return response;
|
|
10122
|
+
}
|
|
10131
10123
|
}).then(res => {
|
|
10132
10124
|
var _res$body;
|
|
10133
10125
|
|
|
@@ -10158,12 +10150,12 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
10158
10150
|
});
|
|
10159
10151
|
}).then(stream => new Response(stream)).then(response => response.blob()).then(blob => URL.createObjectURL(blob)).then(uri => {
|
|
10160
10152
|
if (i === 0) {
|
|
10161
|
-
|
|
10153
|
+
this.webamp.setTracksToPlay([{
|
|
10162
10154
|
defaultName: item.name,
|
|
10163
10155
|
url: uri
|
|
10164
10156
|
}]);
|
|
10165
10157
|
} else {
|
|
10166
|
-
|
|
10158
|
+
this.webamp.appendTracks([{
|
|
10167
10159
|
defaultName: item.name,
|
|
10168
10160
|
url: uri
|
|
10169
10161
|
}]);
|
|
@@ -10207,87 +10199,117 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
|
10207
10199
|
let eq11 = opts.equalizer.sliders["16000"];
|
|
10208
10200
|
let equal = [eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, eq11];
|
|
10209
10201
|
let bands = [60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000];
|
|
10210
|
-
|
|
10211
|
-
window.__webamp.store.dispatch({
|
|
10202
|
+
this.webamp.store.dispatch({
|
|
10212
10203
|
type: "SET_VOLUME",
|
|
10213
10204
|
volume: clamp(vol, 0, 100)
|
|
10214
10205
|
});
|
|
10215
|
-
|
|
10216
|
-
window.__webamp.store.dispatch({
|
|
10206
|
+
this.webamp.store.dispatch({
|
|
10217
10207
|
type: "SET_BALANCE",
|
|
10218
10208
|
balance: balance
|
|
10219
10209
|
});
|
|
10220
|
-
|
|
10221
|
-
window.__webamp.store.dispatch({
|
|
10210
|
+
this.webamp.store.dispatch({
|
|
10222
10211
|
type: "SET_BAND_VALUE",
|
|
10223
10212
|
band: "preamp",
|
|
10224
10213
|
value: opts.equalizer.sliders.preamp
|
|
10225
10214
|
});
|
|
10226
10215
|
|
|
10227
10216
|
for (const band of bands) {
|
|
10228
|
-
|
|
10217
|
+
this.webamp.store.dispatch({
|
|
10229
10218
|
type: "SET_BAND_VALUE",
|
|
10230
10219
|
band: band,
|
|
10231
10220
|
value: equal[i]
|
|
10232
10221
|
});
|
|
10233
|
-
|
|
10234
10222
|
i++;
|
|
10235
10223
|
}
|
|
10236
10224
|
|
|
10237
10225
|
if (window.__webamp.store.getState().media.shuffle !== opts.media.shuffle) {
|
|
10238
|
-
|
|
10226
|
+
this.webamp.store.dispatch({
|
|
10239
10227
|
type: "TOGGLE_SHUFFLE"
|
|
10240
10228
|
});
|
|
10241
10229
|
}
|
|
10242
10230
|
|
|
10243
10231
|
if (window.__webamp.store.getState().media.repeat !== opts.media.repeat) {
|
|
10244
|
-
|
|
10232
|
+
this.webamp.store.dispatch({
|
|
10245
10233
|
type: "TOGGLE_REPEAT"
|
|
10246
10234
|
});
|
|
10247
10235
|
}
|
|
10248
10236
|
});
|
|
10249
10237
|
|
|
10250
|
-
|
|
10238
|
+
if (emit !== false) {
|
|
10239
|
+
var _window, _window$Telegram, _window2, _window2$Telegram;
|
|
10251
10240
|
|
|
10252
|
-
|
|
10253
|
-
this.getFiles(lastList);
|
|
10254
|
-
}
|
|
10241
|
+
const lastList = this.getCookie('lastlist'); // @ts-ignore | because no global var telegram avail in project types
|
|
10255
10242
|
|
|
10256
|
-
|
|
10257
|
-
}
|
|
10243
|
+
this.telegram = (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp;
|
|
10258
10244
|
|
|
10259
|
-
|
|
10260
|
-
|
|
10245
|
+
if (typeof lastList !== "undefined") {
|
|
10246
|
+
this.getFiles(lastList);
|
|
10247
|
+
}
|
|
10261
10248
|
|
|
10262
|
-
|
|
10263
|
-
|
|
10249
|
+
if (!window.__webamp) {
|
|
10250
|
+
throw new Error("Webamp __webamp is undefined!!");
|
|
10251
|
+
} else {
|
|
10252
|
+
this.webamp = window.__webamp;
|
|
10253
|
+
} // @ts-ignore | because no global var telegram avail in project types
|
|
10264
10254
|
|
|
10265
|
-
if (!window.__webamp) {
|
|
10266
|
-
throw new Error("Webamp __webamp is undefined!!");
|
|
10267
|
-
} // @ts-ignore | because no global var telegram avail in project types
|
|
10268
10255
|
|
|
10256
|
+
if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
|
|
10257
|
+
console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
|
|
10258
|
+
}
|
|
10269
10259
|
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10260
|
+
if (typeof localStorage.getItem('app-state') !== "undefined") {
|
|
10261
|
+
this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
|
|
10262
|
+
}
|
|
10273
10263
|
|
|
10274
|
-
|
|
10264
|
+
this.initializeApplicationHandlers();
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10275
10267
|
|
|
10276
|
-
|
|
10268
|
+
initializeTelegramWebAppEvents() {
|
|
10269
|
+
this.telegram.offEvent("deactivated", () => {
|
|
10277
10270
|
this.updateAppState();
|
|
10278
10271
|
});
|
|
10272
|
+
}
|
|
10279
10273
|
|
|
10280
|
-
|
|
10274
|
+
initializeApplicationHandlers() {
|
|
10275
|
+
const window_handlers = ['unload', 'beforeunload', 'pagehide'];
|
|
10276
|
+
window_handlers.forEach(handler => {
|
|
10277
|
+
window.addEventListener(handler, () => {
|
|
10278
|
+
this.updateAppState();
|
|
10279
|
+
});
|
|
10280
|
+
});
|
|
10281
|
+
this.webamp.onTrackDidChange(() => {
|
|
10281
10282
|
this.updateAppState();
|
|
10282
10283
|
});
|
|
10283
|
-
|
|
10284
|
-
|
|
10284
|
+
this.webamp.onWillClose(() => {
|
|
10285
|
+
this.updateAppState();
|
|
10286
|
+
});
|
|
10287
|
+
this.webamp.onClose(() => {
|
|
10288
|
+
this.updateAppState();
|
|
10289
|
+
});
|
|
10290
|
+
this.webamp.onMinimize(() => {
|
|
10291
|
+
this.updateAppState();
|
|
10292
|
+
});
|
|
10293
|
+
this.webamp.store.dispatch({
|
|
10285
10294
|
type: "ENABLE_MILKDROP",
|
|
10286
10295
|
open: false
|
|
10287
10296
|
});
|
|
10297
|
+
const ev = ['ended', 'playing', 'timeupdate', 'fileLoaded', 'waiting', 'stopWaiting'];
|
|
10298
|
+
|
|
10299
|
+
this.webamp.__onStateChange(() => {
|
|
10300
|
+
this.updateAppState();
|
|
10301
|
+
}); // this.webamp._actionEmitter.on('')
|
|
10302
|
+
|
|
10303
|
+
|
|
10304
|
+
ev.forEach(ev => this.webamp.media.on(ev, () => {
|
|
10305
|
+
this.updateAppState();
|
|
10306
|
+
}));
|
|
10288
10307
|
}
|
|
10289
10308
|
|
|
10290
10309
|
}
|
|
10310
|
+
setTimeout(() => {
|
|
10311
|
+
new webamp_telegram_handler_WinampTelegramCustomHandler(true);
|
|
10312
|
+
}, 1000);
|
|
10291
10313
|
// CONCATENATED MODULE: ./js/actionCreators/files.ts
|
|
10292
10314
|
|
|
10293
10315
|
|
|
@@ -10700,7 +10722,7 @@ function files_addFilesFromUrl(atIndex = 0) {
|
|
|
10700
10722
|
return async (dispatch, getState, {
|
|
10701
10723
|
handleAddUrlEvent
|
|
10702
10724
|
}) => {
|
|
10703
|
-
await new webamp_telegram_handler_WinampTelegramCustomHandler().getFiles(prompt('Enter playlist link'));
|
|
10725
|
+
await new webamp_telegram_handler_WinampTelegramCustomHandler(false).getFiles(prompt('Enter playlist link'));
|
|
10704
10726
|
};
|
|
10705
10727
|
}
|
|
10706
10728
|
function files_addFilesFromList() {
|