iobroker.ical 1.13.0 → 1.13.1
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.
- package/README.md +3 -3
- package/admin/jsonConfig.json +4 -2
- package/io-package.json +13 -13
- package/lib/adapter-config.d.ts +19 -0
- package/main.js +56 -38
- package/package.json +19 -9
package/README.md
CHANGED
|
@@ -26,6 +26,9 @@ Siehe deutsche [Version hier](docs/de/README.md).
|
|
|
26
26
|
Placeholder for the next version (at the beginning of the line):
|
|
27
27
|
### **WORK IN PROGRESS**
|
|
28
28
|
-->
|
|
29
|
+
### 1.13.1 (2022-06-27)
|
|
30
|
+
* (klein0r) Changed request library
|
|
31
|
+
|
|
29
32
|
### 1.13.0 (2022-06-17)
|
|
30
33
|
* (klein0r) Added Admin 5 UI
|
|
31
34
|
* (klein0r) Translated all object names
|
|
@@ -46,9 +49,6 @@ Siehe deutsche [Version hier](docs/de/README.md).
|
|
|
46
49
|
* (Apollon77) Respect DST changes in some calculations to prevent strange effects
|
|
47
50
|
* (Apollon77) Parse ics Files with different line endings again
|
|
48
51
|
|
|
49
|
-
### 1.11.6 (2021-12-17)
|
|
50
|
-
* (jens-maus) fixed incorrect recurrence event processing
|
|
51
|
-
|
|
52
52
|
## License
|
|
53
53
|
|
|
54
54
|
The MIT License (MIT)
|
package/admin/jsonConfig.json
CHANGED
|
@@ -232,7 +232,9 @@
|
|
|
232
232
|
"default": false
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
|
-
"type": "
|
|
235
|
+
"type": "password",
|
|
236
|
+
"repeat": false,
|
|
237
|
+
"visible": false,
|
|
236
238
|
"attr": "pass",
|
|
237
239
|
"width": "10%",
|
|
238
240
|
"title": {
|
|
@@ -384,7 +386,7 @@
|
|
|
384
386
|
},
|
|
385
387
|
"filter": false,
|
|
386
388
|
"sort": false,
|
|
387
|
-
"default":
|
|
389
|
+
"default": true
|
|
388
390
|
},
|
|
389
391
|
{
|
|
390
392
|
"type": "objectId",
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "ical",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.13.1": {
|
|
7
|
+
"en": "Changed request library",
|
|
8
|
+
"de": "Bibliothek der geänderten Anfrage",
|
|
9
|
+
"ru": "Измененная библиотека запросов",
|
|
10
|
+
"pt": "Biblioteca de solicitação alterada",
|
|
11
|
+
"nl": "Verandering van verzoek bibliotheek",
|
|
12
|
+
"fr": "Changed request library",
|
|
13
|
+
"it": "Libreria richiesta modificata",
|
|
14
|
+
"es": "Biblioteca de solicitud modificada",
|
|
15
|
+
"pl": "Zmiennikowa biblioteka",
|
|
16
|
+
"zh-cn": "更改要求图书馆"
|
|
17
|
+
},
|
|
6
18
|
"1.13.0": {
|
|
7
19
|
"en": "Added Admin 5 UI\nTranslated all object names",
|
|
8
20
|
"de": "Admin 5 UI\nAlle Objektnamen übersetzt",
|
|
@@ -74,18 +86,6 @@
|
|
|
74
86
|
"es": "actualizado node-ical a la última versión 0.14.1\nsolucionar otro problema en el que un evento ya finalizado todavía aparece en la lista",
|
|
75
87
|
"pl": "zaktualizowano węzeł-ical do najnowszej wersji 0.14.1\nnapraw inny problem, w którym już zakończone wydarzenie jest nadal na liście",
|
|
76
88
|
"zh-cn": "将 node-ical 更新为最新的 0.14.1\n修复另一个问题,即仍列出已结束的事件"
|
|
77
|
-
},
|
|
78
|
-
"1.11.4": {
|
|
79
|
-
"en": "fix cases where already ended entries where still listed\nfix reported sentry crash cases (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
80
|
-
"de": "Fälle beheben, in denen bereits beendete Einträge noch aufgelistet wurden\ngemeldete Sentry-Crash-Fälle beheben (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
81
|
-
"ru": "исправить случаи, когда уже законченные записи все еще перечислены\nисправить зарегистрированные случаи аварийного завершения работы часового (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
82
|
-
"pt": "corrigir casos em que entradas já encerradas e ainda listadas\ncorrigir casos relatados de acidentes de sentinela (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
83
|
-
"nl": "repareer gevallen waarin reeds beëindigde vermeldingen nog steeds worden vermeld\nrepareer gerapporteerde crashgevallen van schildwachten (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
84
|
-
"fr": "corriger les cas où les entrées déjà terminées étaient toujours répertoriées\ncorrection des cas de plantage de sentinelle signalés (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
85
|
-
"it": "correggere i casi in cui le voci già terminate erano ancora elencate\ncorreggere i casi di crash di sentinella segnalati (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
86
|
-
"es": "Corregir casos en los que las entradas ya finalizadas todavía estaban en la lista.\narreglar casos de accidentes de centinela notificados (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
87
|
-
"pl": "napraw przypadki, w których już zakończone wpisy były nadal wymienione\nnaprawiono zgłoszone przypadki awarii wartowników (IOBROKER-ICAL-S, IOBROKER-ICAL-N)",
|
|
88
|
-
"zh-cn": "修复已经结束的条目仍然列出的情况\n修复报告的哨兵崩溃案例(IOBROKER-ICAL-S、IOBROKER-ICAL-N)"
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"title": "iCal Calendar",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// This file extends the AdapterConfig type from "@types/iobroker"
|
|
2
|
+
// using the actual properties present in io-package.json
|
|
3
|
+
// in order to provide typings for adapter.config properties
|
|
4
|
+
|
|
5
|
+
import { native } from '../io-package.json';
|
|
6
|
+
|
|
7
|
+
type _AdapterConfig = typeof native;
|
|
8
|
+
|
|
9
|
+
// Augment the globally declared type ioBroker.AdapterConfig
|
|
10
|
+
declare global {
|
|
11
|
+
namespace ioBroker {
|
|
12
|
+
interface AdapterConfig extends _AdapterConfig {
|
|
13
|
+
// Do not enter anything here!
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// this is required so the above AdapterConfig is found by TypeScript / type checking
|
|
19
|
+
export {};
|
package/main.js
CHANGED
|
@@ -22,7 +22,9 @@ const crypto = require('crypto');
|
|
|
22
22
|
const fs = require('fs');
|
|
23
23
|
const path = require('path');
|
|
24
24
|
const adapterName = require('./package.json').name.split('.').pop();
|
|
25
|
-
const
|
|
25
|
+
const axios = require('axios').default;
|
|
26
|
+
const https = require('https');
|
|
27
|
+
|
|
26
28
|
let adapter;
|
|
27
29
|
let stopped = false;
|
|
28
30
|
let killTimeout = null;
|
|
@@ -172,59 +174,73 @@ function getICal(urlOrFile, user, pass, sslignore, calName, cb) {
|
|
|
172
174
|
} else {
|
|
173
175
|
// Find out whether SSL certificate errors shall be ignored
|
|
174
176
|
const options = {
|
|
175
|
-
|
|
177
|
+
method: 'get',
|
|
178
|
+
url: urlOrFile
|
|
176
179
|
};
|
|
177
180
|
|
|
178
181
|
if (sslignore === 'ignore' || sslignore === 'true' || sslignore === true) {
|
|
179
|
-
options.
|
|
182
|
+
options.httpsAgent = new https.Agent({
|
|
183
|
+
rejectUnauthorized: false
|
|
184
|
+
});
|
|
180
185
|
}
|
|
181
186
|
|
|
182
187
|
if (user) {
|
|
183
188
|
options.auth = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
sendImmediately: true
|
|
189
|
+
username: user,
|
|
190
|
+
password: pass
|
|
187
191
|
};
|
|
188
192
|
}
|
|
189
193
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
let cachedContent;
|
|
196
|
-
let cachedDate;
|
|
197
|
-
try {
|
|
198
|
-
if (fs.existsSync(cachedFilename)) {
|
|
199
|
-
cachedContent = fs.readFileSync(cachedFilename, 'utf-8');
|
|
200
|
-
const stat = fs.statSync(cachedFilename);
|
|
201
|
-
cachedDate = stat.mtime;
|
|
202
|
-
}
|
|
203
|
-
} catch (err) {
|
|
204
|
-
adapter.log.info(`Cannot read cached calendar file for "${urlOrFile}": ${err.message}`);
|
|
205
|
-
}
|
|
206
|
-
if (err) {
|
|
207
|
-
adapter.log.warn(`Error reading from URL "${urlOrFile}": ${(err && err.code === 'ENOTFOUND') ? 'address not found!' : err}`);
|
|
208
|
-
if (!cachedContent) {
|
|
209
|
-
return cb && cb(err || `Cannot read URL: "${urlOrFile}"`);
|
|
210
|
-
}
|
|
211
|
-
} else if (r) {
|
|
212
|
-
adapter.log.warn(`Error reading from URL "${urlOrFile}": Server responded HTTP-Statuscode=${r.statusCode}: ${_data}`);
|
|
213
|
-
if (!cachedContent) {
|
|
214
|
-
return cb && cb(`Cannot read URL: "${urlOrFile}" HTTP-Status ${r.statusCode}`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
adapter.log.info(`Use cached File content for for "${urlOrFile}" from ${cachedDate}`);
|
|
218
|
-
cb && cb(null, cachedContent);
|
|
219
|
-
} else {
|
|
194
|
+
const calHash = crypto.createHash('md5').update(user + pass + urlOrFile).digest('hex');
|
|
195
|
+
const cachedFilename = path.join(__dirname, calHash);
|
|
196
|
+
|
|
197
|
+
axios(options).then(function (response) {
|
|
198
|
+
if (response.data) {
|
|
220
199
|
try {
|
|
221
|
-
fs.writeFileSync(cachedFilename,
|
|
200
|
+
fs.writeFileSync(cachedFilename, response.data, 'utf-8');
|
|
222
201
|
adapter.log.debug(`Successfully cached content for calendar "${urlOrFile}" as ${cachedFilename}`);
|
|
223
202
|
} catch (err) {
|
|
224
203
|
// Ignore
|
|
225
204
|
}
|
|
226
|
-
|
|
205
|
+
|
|
206
|
+
cb && cb(null, response.data);
|
|
207
|
+
} else {
|
|
208
|
+
cb && cb(`Error reading from URL "${urlOrFile}": Received no data`);
|
|
209
|
+
}
|
|
210
|
+
}).catch(error => {
|
|
211
|
+
let cachedContent;
|
|
212
|
+
let cachedDate;
|
|
213
|
+
|
|
214
|
+
if (error.response) {
|
|
215
|
+
// The request was made and the server responded with a status code
|
|
216
|
+
// that falls out of the range of 2xx
|
|
217
|
+
adapter.log.warn(`Error reading from URL "${urlOrFile}": ${error.response.status}`);
|
|
218
|
+
} else if (error.request) {
|
|
219
|
+
// The request was made but no response was received
|
|
220
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
221
|
+
// http.ClientRequest in node.js
|
|
222
|
+
adapter.log.warn(`Error reading from URL "${urlOrFile}"`);
|
|
223
|
+
} else {
|
|
224
|
+
// Something happened in setting up the request that triggered an Error
|
|
225
|
+
adapter.log.warn(`Error reading from URL "${urlOrFile}": ${error.message}`);
|
|
227
226
|
}
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
if (fs.existsSync(cachedFilename)) {
|
|
230
|
+
cachedContent = fs.readFileSync(cachedFilename, 'utf-8');
|
|
231
|
+
const stat = fs.statSync(cachedFilename);
|
|
232
|
+
cachedDate = stat.mtime;
|
|
233
|
+
}
|
|
234
|
+
} catch (err) {
|
|
235
|
+
adapter.log.info(`Cannot read cached calendar file for "${urlOrFile}": ${err.message}`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!cachedContent) {
|
|
239
|
+
return cb && cb(`Cannot read URL: "${urlOrFile}"`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
adapter.log.info(`Use cached File content for "${urlOrFile}" from ${cachedDate}`);
|
|
243
|
+
cb && cb(null, cachedContent);
|
|
228
244
|
});
|
|
229
245
|
}
|
|
230
246
|
}
|
|
@@ -1430,6 +1446,8 @@ async function displayDates() {
|
|
|
1430
1446
|
}
|
|
1431
1447
|
}
|
|
1432
1448
|
|
|
1449
|
+
adapter.log.debug(`Dates array (data.table): ${JSON.stringify(datesArray)}`);
|
|
1450
|
+
|
|
1433
1451
|
await adapter.setStateAsync('data.table', {val: JSON.stringify(datesArray), ack: true});
|
|
1434
1452
|
await adapter.setStateAsync('data.html', {val: brSeparatedList(datesArray), ack: true});
|
|
1435
1453
|
await adapter.setStateAsync('data.text', {val: crlfSeparatedList(datesArray), ack: true});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.ical",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Allows read information from google calender and from iCal.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -37,24 +37,35 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@iobroker/adapter-core": "^2.6.0",
|
|
40
|
-
"
|
|
40
|
+
"axios": "^0.27.2",
|
|
41
41
|
"cloneextend": "^0.0.3",
|
|
42
|
-
"request": "^2.88.2",
|
|
43
42
|
"json-schema": "^0.4.0",
|
|
43
|
+
"node-ical": "^0.15.1",
|
|
44
44
|
"rrule": "2.6.9"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@alcalzone/release-script": "^3.5.9",
|
|
48
48
|
"@alcalzone/release-script-plugin-iobroker": "^3.5.9",
|
|
49
49
|
"@alcalzone/release-script-plugin-license": "^3.5.9",
|
|
50
|
-
"@iobroker/testing": "^2.6.0",
|
|
51
50
|
"@iobroker/adapter-dev": "^1.0.0",
|
|
51
|
+
"@iobroker/testing": "^3.0.2",
|
|
52
|
+
"@types/chai": "^4.3.1",
|
|
53
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
54
|
+
"@types/mocha": "^9.1.1",
|
|
55
|
+
"@types/node": "^18.0.0",
|
|
56
|
+
"@types/proxyquire": "^1.3.28",
|
|
57
|
+
"@types/sinon": "^10.0.11",
|
|
58
|
+
"@types/sinon-chai": "^3.2.8",
|
|
52
59
|
"chai": "^4.3.6",
|
|
60
|
+
"chai-as-promised": "^7.1.1",
|
|
53
61
|
"chai-string": "^1.5.0",
|
|
54
|
-
"eslint": "^8.
|
|
62
|
+
"eslint": "^8.18.0",
|
|
63
|
+
"luxon": "^2.4.0",
|
|
55
64
|
"mocha": "^10.0.0",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
65
|
+
"proxyquire": "^2.1.3",
|
|
66
|
+
"sinon": "^14.0.0",
|
|
67
|
+
"sinon-chai": "^3.7.0",
|
|
68
|
+
"typescript": "~4.7.4"
|
|
58
69
|
},
|
|
59
70
|
"bugs": {
|
|
60
71
|
"url": "https://github.com/iobroker-community-adapters/ioBroker.ical/issues"
|
|
@@ -70,9 +81,8 @@
|
|
|
70
81
|
"main.js"
|
|
71
82
|
],
|
|
72
83
|
"scripts": {
|
|
73
|
-
"test:js": "mocha --
|
|
84
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
74
85
|
"test:package": "mocha test/package --exit",
|
|
75
|
-
"test:unit": "mocha test/unit --exit",
|
|
76
86
|
"test:integration": "mocha test/integration --exit",
|
|
77
87
|
"test": "npm run test:js && npm run test:package",
|
|
78
88
|
"lint": "eslint",
|