Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.parser

Package Overview
Dependencies
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.parser - npm Package Compare versions

Comparing version 1.1.8 to 1.2.0

7

admin/i18n/en/translations.json

@@ -42,3 +42,6 @@ {

"temperature": "temperature",
"value": "value"
}
"value": "value",
"Request Timeout": "Request Timeout",
"Accept invalid certificates": "Accept invalid certificates",
"Use insecure HTTP parser": "Use insecure HTTP parser"
}
{
"common": {
"name": "parser",
"version": "1.1.8",
"version": "1.2.0",
"news": {
"1.2.0": {
"en": "Allow to specify if self-signed/invalid SSL certificates are ignored or not (default is to ignore as till now)\nAllow to specify if an \"insecure HTTP parser\" is used which also enables HTTP implementations that are not compliant to specifications\nAllow to specify the HTTP request timeout",
"de": "Geben Sie an, ob selbstsignierte/ungültige SSL-Zertifikate ignoriert oder nicht (Standard ist, wie bisher ignoriert)\nGeben Sie an, ob ein \"unsicherer HTTP-Parser\" verwendet wird, der auch HTTP-Implementierungen ermöglicht, die nicht den Spezifikationen entsprechen\nErlauben Sie, den HTTP-Anforderungszeitpunkt anzugeben",
"ru": "Разрешить указать, если самоподписанные / недействительные SSL сертификаты игнорируются или нет (по умолчанию не следует игнорировать, как до сих пор)\nРазрешить указать, используется ли «небезопасный HTTP-парсер», что также позволяет HTTP-реализациям, которые не соответствуют спецификациям\nРазрешить указать timeout запроса HTTP",
"pt": "Permitir especificar se certificados SSL auto-assinados/inválidos são ignorados ou não (o padrão é ignorar como até agora)\nPermitir especificar se um \"parser HTTP inseguro\" é usado que também permite implementações HTTP que não estão em conformidade com as especificações\nPermitir especificar o prazo de solicitação HTTP",
"nl": "Sta toe te specificeren of zelf toegewezen/invalide SSL certificaten worden genegeerd of niet (default is om te negeren als tot nu toe\nOm te specificeren of een \"onduidelijke HTP-papieren\" gebruikt wordt, die ook HTP implementaties in staat stelt die niet compliceren voor specifieke details\nMag ik de HTP verzoeken verlenen",
"fr": "Permettre de spécifier si les certificats SSL autosignés/invalides sont ignorés ou non (par défaut, il faut ignorer comme maintenant)\nPermet de spécifier si un \"Parser HTTP insecure\" est utilisé qui permet également des implémentations HTTP qui ne sont pas conformes aux spécifications\nPermet de spécifier le délai de requête HTTP",
"it": "Consentire di specificare se i certificati SSL auto-firmati/non validi vengono ignorati o meno (default deve ignorare fino ad ora)\nConsentire di specificare se viene utilizzato un \"insecure HTTP parser\" che consente anche implementazioni HTTP che non sono conformi alle specifiche\nConsentire di specificare il timeout della richiesta HTTP",
"es": "Permitir especificar si los certificados SSL auto-firmados o inválidos son ignorados o no (por defecto es ignorar como hasta ahora)\nPermitir especificar si se utiliza un \"paraser HTTP seguro\" que también permite implementaciones HTTP que no cumplen con las especificaciones\nPermitir especificar el tiempo de solicitud HTTP",
"pl": "Określenie, jeśli podpisywane certyfikaty SSL są ignorowane lub nie (obrona jest ignorowana jak do dziś)\nAllow do specyfikowania, jeśli używa się \"niebezpiecznego HTTP parser\", co umożliwia również implementacje HTTP, które nie są zgodne z specyfikacją\nAllow, aby zdefiniować HTTP żądanie czasu dostępu",
"zh-cn": "请允许我具体说明,如果自我设计/自评的SSL证书遭到忽视或不(现在的意外情况是忽视)\n允许具体说明是否使用了“无保障的HTTP parser”,这也使不符合规格的技术转让中心得以实施。\n允许具体说明海贸总协定要求的时间"
},
"1.1.8": {

@@ -77,14 +89,2 @@ "en": "Check that a link is configured",

"zh-cn": "如果正则表达式不匹配设置定义的替换值(或 null)"
},
"1.1.2": {
"en": "Fix initialization of new parser objects",
"de": "Korrigieren Sie die Initialisierung neuer Parser-Objekte",
"ru": "Исправить инициализацию новых объектов парсера",
"pt": "Corrige a inicialização de novos objetos do analisador",
"nl": "Initialisatie van nieuwe parser-objecten repareren",
"fr": "Correction de l'initialisation des nouveaux objets d'analyseur",
"it": "Correzione dell'inizializzazione di nuovi oggetti parser",
"es": "Arreglar la inicialización de nuevos objetos del analizador.",
"pl": "Napraw inicjalizację nowych obiektów parsera",
"zh-cn": "修复新解析器对象的初始化"
}

@@ -139,2 +139,7 @@ },

],
"globalDependencies": [
{
"admin": ">=3.0.0"
}
],
"extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.parser/master/admin/parser.png",

@@ -152,4 +157,7 @@ "type": "logic",

"native": {
"pollInterval": "5000"
"pollInterval": "5000",
"requestTimeout": "60000",
"acceptInvalidCertificates": true,
"useInsecureHTTPParser": false
}
}

