From 1c86ccd5a8b154f7ca117097b0a60eb5bcbad3c4 Mon Sep 17 00:00:00 2001 From: Efox Date: Thu, 3 Aug 2023 13:52:43 -0300 Subject: [PATCH] v17.1.2 - Minor bugfixes and improvements --- config.xml | 3 +- package.json | 2 +- www/nodejs-project/electron.html | 2 +- www/nodejs-project/index.html | 2 +- www/nodejs-project/modules/bridge/bridge.js | 2 +- .../modules/channels/channels.js | 42 ++++++++----------- .../modules/conn-racing/conn-racing.js | 2 +- .../download/discovery-swarm-webrtc-bundle.js | 2 +- www/nodejs-project/modules/lang/lang.js | 2 +- www/nodejs-project/modules/lists/loader.js | 6 +-- .../modules/lists/update-list-index.js | 2 +- .../modules/streamer/utils/ffmpeg.js | 4 +- www/nodejs-project/package.json | 2 +- 13 files changed, 33 insertions(+), 40 deletions(-) diff --git a/config.xml b/config.xml index 7fd2a04e..4c278dc1 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + Megacubo An intuitive, free and open source IPTV player. @@ -55,6 +55,7 @@ + diff --git a/package.json b/package.json index efa59261..f989f0ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tv.megacubo.app", "displayName": "Megacubo", - "version": "17.1.1", + "version": "17.1.2", "description": "A intuitive and multi-language IPTV player.", "main": "index.js", "scripts": { diff --git a/www/nodejs-project/electron.html b/www/nodejs-project/electron.html index 86300482..ae40da0f 100644 --- a/www/nodejs-project/electron.html +++ b/www/nodejs-project/electron.html @@ -53,7 +53,7 @@ - + diff --git a/www/nodejs-project/modules/bridge/bridge.js b/www/nodejs-project/modules/bridge/bridge.js index a7e47201..0c5611df 100644 --- a/www/nodejs-project/modules/bridge/bridge.js +++ b/www/nodejs-project/modules/bridge/bridge.js @@ -78,7 +78,7 @@ class BridgeServer extends Events { response.setHeader('Access-Control-Allow-Methods', 'GET') response.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Cache-Control, Accept, Authorization') response.setHeader('Connection', 'close') - response.setHeader('Feature-Policy', 'clipboard-read; fullscreen; autoplay; geolocation') + response.setHeader('Feature-Policy', 'clipboard-read; fullscreen; autoplay;') if(parsedUrl.pathname == '/upload') { const form = formidable({ multiples: true }) form.parse(req, (err, fields, files) => { diff --git a/www/nodejs-project/modules/channels/channels.js b/www/nodejs-project/modules/channels/channels.js index 7ee9a04b..553bfcbd 100644 --- a/www/nodejs-project/modules/channels/channels.js +++ b/www/nodejs-project/modules/channels/channels.js @@ -136,8 +136,8 @@ class ChannelsData extends Events { } class ChannelsCategories extends ChannelsData { - constructor(opts){ - super(opts) + constructor(){ + super() } loadCategories(cb){ global.storage.raw.get(this.categoriesCacheKey, data => { @@ -224,23 +224,20 @@ class ChannelsCategories extends ChannelsData { data = await this.applyMapCategories(map, data, amount, isMainCountry ? false : weighted) } } + const limit = pLimit(2) + const tasks = () => countries.map(country => { + return limit(async () => { + return await processCountry(country) + }) + }) if(countries.length) { - await processCountry(countries[0]) - if(countries.length > 1) { - const limit = pLimit(2) - const tasks = () => countries.slice(1).map(country => { - return limit(async () => { - return await processCountry(country) - }) - }) + await Promise.allSettled(tasks()).catch(console.error) + if(!completed()){ + data = {} + weighted = false await Promise.allSettled(tasks()).catch(console.error) } } - if(!completed()){ - data = {} - weighted = false - await Promise.allSettled(tasks()).catch(console.error) - } return data } getCategories(compact){ @@ -261,8 +258,8 @@ class ChannelsCategories extends ChannelsData { } class ChannelsEPG extends ChannelsCategories { - constructor(opts){ - super(opts) + constructor(){ + super() this.epgStatusTimer = false this.epgIcon = 'fas fa-th' this.clockIcon = ' ' @@ -606,8 +603,8 @@ class ChannelsEPG extends ChannelsCategories { } class ChannelsEditing extends ChannelsEPG { - constructor(opts){ - super(opts) + constructor(){ + super() global.ui.on('channels-import-file', data => { console.warn('!!! IMPORT FILE !!!', data) global.ui.importFileFromClient(data).then(ret => this.importFile(ret)).catch(err => { @@ -924,13 +921,8 @@ class ChannelsKids extends ChannelsAutoWatchNow { } class Channels extends ChannelsKids { - constructor(opts){ + constructor(){ super() - if(opts){ - Object.keys(opts).forEach((k) => { - this[k] = opts[k] - }) - } } async goChannelWebsite(name){ if(!name){ diff --git a/www/nodejs-project/modules/conn-racing/conn-racing.js b/www/nodejs-project/modules/conn-racing/conn-racing.js index fe974608..d021c8e6 100644 --- a/www/nodejs-project/modules/conn-racing/conn-racing.js +++ b/www/nodejs-project/modules/conn-racing/conn-racing.js @@ -46,7 +46,7 @@ class ConnRacing extends Events { } this.results.push(result) this.pump() - return ret.status + return status } else { return false } diff --git a/www/nodejs-project/modules/download/discovery-swarm-webrtc-bundle.js b/www/nodejs-project/modules/download/discovery-swarm-webrtc-bundle.js index e4ec38d3..98992970 100644 --- a/www/nodejs-project/modules/download/discovery-swarm-webrtc-bundle.js +++ b/www/nodejs-project/modules/download/discovery-swarm-webrtc-bundle.js @@ -31234,7 +31234,7 @@ const pLimit = concurrency => { try { await result; - } catch {} + } catch(e) { } next(); }; diff --git a/www/nodejs-project/modules/lang/lang.js b/www/nodejs-project/modules/lang/lang.js index b02c4f9c..c1524842 100644 --- a/www/nodejs-project/modules/lang/lang.js +++ b/www/nodejs-project/modules/lang/lang.js @@ -50,7 +50,7 @@ class Language extends Events { return this.countryCode = this.alternateCountries.shift() } - const countriesTzAllLangs = this.hints.langs.map(l => this.getCountriesFromLanguage(l)).flat().filter(c => countriesTz.includes(c)) // country should be in tz + const countriesTzAllLangs = this.hints.langs.map(l => this.countries.getCountriesFromLanguage(l)).flat().filter(c => countriesTz.includes(c)) // country should be in tz if(countriesTzAllLangs.length){ // language in navigator hints, right timezone this.alternateCountries = [...new Set(countriesTzAllLangs)] return this.countryCode = this.alternateCountries.shift() diff --git a/www/nodejs-project/modules/lists/loader.js b/www/nodejs-project/modules/lists/loader.js index 4f87bfe1..223e409a 100644 --- a/www/nodejs-project/modules/lists/loader.js +++ b/www/nodejs-project/modules/lists/loader.js @@ -163,7 +163,7 @@ class ListsLoader extends Events { if(p.progressId == uid) progress(p.progress) }) await this.updater.update(url, false, uid).catch(console.error) - this.updater && this.updater.close() + this.updater && this.updater.close && this.updater.close() this.master.addList(url, 1) } schedule(url, priority){ @@ -176,7 +176,7 @@ class ListsLoader extends Events { await this.prepareUpdater() this.results[url] = 'awaiting' this.results[url] = await this.updater.update(url).catch(console.error) - this.updater && this.updater.close() + this.updater && this.updater.close && this.updater.close() done = true const add = this.results[url] == 'updated' || (this.results[url] == 'already updated' && !this.master.processedLists.has(url)) add && this.master.addList(url, priority) @@ -203,7 +203,7 @@ class ListsLoader extends Events { this.updater.on('progress', progressListener) this.results[url] = 'reloading' this.results[url] = await this.updater.updateList(url, true, progressId).catch(err => updateErr = err) - this.updater && this.updater.close() + this.updater && this.updater.close && this.updater.close() this.updater.removeListener('progress', progressListener) global.osd.hide('progress-'+ progressId) if(updateErr) throw updateErr diff --git a/www/nodejs-project/modules/lists/update-list-index.js b/www/nodejs-project/modules/lists/update-list-index.js index 71b9bc69..fc2e2009 100644 --- a/www/nodejs-project/modules/lists/update-list-index.js +++ b/www/nodejs-project/modules/lists/update-list-index.js @@ -115,7 +115,7 @@ class UpdateListIndex extends ListIndexUtils { if(this.debug){ console.log('end') } - this.stream.destroy() + this.stream && this.stream.destroy() if(!resolved) { resolved = true reject('unknown http error') diff --git a/www/nodejs-project/modules/streamer/utils/ffmpeg.js b/www/nodejs-project/modules/streamer/utils/ffmpeg.js index 4feeafee..690a505f 100644 --- a/www/nodejs-project/modules/streamer/utils/ffmpeg.js +++ b/www/nodejs-project/modules/streamer/utils/ffmpeg.js @@ -108,7 +108,7 @@ class StreamerFFmpeg extends Events { reject('file empty'+ t) } } else { - reject(oerr) + reject(oerr || aerr || '') } } }) @@ -567,7 +567,7 @@ class StreamerFFmpeg extends Events { }) }).catch(e => { console.error('waitFile failed', this.timeout, e) - if(e.indexOf('timeout') != -1){ + if(String(e).indexOf('timeout') != -1){ e = 'timeout' } reject(e) diff --git a/www/nodejs-project/package.json b/www/nodejs-project/package.json index 3c6295d5..91199fd6 100644 --- a/www/nodejs-project/package.json +++ b/www/nodejs-project/package.json @@ -45,7 +45,7 @@ "description": "A intuitive, multi-language and cross-platform IPTV player.", "name": "megacubo", "icon": "./default_icon.png", - "version": "17.1.1", + "version": "17.1.2", "theme": { "fullScreen": true },