@exezt-/webamp 1.5.0-0x602 → 1.5.0-0x603

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.
@@ -10084,6 +10084,8 @@ function selectAll() {
10084
10084
 
10085
10085
  class webamp_telegram_handler_WinampTelegramCustomHandler {
10086
10086
  constructor() {
10087
+ var _window, _window$Telegram, _window2, _window2$Telegram;
10088
+
10087
10089
  defineProperty_default()(this, "webamp", void 0);
10088
10090
 
10089
10091
  defineProperty_default()(this, "telegram", void 0);
@@ -10119,15 +10121,13 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
10119
10121
  console.info(`File ${item.name} can't be loaded due oversize`);
10120
10122
  } else {
10121
10123
  await fetch(item.file).then(response => response).then(resp => fetch(resp.url)).then(async response => {
10122
- // if (response.status === 302) {
10123
- // return await fetch(response.headers.get('Location' as string)!, {
10124
- // headers: [
10125
- // ['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'],
10126
- // ['Content-Type', 'application/octet-stream'],
10127
- // ]
10128
- // })
10129
- // } else {
10130
- return response; // }
10124
+ if (response.status === 302) {
10125
+ return await fetch(response.headers.get('Location'), {
10126
+ headers: [['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'], ['Content-Type', 'application/octet-stream']]
10127
+ });
10128
+ } else {
10129
+ return response;
10130
+ }
10131
10131
  }).then(res => {
10132
10132
  var _res$body;
10133
10133
 
@@ -10247,21 +10247,14 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
10247
10247
  }
10248
10248
  });
10249
10249
 
10250
- const lastList = this.getCookie('lastlist');
10250
+ const lastList = this.getCookie('lastlist'); // @ts-ignore | because no global var telegram avail in project types
10251
+
10252
+ this.telegram = (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp;
10251
10253
 
10252
10254
  if (typeof lastList !== "undefined") {
10253
10255
  this.getFiles(lastList);
10254
10256
  }
10255
10257
 
10256
- this.initialize();
10257
- }
10258
-
10259
- initialize() {
10260
- var _window, _window$Telegram, _window2, _window2$Telegram;
10261
-
10262
- // @ts-ignore | because no global var telegram avail in project types
10263
- this.telegram = (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp;
10264
-
10265
10258
  if (!window.__webamp) {
10266
10259
  throw new Error("Webamp __webamp is undefined!!");
10267
10260
  } // @ts-ignore | because no global var telegram avail in project types
@@ -10271,7 +10264,9 @@ class webamp_telegram_handler_WinampTelegramCustomHandler {
10271
10264
  console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
10272
10265
  }
10273
10266
 
10274
- if (typeof localStorage.getItem('app-state') !== "undefined") this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
10267
+ if (typeof localStorage.getItem('app-state') !== "undefined") {
10268
+ this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
10269
+ }
10275
10270
 
10276
10271
  window.__webamp.onTrackDidChange(() => {
10277
10272
  this.updateAppState();