@exezt-/webamp 1.5.0-0x603 → 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,21 +10083,13 @@ function selectAll() {
|
|
|
10083
10083
|
// @ts-ignore
|
|
10084
10084
|
|
|
10085
10085
|
class webamp_telegram_handler_WinampTelegramCustomHandler {
|
|
10086
|
-
constructor() {
|
|
10087
|
-
var _window, _window$Telegram, _window2, _window2$Telegram;
|
|
10088
|
-
|
|
10086
|
+
constructor(emit) {
|
|
10089
10087
|
defineProperty_default()(this, "webamp", void 0);
|
|
10090
10088
|
|
|
10091
10089
|
defineProperty_default()(this, "telegram", void 0);
|
|
10092
10090
|
|
|
10093
|
-
defineProperty_default()(this, "initializeTelegramWebAppEvents", () => {
|
|
10094
|
-
this.telegram.offEvent("deactivated", () => {
|
|
10095
|
-
this.updateAppState();
|
|
10096
|
-
});
|
|
10097
|
-
});
|
|
10098
|
-
|
|
10099
10091
|
defineProperty_default()(this, "updateAppState", () => {
|
|
10100
|
-
localStorage.setItem("app-state", JSON.stringify(
|
|
10092
|
+
localStorage.setItem("app-state", JSON.stringify(this.webamp.store.getState()));
|
|
10101
10093
|
});
|
|
10102
10094
|
|
|
10103
10095
|
defineProperty_default()(this, "getFiles", async ln => {
|
|
@@ -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,82 +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
|
-
|
|
10241
|
+
const lastList = this.getCookie('lastlist'); // @ts-ignore | because no global var telegram avail in project types
|
|
10253
10242
|
|
|
10254
|
-
|
|
10255
|
-
this.getFiles(lastList);
|
|
10256
|
-
}
|
|
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;
|
|
10257
10244
|
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10245
|
+
if (typeof lastList !== "undefined") {
|
|
10246
|
+
this.getFiles(lastList);
|
|
10247
|
+
}
|
|
10261
10248
|
|
|
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
|
|
10262
10254
|
|
|
10263
|
-
if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
|
|
10264
|
-
console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
|
|
10265
|
-
}
|
|
10266
10255
|
|
|
10267
|
-
|
|
10268
|
-
|
|
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
|
+
}
|
|
10259
|
+
|
|
10260
|
+
if (typeof localStorage.getItem('app-state') !== "undefined") {
|
|
10261
|
+
this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
|
|
10262
|
+
}
|
|
10263
|
+
|
|
10264
|
+
this.initializeApplicationHandlers();
|
|
10269
10265
|
}
|
|
10266
|
+
}
|
|
10270
10267
|
|
|
10271
|
-
|
|
10268
|
+
initializeTelegramWebAppEvents() {
|
|
10269
|
+
this.telegram.offEvent("deactivated", () => {
|
|
10272
10270
|
this.updateAppState();
|
|
10273
10271
|
});
|
|
10272
|
+
}
|
|
10274
10273
|
|
|
10275
|
-
|
|
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(() => {
|
|
10276
10282
|
this.updateAppState();
|
|
10277
10283
|
});
|
|
10278
|
-
|
|
10279
|
-
|
|
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({
|
|
10280
10294
|
type: "ENABLE_MILKDROP",
|
|
10281
10295
|
open: false
|
|
10282
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
|
+
}));
|
|
10283
10307
|
}
|
|
10284
10308
|
|
|
10285
10309
|
}
|
|
10310
|
+
setTimeout(() => {
|
|
10311
|
+
new webamp_telegram_handler_WinampTelegramCustomHandler(true);
|
|
10312
|
+
}, 1000);
|
|
10286
10313
|
// CONCATENATED MODULE: ./js/actionCreators/files.ts
|
|
10287
10314
|
|
|
10288
10315
|
|
|
@@ -10695,7 +10722,7 @@ function files_addFilesFromUrl(atIndex = 0) {
|
|
|
10695
10722
|
return async (dispatch, getState, {
|
|
10696
10723
|
handleAddUrlEvent
|
|
10697
10724
|
}) => {
|
|
10698
|
-
await new webamp_telegram_handler_WinampTelegramCustomHandler().getFiles(prompt('Enter playlist link'));
|
|
10725
|
+
await new webamp_telegram_handler_WinampTelegramCustomHandler(false).getFiles(prompt('Enter playlist link'));
|
|
10699
10726
|
};
|
|
10700
10727
|
}
|
|
10701
10728
|
function files_addFilesFromList() {
|