@@ -8,3 +8,4 @@ /* jshint -W097 */// jshint strict:false

const adapter = new utils.Adapter('parser');
let request;
const https = require('https');
let axios;
let path;

@@ -140,2 +141,3 @@ let fs;

function deletePoll(obj) {
if (timers[obj.native.interval] === undefined) return;
timers[obj.native.interval].count--;

@@ -201,3 +203,3 @@ if (!timers[obj.native.interval].count) {

if (obj.native.substituteOld) {
adapter.log.warn('Cannot read link "' + obj.native.link + '": ' + error);
adapter.log.info('Cannot read link "' + obj.native.link + '": ' + error);
if (callback) {

@@ -207,3 +209,3 @@ callback();

} else {
adapter.log.error('Cannot read link "' + obj.native.link + '": ' + error);
adapter.log.warn('Cannot read link "' + obj.native.link + '": ' + error);
if (obj.value.q !== 0x82) {

@@ -306,3 +308,3 @@ obj.value.q = 0x82;

if (obj.native.substitute !== undefined) obj.value.val = obj.native.substitute;
console.log('USe subs: "' + obj.native.substitute + '"');
console.log('Use substitution: "' + obj.native.substitute + '"');

@@ -325,16 +327,21 @@ adapter.setForeignState(obj._id, {val: obj.value.val, q: obj.value.q, ack: obj.value.ack}, callback);

function readLink(link, callback) {
async function readLink(link, callback) {
if (link.match(/^https?:\/\//)) {
request = request || require('request');
axios = axios || require('axios');
adapter.log.debug('Request URL: ' + link);
try {
request({
const res = await axios({
method: 'GET',
url: link,
rejectUnauthorized: false,
timeout: 60000
}, (error, response, body) => callback(!body ? error || JSON.stringify(response) : null, body, link));
httpsAgent: new https.Agent({
rejectUnauthorized: adapter.config.acceptInvalidCertificates === false
}),
insecureHTTPParser: !!adapter.config.useInsecureHTTPParser,
timeout: adapter.config.requestTimeout
});
callback(res.status !== 200 ? res.statusText || JSON.stringify(res.status) : null, res.data, link)
// (error, response, body) => callback(!body ? error || JSON.stringify(response) : null, body, link)
} catch (err) {
callback(err);
callback(err.data ? err.data : err, null, link);
}

@@ -354,3 +361,3 @@ } else {

} catch (e) {
adapter.log.error('Cannot read file "' + link + '": ' + e);
adapter.log.warn('Cannot read file "' + link + '": ' + e);
callback(e, null, link);

@@ -393,2 +400,3 @@ return;

adapter.config.pollInterval = parseInt(adapter.config.pollInterval, 10) || 5000;
adapter.config.requestTimeout = parseInt(adapter.config.requestTimeout, 10) || 60000;

@@ -395,0 +403,0 @@ // read current existing objects (прочитать текущие существующие объекты)

{
"name": "iobroker.parser",
"version": "1.1.8",
"version": "1.2.0",
"description": "Parses web pages and files for values.",

@@ -22,4 +22,4 @@ "author": {

"dependencies": {
"request": "^2.88.2",
"@iobroker/adapter-core": "^2.6.0"
"axios": "^0.27.2",
"@iobroker/adapter-core": "^2.6.2"
},

@@ -30,4 +30,4 @@ "devDependencies": {

"@alcalzone/release-script-plugin-license": "^3.5.9",
"gulp": "^4.0.2",
"axios": "^0.27.2",
"@iobroker/dev-server": "^0.5.0",
"@iobroker/adapter-dev": "^1.0.1",
"mocha": "^9.2.2",

@@ -45,5 +45,6 @@ "chai": "^4.3.6"

"release-minor": "release-script minor --yes",
"release-major": "release-script major --yes"
"release-major": "release-script major --yes",
"translate": "translate-adapter"
},
"license": "MIT"
}

@@ -24,7 +24,17 @@ ![Logo](admin/parser.png)

### 2. Table
### 2. Request timeout
Specify how long the adapter waits for an HTTP response when doing website queries
### 3. Accept invalid certificates
Specify if self-signed/invalid SSL/TLS certificates are accepted or declined when doing HTTPS requests
### 4. Use insecure HTTP parser
Specify to use an insecure HTTP parser that accepts invalid HTTP headers. This may allow interoperability with non-conformant HTTP implementations.
Using the insecure parser should be avoided.
### 5. Table
Click the "Plus" button to add a new entry to the table.
**Performance Note:**
If you enter the same URL or filename more than once into different table rows, and if the values of the column "Interval" are the same, the content of the URL or filename will be retrieved only **once** and cached for proccesing multiple table rows matching URL/filename and Interval. This allows you to apply multiple regex (so multiple table rows) to a single URL or filename, without the need of retrieving the data multiple times from the source.
If you enter the same URL or filename more than once into different table rows, and if the values of the column "Interval" are the same, the content of the URL or filename will be retrieved only **once** and cached for processing multiple table rows matching URL/filename and Interval. This allows you to apply multiple regex (so multiple table rows) to a single URL or filename, without the need of retrieving the data multiple times from the source.

@@ -66,4 +76,2 @@ **Table fields:**

## About Regular expressions (RegExp)

@@ -98,2 +106,4 @@ Regular expressions are a powerful tool to parse and extract certain data from strings, and even more important: it allows to extract certain values/text from a given string (like from the HTML of a webpage, or text from a file) by applying rules.

- (-?\d+) get number (both negative and positive numbers)
- [+-]?([0-9]+.?[0-9]|.[0-9]+) get a number with decimal places (and . as decimal separator)
- [+-]?([0-9]+,?[0-9]|,[0-9]+) get a number with decimal places (and , as decimal separator)

@@ -113,2 +123,7 @@ ## Quality codes

## Changelog
### 1.2.0 (2022-09-12)
* (Apollon77) Allow to specify if self-signed/invalid SSL certificates are ignored or not (default is to ignore as till now)
* (Apollon77) Allow to specify if an "insecure HTTP parser" is used which also enables HTTP implementations that are not compliant to specifications
* (Apollon77) Allow to specify the HTTP request timeout
### 1.1.8 (2022-06-27)

@@ -115,0 +130,0 @@ * (Apollon77) Check that a link is configured

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc