diff --git a/EXT-Bring.js b/EXT-Bring.js index 90a64e5..3bbbfad 100644 --- a/EXT-Bring.js +++ b/EXT-Bring.js @@ -1,6 +1,7 @@ /* global Module */ Module.register("EXT-Bring", { + requiresVersion: "2.22.0", defaults: { debug: false, listName: "", @@ -15,53 +16,8 @@ Module.register("EXT-Bring", { updateInterval: 30000 }, - requiresVersion: "2.18.0", - start: async function () { this.listData= null - this.langDB= { - 0: "fr-FR", - 1: "de-AT", - 2: "de-CH", - 3: "de-DE", - 4: "es-ES", - 5: "en-GB", - 6: "en-US", - 7: "en-CA", - 8: "en-AU", - 9: "fr-CH", - 10: "fr-FR", - 11: "it-CH", - 12: "it-IT", - 13: "pt-BR", - 14: "nl-NL", - 15: "hu-HU", - 16: "nb-NO", - 17: "pl-PL", - 18: "ru-RU", - 19: "sv-SE", - 20: "tr-TR" - } - this.config.language = await this.languageConfig() - console.warn("[BRING] Language set to:", this.config.language) - }, - - languageConfig: function () { - if (this.config.lang === 0) return "fr-FR" - else if (!this.config.lang || isNaN(this.config.lang) || (this.config.lang > Object.keys(this.langDB).length-1) || (this.config.lang < 0)) { - console.warn("[BRING] Mismake on config lang...") - return "fr-FR" - } - - return new Promise(resolve => { - Object.entries(this.langDB).some(entry => { - const [number,key] = entry - if (this.config.lang == number) { - resolve(key) - return key // stop process if match - } - }) - }) }, notificationReceived: function(notification, payload, sender) { @@ -72,17 +28,17 @@ Module.register("EXT-Bring", { case "GAv5_READY": if (sender.name == "MMM-GoogleAssistant") this.sendNotification("EXT_HELLO", this.name) break - case "EXT_BRING-START": - this.sendSocketNotification("EXT-Bring-START") + case "EXT_BRING-START": // can be used with Gateway/EXT-Screen later + this.sendSocketNotification("START") break - case "EXT_BRING-STOP": - this.sendSocketNotification("EXT-Bring-STOP") + case "EXT_BRING-STOP": // can be used with Gateway/EXT-Screen later + this.sendSocketNotification("STOP") break } }, socketNotificationReceived: function (notification, payload) { - if (notification === "EXT-Bring-LISTUPDATE") { + if (notification === "UPDATE") { if (payload.listName.toLowerCase() === this.config.listName.toLowerCase()) { this.listData = payload if (this.config.showListName) this.data.header = payload.listName @@ -92,9 +48,7 @@ Module.register("EXT-Bring", { }, getStyles: function () { - return [ - "EXT-Bring.css" - ] + return [ "EXT-Bring.css" ] }, getDom: function () { @@ -104,9 +58,7 @@ Module.register("EXT-Bring", { Bring.style.maxHeight= this.config.maxRows * 119 + "px" if (this.listData) { - var listContent = this.listData - listContent.items.forEach(element => { - + this.listData.items.forEach(element => { var BringContener= document.createElement("div") BringContener.id = "EXT-Bring_Contener" if (this.config.showBackground) BringContener.classList.add("background") @@ -118,7 +70,6 @@ Module.register("EXT-Bring", { BringContener.appendChild(BringItem) // Upper - var BringItemUpper= document.createElement("div") BringItemUpper.id = "EXT-Bring_Item-Upper" BringItem.appendChild(BringItemUpper) @@ -141,7 +92,6 @@ Module.register("EXT-Bring", { BringItemUpper.appendChild(BringIndicatorsRight) // Lower - var BringItemLower= document.createElement("div") BringItemLower.id = "EXT-Bring_Item-Lower" BringItem.appendChild(BringItemLower) diff --git a/lib/bring-lib.js b/components/bring-lib.js similarity index 56% rename from lib/bring-lib.js rename to components/bring-lib.js index 81d6206..1a128b2 100644 --- a/lib/bring-lib.js +++ b/components/bring-lib.js @@ -5,12 +5,9 @@ "use strict"; -var request = require("request"); -var ts_md5 = require("ts-md5"); - /** Profile **/ var BringProfile = /** @class */ (function () { - function BringProfile(email, password, language, logger) { + function BringProfile(email, password, language, logger, lib) { this.authUrl = "https://api.getbring.com/rest/v2/bringauth"; this.listUrl = "https://api.getbring.com/rest/v2/bringlists/{listId}"; this.listsForUserUrl = "https://api.getbring.com/rest/v2/bringusers/{userid}/lists"; @@ -24,95 +21,109 @@ var BringProfile = /** @class */ (function () { this.email = email; this.password = password; this.logger = logger; + this.lib = lib; + this.httpsAgent = new this.lib.https.Agent({ + rejectUnauthorized: false, + }); } - BringProfile.prototype.requestGetOptions = function () { + + BringProfile.prototype.fetchGetOptions = function () { return { - json: true, headers: { 'Authorization': "Bearer " + this.access_token, 'X-BRING-COUNTRY': 'DE', 'X-BRING-USER-UUID': this.userid, - 'X-BRING-API-KEY': 'cof4Nc6D8saplXjE3h3HXqHH8m7VU2i1Gs0g85Sp' //Konstante in Brings Environment-Konfig (steht im main bundle auf deren webseite). Möglicherweise ändert es sich regelmäßig. Bleibt abzuwarten. + 'X-BRING-API-KEY': 'cof4Nc6D8saplXjE3h3HXqHH8m7VU2i1Gs0g85Sp' } }; }; - BringProfile.prototype.getListsForUser = function (callback, retryNo) { + + BringProfile.prototype.getListsForUser = async function (callback, retryNo) { var _this = this; if (retryNo === void 0) { retryNo = 0; } - request.get(this.listsForUserUrl.replace(/\{userid\}/g, this.userid), this.requestGetOptions(), function (err, res, response) { - if (err) { - if (retryNo < 3) { - setTimeout(function () { _this.getListsForUser(callback, ++retryNo); }, 1000); - } - else { - _this.logger.logError("Unexpected error connecting to bringList: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - setTimeout(function () { _this.getListsForUser(callback); }, 1800000); - } + let response, data + try { + response = await _this.lib.fetch(this.listsForUserUrl.replace(/\{userid\}/g, this.userid), this.fetchGetOptions()) + data = await response.json() + } catch (err) { + if (retryNo < 3) { + setTimeout(function () { _this.getListsForUser(callback, ++retryNo); }, 1000); + } else { + _this.logger.logError("Unexpected error connecting to bringList: " + err + ". Hopefully temporary. Will retry in 30 minutes."); + setTimeout(function () { _this.getListsForUser(callback); }, 1800000); } - else if (res && res.statusCode != 200) { - _this.logger.logError("Received unexpected status code from bring server when loading Lists for User: " + res.statusCode); + } + + if (response && response.status != 200) { + _this.logger.logError("Received unexpected status code from bring server when loading Lists for User: " + response.statusCode); + } else { + if (data.lists) { + data.lists.forEach(function (item) { + if (_this.userLists.filter(function (l) { return l.listId === item.listUuid; }).length === 0) { + _this.userLists.push({ hash: '', items: [], listId: item.listUuid, listName: item.name }); + } + }); + callback(); } else { - if (response.lists) { - response.lists.forEach(function (item) { - if (_this.userLists.filter(function (l) { return l.listId === item.listUuid; }).length === 0) { - _this.userLists.push({ hash: '', items: [], listId: item.listUuid, listName: item.name }); - } - }); - callback(); - } - else { - _this.logger.logError("Could not find 'lists' Element in Response from bring: " + JSON.stringify(response)); - } + _this.logger.logError("Could not find 'lists' Element in Response from bring: " + data); } - }); + } }; - BringProfile.prototype.initializeCatalog = function (callback, retryNo) { + + BringProfile.prototype.initializeCatalog = async function (callback, retryNo) { var _this = this; if (retryNo === void 0) { retryNo = 0; } - request.get({ url: this.catalogUrl, json: true, rejectUnauthorized: false }, function (err, res, body) { - if (err) { - if (retryNo < 3) { - setTimeout(function () { _this.initializeCatalog(callback, ++retryNo); }, 1000); - } - else { - _this.logger.logError("Unexpected error during download of Catalog: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - setTimeout(function () { _this.initializeCatalog(callback); }, 1800000); - } + let response, data + try { + response = await _this.lib.fetch(this.catalogUrl), { + agent: _this.httpsAgent, } - else { - _this.catalog = body.catalog; - callback(); + data = await response.json() + } catch (err) { + if (retryNo < 3) { + setTimeout(function () { _this.initializeCatalog(callback, ++retryNo); }, 1000); + } else { + _this.logger.logError("Unexpected error during download of Catalog: " + err + ". Hopefully temporary. Will retry in 30 minutes."); + setTimeout(function () { _this.initializeCatalog(callback); }, 1800000); } - }); + } + _this.catalog = data.catalog; + callback(); }; - BringProfile.prototype.initializeArticleLocalization = function (callback, retryNo) { + + BringProfile.prototype.initializeArticleLocalization = async function (callback, retryNo) { var _this = this; if (retryNo === void 0) { retryNo = 0; } this.articleLocalization = []; - request.get({ url: this.articleLocalizationUrl, json: true, rejectUnauthorized: false }, function (err, res, body) { - if (err) { - if (retryNo < 3) { - setTimeout(function () { _this.initializeArticleLocalization(callback, ++retryNo); }, 1000); - } - else { - _this.logger.logError("Unexpected error during download of ArticleLocalization: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - setTimeout(function () { _this.initializeArticleLocalization(callback); }, 1800000); - } + let response, data + try { + response = await _this.lib.fetch(this.articleLocalizationUrl), { + agent: _this.httpsAgent, } - for (var key in body) { - if (Object.prototype.hasOwnProperty.call(body, key)) { - var val = body[key]; - _this.articleLocalization.push({ key: key, value: val }); - } + data = await response.json() + } catch (err) { + if (retryNo < 3) { + setTimeout(function () { _this.initializeArticleLocalization(callback, ++retryNo); }, 1000); + } else { + _this.logger.logError("Unexpected error during download of ArticleLocalization: " + err + ". Hopefully temporary. Will retry in 30 minutes."); + setTimeout(function () { _this.initializeArticleLocalization(callback); }, 1800000); } - callback(); - }); + } + for (var key in data) { + if (Object.prototype.hasOwnProperty.call(data, key)) { + var val = data[key]; + _this.articleLocalization.push({ key: key, value: val }); + } + } + callback(); }; - BringProfile.prototype.login = function (callback, retryNo) { + + BringProfile.prototype.login = async function (callback, retryNo) { var _this = this; if (retryNo === void 0) { retryNo = 0; } var authenticationperformed = false; + let response, data if (!this.articleLocalization) { this.initializeArticleLocalization(function () { if (_this.catalog && authenticationperformed) { @@ -127,31 +138,40 @@ var BringProfile = /** @class */ (function () { } }); } - request.post({ url: this.authUrl, form: { email: this.email, password: this.password } }, function (err, res, body) { - if (err) { - if (retryNo < 3) { - _this.login(callback, ++retryNo); - } - else { - _this.logger.logError("Unexpected error when connecting to bring server: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - setTimeout(function () { _this.login(callback); }, 1800000); - } - } - else if (res && res.statusCode == 401) { - _this.logger.logError("Could not authenticate to bringList."); + + const params = new URLSearchParams(); + params.append("email", this.email) + params.append("password", this.password) + + try { + response = await _this.lib.fetch(this.authUrl, { + method: "POST", + body: params + }) + data = await response.json() + } catch (err) { + if (retryNo < 3) { + _this.login(callback, ++retryNo); } else { - var result = JSON.parse(body); - _this.access_token = result.access_token; - _this.userid = result.uuid; - _this.getListsForUser(function () { - if (_this.articleLocalization && _this.catalog) { - callback(); - } - }); + _this.logger.logError("Unexpected error when connecting to bring server: " + err + ". Hopefully temporary. Will retry in 30 minutes."); + setTimeout(function () { _this.login(callback); }, 1800000); } - }); + } + + if (response && response.status == 401) { + _this.logger.logError("Could not authenticate to bringList."); + } else { + _this.access_token = data.access_token; + _this.userid = data.uuid; + _this.getListsForUser(function () { + if (_this.articleLocalization && _this.catalog) { + callback(); + } + }); + } }; + BringProfile.prototype.loadList = function (listName, done) { var _this = this; if (!this.access_token || !this.catalog || !this.articleLocalization) { @@ -161,6 +181,7 @@ var BringProfile = /** @class */ (function () { this.executeListFetch(listName, done); } }; + BringProfile.prototype.executeListFetch = function (listName, done) { var list = this.userLists.filter(function (l) { return l.listName === listName; })[0]; if (list && list.listId) { @@ -170,74 +191,81 @@ var BringProfile = /** @class */ (function () { this.logger.logError('A list with the name "' + listName + '" does not exist in your user Profile. We found the following lists: ' + this.userLists.map(function (l) { return l.listName; }).join(', ')); } }; - BringProfile.prototype.fetchList = function (listId, reauthenticate, done, retryNo) { + + BringProfile.prototype.fetchList = async function (listId, reauthenticate, done, retryNo) { var _this = this; if (retryNo === void 0) { retryNo = 0; } if (!this.access_token && reauthenticate) { this.login(function () { _this.fetchList(listId, false, done); }); } else { - request.get(this.listUrl.replace(/\{listId\}/, listId), this.requestGetOptions(), function (err, res, response) { - if (err) { - if (retryNo < 3) { - setTimeout(function () { _this.fetchList(listId, reauthenticate, done, ++retryNo); }, 1000); - } - else { - _this.logger.logError("Unexpected error when connecting to bring server: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - setTimeout(function () { _this.fetchList(listId, reauthenticate, done); }, 1800000); - } - } - else if (res && res.statusCode == 401 && reauthenticate) { - _this.login(function () { _this.fetchList(listId, false, done); }); - } - else if (res && res.statusCode != 200) { - _this.logger.logError("Received unexpected status code from bring server: " + res.statusCode); - } - else { - var list = _this.userLists.filter(function (l) { return l.listId === listId; })[0]; - list.items = []; - response.purchase.forEach(function (element) { - list.items.push({ name: element.name, localName: _this.getLocalName(element.name), specification: element.specification, iconFileName: "", iconId: "", sectionId: "", imagePath: "" }); - }); - var hashbase = JSON.stringify({ items: list.items, head: list.listName + list.listId }); - var newHash = ts_md5.Md5.hashStr(hashbase); - list.hash = newHash; - done(list); - } - }); - } - }; - BringProfile.prototype.getListDetail = function (list, callback, retryNo) { - var _this = this; - if (retryNo === void 0) { retryNo = 0; } - request.get(this.listItemDetailsUrl.replace(/\{listId\}/, list.listId), this.requestGetOptions(), function (err, res, response) { - if (err) { + let response, data + try { + response = await _this.lib.fetch(this.listUrl.replace(/\{listId\}/, listId), this.fetchGetOptions()) + data = await response.json() + } catch (err) { if (retryNo < 3) { - window.setTimeout(function () { _this.getListDetail(list, callback, ++retryNo); }, 1000); + setTimeout(function () { _this.fetchList(listId, reauthenticate, done, ++retryNo); }, 1000); } else { _this.logger.logError("Unexpected error when connecting to bring server: " + err + ". Hopefully temporary. Will retry in 30 minutes."); - window.setTimeout(function () { _this.getListDetail(list, callback); }, 1800000); + setTimeout(function () { _this.fetchList(listId, reauthenticate, done); }, 1800000); } } - else if (res && res.statusCode != 200) { - _this.logger.logError("Received unexpected status code from bring server: " + res.statusCode); + if (response && response.status == 401 && reauthenticate) { + _this.login(function () { _this.fetchList(listId, false, done); }); + } + else if (response && response.status != 200) { + _this.logger.logError("Received unexpected status code from bring server: " + response.status); } else { - list.items.forEach(function (listItem) { - response.forEach(function (detailElement) { - if (listItem.name == detailElement.itemId) { - listItem.iconId = detailElement.userIconItemId; - listItem.sectionId = detailElement.userSectionId; - } - }); - _this.setIconUrl(listItem); + var list = _this.userLists.filter(function (l) { return l.listId === listId; })[0]; + list.items = []; + data.purchase.forEach(function (element) { + list.items.push({ name: element.name, localName: _this.getLocalName(element.name), specification: element.specification, iconFileName: "", iconId: "", sectionId: "", imagePath: "" }); }); - _this.logger.log("reporting new list", true); - callback(list); + var hashbase = JSON.stringify({ items: list.items, head: list.listName + list.listId }); + var newHash = _this.lib.tsMd5.Md5.hashStr(hashbase); + list.hash = newHash; + done(list); } - }); + } }; + + BringProfile.prototype.getListDetail = async function (list, callback, retryNo) { + var _this = this; + if (retryNo === void 0) { retryNo = 0; } + let response, data + try { + response = await _this.lib.fetch(this.listItemDetailsUrl.replace(/\{listId\}/, list.listId), this.fetchGetOptions()) + data = await response.json() + } catch (err) { + if (retryNo < 3) { + setTimeout(function () { _this.getListDetail(list, callback, ++retryNo); }, 1000); + } + else { + _this.logger.logError("Unexpected error when connecting to bring server: " + err + ". Hopefully temporary. Will retry in 30 minutes."); + setTimeout(function () { _this.getListDetail(list, callback); }, 1800000); + } + } + + if (response && response.status != 200) { + _this.logger.logError("Received unexpected status code from bring server: " + response.status); + } else { + list.items.forEach(function (listItem) { + data.forEach(function (detailElement) { + if (listItem.name == detailElement.itemId) { + listItem.iconId = detailElement.userIconItemId; + listItem.sectionId = detailElement.userSectionId; + } + }); + _this.setIconUrl(listItem); + }); + _this.logger.log("reporting new list", true); + callback(list); + } + }; + BringProfile.prototype.getImagePath = function (imageId) { var filename = imageId.toLowerCase() .replace(' ', '_') @@ -298,11 +326,11 @@ var BringLogger = /** @class */ (function () { } BringLogger.prototype.log = function (message, verbose) { if (!verbose || this.config.debug) { - console.log("[BRING] " + message); + console.log("[BRING] [CORE] " + message); } }; BringLogger.prototype.logError = function (message) { - console.error("[BRING] " + message); + console.error("[BRING] [CORE] " + message); }; return BringLogger; }()); @@ -310,7 +338,8 @@ exports.BringLogger = BringLogger; /** Updater **/ var BringUpdater = /** @class */ (function () { - function BringUpdater() { + function BringUpdater(lib) { + this.lib = lib; this.bringProfiles = []; this.queryJobs = []; } @@ -327,7 +356,7 @@ var BringUpdater = /** @class */ (function () { profile = matchProfiles[0]; } else { - profile = new BringProfile(config.email, config.password, config.language, this.logger); + profile = new BringProfile(config.email, config.password, config.language, this.logger, this.lib); this.bringProfiles.push(profile); } if (matchJobs.length > 0) { diff --git a/components/loadLibraries.js b/components/loadLibraries.js new file mode 100644 index 0000000..d21b06d --- /dev/null +++ b/components/loadLibraries.js @@ -0,0 +1,40 @@ +"use strict" + +/** Load sensible library without black screen **/ +var logBring = (...args) => { /* do nothing */ } + +function libraries(that) { + if (that.config.debug) logBring = (...args) => { console.log("[BRING] [LIB]", ...args) } + let libraries= [ + // { "library to load" : "store library name" } + { "../components/bring-lib.js": "bring" }, + { "ts-md5" : "tsMd5" }, + { "https" : "https" }, + { "fetch" : "fetch" } + ] + let errors = 0 + return new Promise(resolve => { + libraries.forEach(library => { + for (const [name, configValues] of Object.entries(library)) { + let libraryToLoad = name + let libraryName = configValues + + try { + if (!that.lib[libraryName]) { + that.lib[libraryName] = require(libraryToLoad) + logBring("Loaded:", libraryToLoad, "->", "this.lib."+libraryName) + } + } catch (e) { + console.error("[BRING] [LIB]", libraryToLoad, "Loading error!" , e.toString(), e) + that.sendSocketNotification("WARNING" , {library: libraryToLoad }) + errors++ + that.lib.error = errors + } + } + }) + resolve(errors) + console.log("[BRING] [LIB] All libraries loaded!") + }) +} + +exports.libraries = libraries diff --git a/components/parseData.js b/components/parseData.js new file mode 100644 index 0000000..57868d9 --- /dev/null +++ b/components/parseData.js @@ -0,0 +1,112 @@ +"use strict" + +/** parse data from MagicMirror **/ +var _load = require("../components/loadLibraries.js") +var logBring = (...args) => { /* do nothing */ } + +class parseData { + constructor(that) { + this.sendSocketNotification = (...args) => that.sendSocketNotification(...args) + this.lib = { error: 0 } + this.config = {} + this.running= false + this.currentInterval= null + this.intervalTime= 60000 + this.updater = null + } + + async parse(config) { + this.config = config + if (this.config.debug) logBring = (...args) => { console.log("[BRING] [DATA]", ...args) } + this.config.language = await this.languageConfig() + console.log("[BRING] [DATA] Language set to:", this.config.language) + let bugsounet = await _load.libraries(this) + if (bugsounet) { + console.error("[BRING] [DATA] Warning:", bugsounet, "needed library not loaded !") + return + } + this.updater= new this.lib.bring.BringUpdater(this.lib) + this.start() // force to start like v1.0 + } + + start() { + this.updater.register(this.config) + this.intervalTime = Math.max(30000, this.config.updateInterval) + this.stopLoop() + this.ensureLoop() + } + + stop() { + this.updater.unregister(this.config) + if (!this.updater.hasJobs()) { + this.stopLoop() + } + } + + stopLoop () { + if (this.running) { + logBring("Stop.") + clearInterval(this.currentInterval) + this.running = false + this.currentInterval = null + } + } + + ensureLoop () { + if (!this.running) { + logBring("Starting.") + this.running = true + this.updater.refreshLists(list => { + this.sendSocketNotification("UPDATE", list) + }) + this.currentInterval = setInterval(() => { + this.updater.refreshLists(list => { + this.sendSocketNotification("UPDATE", list) + }) + }, this.intervalTime) + } + } + + languageConfig () { + let langDB= { + 0: "fr-FR", + 1: "de-AT", + 2: "de-CH", + 3: "de-DE", + 4: "es-ES", + 5: "en-GB", + 6: "en-US", + 7: "en-CA", + 8: "en-AU", + 9: "fr-CH", + 10: "fr-FR", + 11: "it-CH", + 12: "it-IT", + 13: "pt-BR", + 14: "nl-NL", + 15: "hu-HU", + 16: "nb-NO", + 17: "pl-PL", + 18: "ru-RU", + 19: "sv-SE", + 20: "tr-TR" + } + if (this.config.lang === 0) return "fr-FR" + else if (!this.config.lang || isNaN(this.config.lang) || (this.config.lang > Object.keys(langDB).length-1) || (this.config.lang < 0)) { + console.error("[BRING] [DATA] Mismake on config lang... set to fr-Fr") + return "fr-FR" + } + + return new Promise(resolve => { + Object.entries(langDB).some(entry => { + const [number,key] = entry + if (this.config.lang == number) { + resolve(key) + return key // stop process if match + } + }) + }) + } +} + +module.exports = parseData diff --git a/installer/minify.js b/installer/minify.js new file mode 100644 index 0000000..4e3f2bd --- /dev/null +++ b/installer/minify.js @@ -0,0 +1,66 @@ +/** Code minifier v1.2 **/ +/** 2023/02/28 **/ +/** @busgounet **/ + +const check = require("check-node-version") +const fs = require('fs') +const { globSync } = require('glob') + +var files = [ + "../" + require("../package.json").main, + "../node_helper.js", +] + +function searchFiles() { + let components = globSync('../components/*.js') + files = files.concat(components) + console.log("Found: " + files.length + " files to minify\n") +} + +// import minify +async function loadMinify() { + const loaded = await import('minify') + return loaded +} + +// minify files array +async function minifyFiles() { + const {minify} = await loadMinify() + searchFiles() + files.forEach(file => { + new Promise(resolve => { + minify(file) + .then(data => { + console.log("Process File:", file) + try { + fs.writeFileSync(file, data) + } catch(err) { + console.error("Writing Error: " + err) + } + resolve() + }) + .catch( error => { + console.log("File:", file, " -- Error Detected:", error) + resolve() // continue next file + }) + }) + }) +} + +check( + { node: ">= 14.0", }, + (error, result) => { + if (error) { + console.error(error) + return + } + if (!result.isSatisfied) { + console.error("Warn: Master code optimization error!"); + console.error("Needed node >= 14.0"); + console.error("If you want to optimize really, you have use node v14.0 (or more)"); + console.error("Info: Don't worry, this step is not compulsory!") + } else { + minifyFiles() + } + } +) diff --git a/installer/postinstall.sh b/installer/postinstall.sh index d78c1e4..275fc63 100755 --- a/installer/postinstall.sh +++ b/installer/postinstall.sh @@ -20,13 +20,17 @@ Installer_dir="$(Installer_get_current_dir)" cd "$Installer_dir" source utils.sh +Installer_info "Minify Main code" +node minify.js +Installer_success "Done" +echo + # Go back to module root cd .. # module name Installer_module="$(grep -Eo '\"name\"[^,]*' ./package.json | grep -Eo '[^:]*$' | awk -F'\"' '{print $2}')" - # the end... Installer_warning "Support is now moved in a dedicated Server: https://forum.bugsounet.fr" Installer_warning "@bugsounet" diff --git a/node_helper.js b/node_helper.js index a119447..d820942 100644 --- a/node_helper.js +++ b/node_helper.js @@ -8,71 +8,28 @@ **/ var NodeHelper = require("node_helper"); -var bring = require("./lib/bring-lib"); +var parseData = require("./components/parseData.js") var logBring = (...args) => { /* do nothing */ } module.exports = NodeHelper.create({ start: function () { - this.updater= new bring.BringUpdater() - this.running= false - this.currentInterval= null - this.intervalTime= 60000 + this.parseData = new parseData(this) }, socketNotificationReceived: function (notification, payload) { switch (notification) { case "INIT": this.config = payload - if (payload.debug) logBring = (...args) => { console.log("[BRING]", ...args) } - console.log("[BRINGS] " + require('./package.json').name + " Version:", require('./package.json').version , "rev:", require('./package.json').rev) - this.initialize() + if (this.config.debug) logBring = (...args) => { console.log("[BRING]", ...args) } + console.log("[BRING] " + require('./package.json').name + " Version:", require('./package.json').version , "rev:", require('./package.json').rev) + this.parseData.parse(this.config) break - case "EXT-Bring-REGISTER": - logBring("Received registration demand.") - this.initialize() + case "START": + this.parseData.start() break - case "EXT-Bring-SUSPEND": - logBring("Suspended.") - this.updater.unregister(this.config) - if (!this.updater.hasJobs()) { - this.stopLoop() - } + case "STOP": + this.parseData.stop() break } - }, - - initialize: function() { - this.updater.register(this.config) - this.intervalTime = Math.max(30000, this.config.updateInterval) - this.stopLoop() - this.ensureLoop() - }, - - stopLoop: function () { - if (this.running) { - logBring("Stop.") - clearInterval(this.currentInterval) - this.running = false - this.currentInterval = null - } - }, - - ensureLoop: function () { - if (!this.running) { - logBring("Starting.") - this.running = true - this.updater.refreshLists(l => { - this.sendSocketNotification("EXT-Bring-LISTUPDATE", l) - }) - this.currentInterval = setInterval(() => { - this.updater.refreshLists(l => { - this.sendSocketNotification("EXT-Bring-LISTUPDATE", l) - }) - }, this.intervalTime) - } - }, - - stop: function () { - this.stopLoop() } }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f2861f9 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,756 @@ +{ + "name": "EXT-Bring", + "version": "1.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "EXT-Bring", + "version": "1.1.0", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "check-node-version": "^4.2.1", + "glob": "^9.2.1", + "https": "^1.0.0", + "minify": "^9.2.0", + "node-fetch": "^3.3.1", + "ts-md5": "^1.3.1" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/check-node-version": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.2.1.tgz", + "integrity": "sha512-YYmFYHV/X7kSJhuN/QYHUu998n/TRuDe8UenM3+m5NrkiH670lb9ILqHIvBencvJc4SDh+XcbXMR4b+TtubJiw==", + "dependencies": { + "chalk": "^3.0.0", + "map-values": "^1.0.1", + "minimist": "^1.2.0", + "object-filter": "^1.0.2", + "run-parallel": "^1.1.4", + "semver": "^6.3.0" + }, + "bin": { + "check-node-version": "bin.js" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/clean-css": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.2.tgz", + "integrity": "sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/css-b64-images": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/css-b64-images/-/css-b64-images-0.2.5.tgz", + "integrity": "sha512-TgQBEdP07adhrDfXvI5o6bHGukKBNMzp2Ngckc/6d09zpjD2gc1Hl3Ca1CKgb8FXjHi88+Phv2Uegs2kTL4zjg==", + "bin": { + "css-b64-images": "bin/css-b64-images" + }, + "engines": { + "node": "*" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/glob": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.2.tgz", + "integrity": "sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "minimatch": "^7.4.1", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/html-minifier-terser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.1.0.tgz", + "integrity": "sha512-BvPO2S7Ip0Q5qt+Y8j/27Vclj6uHC6av0TMoDn7/bJPhMWHI2UtR2e/zEgJn3/qYAmxumrGp9q4UHurL6mtW9Q==", + "dependencies": { + "camel-case": "^4.1.2", + "clean-css": "5.2.0", + "commander": "^9.4.1", + "entities": "^4.4.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.15.1" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + } + }, + "node_modules/html-minifier-terser/node_modules/clean-css": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz", + "integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, + "node_modules/https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz", + "integrity": "sha512-4EC57ddXrkaF0x83Oj8sM6SLQHAWXw90Skqu2M4AEWENZ3F02dFJE/GARA8igO79tcgYqGrD7ae4f5L3um2lgg==" + }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==" + }, + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/map-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-values/-/map-values-1.0.1.tgz", + "integrity": "sha512-BbShUnr5OartXJe1GeccAWtfro11hhgNJg6G9/UtWKjVGvV5U4C09cg5nk8JUevhXODaXY+hQ3xxMUKSs62ONQ==" + }, + "node_modules/minify": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/minify/-/minify-9.2.0.tgz", + "integrity": "sha512-dfVx8j27TIZy2EE/nVMAhTVmUo6tdO4gYbKXaCYPUmpqWN2QJBgQtPfofsoA658L3Ee7e5OcyFIncJRgFtZcqQ==", + "dependencies": { + "clean-css": "^5.0.1", + "css-b64-images": "~0.2.5", + "debug": "^4.1.0", + "find-up": "^6.1.0", + "html-minifier-terser": "^7.1.0", + "readjson": "^2.2.2", + "simport": "^1.2.0", + "terser": "^5.3.2", + "try-catch": "^3.0.0", + "try-to-catch": "^3.0.0" + }, + "bin": { + "minify": "bin/minify.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/minimatch": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.3.tgz", + "integrity": "sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", + "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", + "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/object-filter": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/object-filter/-/object-filter-1.0.2.tgz", + "integrity": "sha512-NahvP2vZcy1ZiiYah30CEPw0FpDcSkSePJBMpzl5EQgCmISijiGuJm3SPYp7U+Lf2TljyaIw3E5EgkEx/TNEVA==" + }, + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-scurry": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.3.tgz", + "integrity": "sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g==", + "dependencies": { + "lru-cache": "^7.14.1", + "minipass": "^4.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/readjson": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/readjson/-/readjson-2.2.2.tgz", + "integrity": "sha512-PdeC9tsmLWBiL8vMhJvocq+OezQ3HhsH2HrN7YkhfYcTjQSa/iraB15A7Qvt7Xpr0Yd2rDNt6GbFwVQDg3HcAw==", + "dependencies": { + "jju": "^1.4.0", + "try-catch": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/simport": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/simport/-/simport-1.2.0.tgz", + "integrity": "sha512-85Bm7pKsqiiQ8rmYCaPDdlXZjJvuW6/k/FY8MTtLFMgU7f8S00CgTHfRtWB6KwSb6ek4p9YyG2enG1+yJbl+CA==", + "dependencies": { + "readjson": "^2.2.0", + "try-to-catch": "^3.0.0" + }, + "engines": { + "node": ">=12.2" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/terser": { + "version": "5.16.6", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.6.tgz", + "integrity": "sha512-IBZ+ZQIA9sMaXmRZCUMDjNH0D5AQQfdn4WUjHL0+1lF4TP1IHRJbrhb6fNaXWikrYQTSkb7SLxkeXAiy1p7mbg==", + "dependencies": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/try-catch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/try-catch/-/try-catch-3.0.1.tgz", + "integrity": "sha512-91yfXw1rr/P6oLpHSyHDOHm0vloVvUoo9FVdw8YwY05QjJQG9OT0LUxe2VRAzmHG+0CUOmI3nhxDUMLxDN/NEQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/try-to-catch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/try-to-catch/-/try-to-catch-3.0.1.tgz", + "integrity": "sha512-hOY83V84Hx/1sCzDSaJA+Xz2IIQOHRvjxzt+F0OjbQGPZ6yLPLArMA0gw/484MlfUkQbCpKYMLX3VDCAjWKfzQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ts-md5": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz", + "integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json index 304db34..15b424a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,15 @@ { "name": "EXT-Bring", - "version": "1.0.1", - "rev": "230312", + "version": "1.1.0", + "rev": "230322", "description": "Displays Your Bring! List", "main": "EXT-Bring.js", "scripts": { "preinstall": "installer/preinstall.sh", "postinstall": "installer/postinstall.sh", - "update": "installer/update.sh" + "update": "installer/update.sh", + "reset": "git reset --hard", + "clean": "rm -rf node_modules package-lock.json" }, "authors": [ "Robert Seidt", @@ -22,7 +24,11 @@ "url": "https://forum.bugsounet.fr" }, "dependencies": { - "request": "2.88.2", - "ts-md5": "1.2.9" + "check-node-version": "^4.2.1", + "glob": "^9.2.1", + "https": "^1.0.0", + "minify": "^9.2.0", + "node-fetch": "^3.3.1", + "ts-md5": "^1.3.1" } }