diff --git a/main.js b/main.js index bc7c1a9..8224cd2 100644 --- a/main.js +++ b/main.js @@ -1,21 +1,14 @@ 'use strict'; const utils = require('@iobroker/adapter-core'); -const axios = require('axios'); const crypto = require('crypto'); -const qs = require('qs'); const { URL, URLSearchParams } = require('url'); const base64url = require('base64url'); -const got = require('got'); +//const got = require('got'); const { CookieJar } = require('tough-cookie'); -const axiosCookieJarSupport = require('axios-cookiejar-support').wrapper; -// Erstelle einen neuen CookieJar -const cookieJar = new CookieJar(); - -// Füge CookieJar-Support zu axios hinzu -//axiosCookieJarSupport(axios); +const { got } = await import('got'); -//axios.defaults.headers.common['Access-Control-Expose-Headers'] = 'location'; +const cookieJar = new CookieJar(); class RemehaHomeAdapter extends utils.Adapter { constructor(options) { @@ -23,49 +16,19 @@ class RemehaHomeAdapter extends utils.Adapter { this.cookies = {}; this.account = ''; this.password = ''; - this.pollInterval = 600; + this.pollInterval = 60; this.accessToken = null; this.refreshToken = null; this.csrfToken = null; this.codeVerifier = crypto.randomBytes(32).toString('hex'); this.codeChallenge = ''; this.state = ''; - this.client = axiosCookieJarSupport(axios.create({ - jar: cookieJar, - timeout: 5000, - withCredentials: true, - baseURL: 'https://remehalogin.bdrthermea.net' - })); - - /* this.client = got.extend({ - prefixUrl: 'https://remehalogin.bdrthermea.net', // Basis-URL für alle Anfragen - //responseType: 'text', // Antwort wird automatisch als JSON geparsed - timeout: 5000, // Timeout für Anfragen - //retry: 2, // Anzahl der Wiederholungen bei Fehlern - // Weitere Optionen kannst du hier hinzufügen + prefixUrl: 'https://remehalogin.bdrthermea.net', + timeout: 5000, + cookieJar, }); - */ - - this.client.interceptors.response.use(response => { - const setCookieHeader = response.headers['set-cookie']; - if (setCookieHeader) { - setCookieHeader.forEach(cookieString => { - const [name, ...rest] = cookieString.split(';')[0].split('='); - this.cookies[name] = rest.join('='); - }); - } - return response; - }); - - - - this.client.interceptors.request.use(request => { - console.log('Starting Request', JSON.stringify(request, null, 2)); - return request; - }); - - + this.onReady = this.onReady.bind(this); this.onMessage = this.onMessage.bind(this); this.onStateChange = this.onStateChange.bind(this); @@ -128,7 +91,7 @@ class RemehaHomeAdapter extends utils.Adapter { async poll() { try { - if (!this.accessToken || !await this.checkTokenValidity(this.accessToken)) { + if (this.accessToken === null || await this.checkTokenValidity(this.accessToken) !== 200) { await this.resolveExternalData(); } await this.updateDevices(); @@ -137,51 +100,21 @@ class RemehaHomeAdapter extends utils.Adapter { } } - /* - async generateRandomState() { - const base64 = crypto.randomBytes(32).toString('base64'); - return base64 - .replace(/\+/g, '-') - .replace(/\//g, '_') - .replace(/=+$/, ''); - } - */ - getCookie(name) { return this.cookies[name]; } async resolveExternalData() { try { - //this.state = await this.generateRandomState(); this.state = crypto.randomBytes(32).toString('base64url'); const codeChallenge = await this.generateRandomToken(64); this.codeChallenge = codeChallenge; const codeChallengeSha256 = await this.computeCodeChallenge(codeChallenge); - this.log.debug(`Using state: ${this.state}`); - this.log.debug(`Code challenge: ${codeChallenge}`); - this.log.debug(`Code codeChallengeSha256: ${codeChallengeSha256}`); - - const response = await this.client.get(`/bdrb2cprod.onmicrosoft.com/oauth2/v2.0/authorize`, { - params: { - response_type: 'code', - client_id: '6ce007c6-0628-419e-88f4-bee2e6418eec', - redirect_uri: 'com.b2c.remehaapp://login-callback', - scope: 'openid https://bdrb2cprod.onmicrosoft.com/iotdevice/user_impersonation offline_access', - state: this.state, - code_challenge: codeChallengeSha256, - code_challenge_method: 'S256', - p: 'B2C_1A_RPSignUpSignInNewRoomV3.1', - brand: 'remeha', - lang: 'en', - nonce: 'defaultNonce', - prompt: 'login', - signUp: 'False' - }, - }); - - /* + //this.log.debug(`Using state: ${this.state}`); + //this.log.debug(`Code challenge: ${codeChallenge}`); + //this.log.debug(`Code codeChallengeSha256: ${codeChallengeSha256}`); + const response = await this.client.get(`bdrb2cprod.onmicrosoft.com/oauth2/v2.0/authorize?`, { searchParams: { response_type: 'code', @@ -200,11 +133,9 @@ class RemehaHomeAdapter extends utils.Adapter { }, followRedirect: true, }); - */ - this.log.debug('Response get Auth: ' + response.status); - this.log.debug('Response get header: ' + response.headers); - this.log.debug('x-request-id: ' + response.headers["x-request-id"]); - + + this.log.debug('Response get Auth: ' + response.statusCode); + //this.log.debug('x-request-id: ' + response.headers["x-request-id"]); let csrfTokenCookie; const cookies = response.headers['set-cookie']; @@ -213,41 +144,28 @@ class RemehaHomeAdapter extends utils.Adapter { csrfTokenCookie = cookies.find(cookie => cookie.startsWith('x-ms-cpim-csrf=') && cookie.includes('domain=remehalogin.bdrthermea.net')); if (csrfTokenCookie) { - //this.csrfToken = csrfTokenCookie.split(';')[0].replace("x-ms-cpim-csrf=", "").replace(/;$/, ""); - this.log.debug('csrfToken Alt: ' + csrfTokenCookie.split(';')[0].replace("x-ms-cpim-csrf=", "").replace(/;$/, "")); + this.csrfToken = csrfTokenCookie.split(';')[0].replace("x-ms-cpim-csrf=", "").replace(/;$/, ""); + //this.log.debug('csrfToken: ' + csrfTokenCookie.split(';')[0].replace("x-ms-cpim-csrf=", "").replace(/;$/, "")); } else { throw new Error('CSRF-Token not found in response headers.'); } } - const csrfToken = this.getCookie('x-ms-cpim-csrf'); - this.csrfToken = csrfToken; - this.log.debug('csrfToken Neu: ' + this.csrfToken); - - // Extract the request_id from headers const requestId = response.headers['x-request-id']; // Create state_properties JSON and encode it in base64 URL-safe format const statePropertiesJson = `{"TID":"${requestId}"}`; const stateProperties = base64url.encode(statePropertiesJson); - /* - const stateProperties = Buffer.from(statePropertiesJson, 'ascii') - .toString('base64') - .replace(/\+/g, '-') - .replace(/\//g, '_') - .replace(/=+$/, ''); - */ - - this.log.debug(`stateProperties: ${stateProperties}`); + //this.log.debug(`stateProperties: ${stateProperties}`); const authorizationCode = await this.login(stateProperties, this.csrfToken); - this.log.debug(`authorizationCode: ${authorizationCode}`) + //this.log.debug(`authorizationCode: ${authorizationCode}`) - //if (!authorizationCode) throw new Error('Authorization code is missing.'); + if (!authorizationCode) throw new Error('Authorization code is missing.'); - //await this.fetchAccessToken(authorizationCode); + await this.fetchAccessToken(authorizationCode); } catch (error) { this.log.error(`Error resolving external data: ${error.message}`); } @@ -262,45 +180,28 @@ class RemehaHomeAdapter extends utils.Adapter { async login(stateProperties, csrfToken) { try { - this.log.debug(`Attempting login with stateProperties: ${stateProperties}`); - this.log.debug(`CSRF-Token: ${csrfToken}`); - - const response = await this.client.post(`/bdrb2cprod.onmicrosoft.com/B2C_1A_RPSignUpSignInNewRoomv3.1/SelfAsserted`, - { - request_type: 'RESPONSE', - signInName: this.account, - password: this.password, - }, - { - params: { - tx: `StateProperties=${stateProperties}`, - p: 'B2C_1A_RPSignUpSignInNewRoomv3.1', - }, - headers: { - 'x-csrf-token': csrfToken, - //'Content-Type': 'application/x-www-form-urlencoded' - } - } - ); - - /* + //this.log.debug(`Attempting login with stateProperties: ${stateProperties}`); + //this.log.debug(`CSRF-Token: ${csrfToken}`); + const response = await this.client.post(`bdrb2cprod.onmicrosoft.com/B2C_1A_RPSignUpSignInNewRoomv3.1/SelfAsserted`, { searchParams: { - tx: encodeURIComponent(`StateProperties=${stateProperties}`), + tx: `StateProperties=${stateProperties}`, p: 'B2C_1A_RPSignUpSignInNewRoomv3.1', }, + form: { + request_type: 'RESPONSE', + signInName: this.account, + password: this.password + }, headers: { 'x-csrf-token': csrfToken, - //'Content-Type': 'application/x-www-form-urlencoded' }, followRedirect: true, }); - */ + - this.log.debug('Status Text:' + response.statusText); - this.log.debug('Login response status:' + response.status); - this.log.debug('Login response headers:' + response.headers); + this.log.debug('Login response status:' + response.statusCode); } catch (error) { this.log.error('Error during login:' + error.message); @@ -309,58 +210,26 @@ class RemehaHomeAdapter extends utils.Adapter { } throw error; } - this.log.debug('Part 2'); - - await this.sleep(1000); - const params = new URLSearchParams({ - rememberMe: false, - csrf_token: csrfToken, - tx: `StateProperties=${stateProperties}`, - p: 'B2C_1A_RPSignUpSignInNewRoomv3.1', - }).toString(); try { - - const response = await this.client.get(`/bdrb2cprod.onmicrosoft.com/B2C_1A_RPSignUpSignInNewRoomv3.1/api/CombinedSigninAndSignup/confirmed`, - { - params: { - rememberMe: false, - csrf_token: csrfToken, - tx: `StateProperties=${stateProperties}`, - p: 'B2C_1A_RPSignUpSignInNewRoomv3.1', - }, - maxRedirects: 0, - }); - - /* const url = `bdrb2cprod.onmicrosoft.com/B2C_1A_RPSignUpSignInNewRoomv3.1/api/CombinedSigninAndSignup/confirmed`; const response = await this.client.get(url, { searchParams: { rememberMe: 'false', - csrf_token: encodeURIComponent(csrfToken), - tx: encodeURIComponent(`StateProperties=${stateProperties}`), + csrf_token: csrfToken, + tx: `StateProperties=${stateProperties}`, p: 'B2C_1A_RPSignUpSignInNewRoomv3.1', }, - followRedirect: false, // Verhindert automatische Weiterleitungen + followRedirect: false }); - */ - this.log.debug('Login response1 status:' + response.status); - this.log.debug('Login response1 headers:' + response.headers); - - /* - const locationHeader = response1.headers['location']; - if (locationHeader) { - this.log.debug('Redirect URL:', locationHeader); - const url = new URL(locationHeader); - const code = url.searchParams.get('code'); - - */ + + this.log.debug('Login response1 status:' + response.statusCode); + const parsedCallbackUrl = new URL(response.headers.location); if (parsedCallbackUrl) { const queryStringDict = parsedCallbackUrl.searchParams; const code = queryStringDict.get('code'); if (code) { - this.log.debug('Authorization code extracted:' + code); return code; } else { this.log.debug('Authorization code not found'); @@ -378,28 +247,11 @@ class RemehaHomeAdapter extends utils.Adapter { this.log.error('Error get code:' + JSON.stringify(error)); if (error.response) { this.log.error('Response status:' + error.response.status); - //this.log.error('Response status:' + error.response.headers); } throw error; } } - /* - extractAuthorizationCode(response) { - const locationHeader = response.headers['location']; - if (locationHeader && locationHeader.includes('code=')) { - const url = new URL(locationHeader); - const code = url.searchParams.get('code'); - if (code) { - this.log.debug('Authorization code extracted:', code); - return code; - } - } - this.log.debug('Authorization code not found in redirect URL.'); - return null; - } - */ - async generateRandomToken(length) { return crypto.randomBytes(length).toString('base64url'); @@ -418,53 +270,44 @@ class RemehaHomeAdapter extends utils.Adapter { return base64Url; } - /* - async generateCodeChallenge(codeVerifier) { - const hash = crypto.createHash('sha256'); - hash.update(codeVerifier); - const codeChallenge = hash.digest('base64') - .replace(/\+/g, '-') - .replace(/\//g, '_') - .replace(/=/g, ''); - return codeChallenge; - } - */ - async fetchAccessToken(code) { try { - const tokenUrl = 'https://remehalogin.bdrthermea.net/bdrb2cprod.onmicrosoft.com/oauth2/v2.0/token'; - const tokenParams = { + const grantParams = { grant_type: 'authorization_code', code: code, redirect_uri: 'com.b2c.remehaapp://login-callback', + code_verifier: this.codeChallenge, client_id: '6ce007c6-0628-419e-88f4-bee2e6418eec', - code_verifier: this.codeChallenge }; - - const response = await this.client.post(tokenUrl, qs.stringify(tokenParams), { - headers: { 'Content-Type': 'application/x-www-form-urlencoded' } + const response = await this.client.post('bdrb2cprod.onmicrosoft.com/oauth2/v2.0/token', { + searchParams: { + p: 'B2C_1A_RPSignUpSignInNewRoomV3.1' + }, + form: grantParams, // Hier werden die Parameter als Formulardaten gesendet + followRedirect: true, // Erlaubt Weiterleitungen + responseType: 'json' // Stellt sicher, dass die Antwort als JSON geparst wird }); - - this.accessToken = response.data.access_token; - this.refreshToken = response.data.refresh_token; - this.log.debug('Access Token:', this.accessToken); + this.log.debug('Access Token Stattus:' + response.statusCode); + this.accessToken = response.body.access_token; + this.refreshToken = response.body.refresh_token; + //this.log.debug('Access Token:' + this.accessToken); return this.accessToken; } catch (error) { this.log.error('Error fetching access token:', error.response ? error.response.data : error.message); throw error; } } - + /* async refreshAccessToken() { try { - const response = await this.client.post('https://remehalogin.bdrthermea.net/bdrb2cprod.onmicrosoft.com/oauth2/v2.0/token', qs.stringify({ + const response = await got.post('https://remehalogin.bdrthermea.net/bdrb2cprod.onmicrosoft.com/oauth2/v2.0/token', qs.stringify({ grant_type: 'refresh_token', refresh_token: this.refreshToken, client_id: '6ce007c6-0628-419e-88f4-bee2e6418eec' }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' - } + }); this.accessToken = response.data.access_token; @@ -474,48 +317,53 @@ class RemehaHomeAdapter extends utils.Adapter { throw error; } } + */ async updateDevices() { try { - if (!this.accessToken || !await this.checkTokenValidity(this.accessToken)) { + if (!this.accessToken === null || await this.checkTokenValidity(this.accessToken) !== 200) { await this.fetchAccessToken(); // or refreshAccessToken() } - const response = await this.client.get('https://api.bdrthermea.net/Mobile/api/homes/dashboard', { + const response = await got.get('https://api.bdrthermea.net/Mobile/api/homes/dashboard', { headers: { 'Authorization': `Bearer ${this.accessToken}`, 'Ocp-Apim-Subscription-Key': 'df605c5470d846fc91e848b1cc653ddf', 'x-csrf-token': this.csrfToken } }); - - const data = response.data; - - await this.setStateAsync('roomTemperature', { val: data.roomTemperature, ack: true }); - await this.setStateAsync('outdoorTemperature', { val: data.outdoorTemperature, ack: true }); - await this.setStateAsync('waterPressure', { val: data.waterPressure, ack: true }); - await this.setStateAsync('setPoint', { val: data.setPoint, ack: true }); - await this.setStateAsync('dhwTemperature', { val: data.dhwTemperature, ack: true }); - await this.setStateAsync('EnergyConsumption', { val: data.energyConsumption, ack: true }); - await this.setStateAsync('gasCalorificValue', { val: data.gasCalorificValue, ack: true }); - await this.setStateAsync('zoneMode', { val: data.zoneMode, ack: true }); - await this.setStateAsync('waterPressureToLow', { val: data.waterPressureToLow, ack: true }); - await this.setStateAsync('EnergyDelivered', { val: data.energyDelivered, ack: true }); + this.log.debug('Status Update: ' + response.statusCode) + const data = JSON.parse(response.body); + + await this.setStateAsync('roomTemperature', { val: data.appliances[0].climateZones[0].roomTemperature, ack: true }); + await this.setStateAsync('outdoorTemperature', { val: data.appliances[0].outdoorTemperature, ack: true }); + await this.setStateAsync('waterPressure', { val: data.appliances[0].waterPressure, ack: true }); + await this.setStateAsync('setPoint', { val: data.appliances[0].climateZones[0].setPoint, ack: true }); + await this.setStateAsync('dhwTemperature', { val: data.appliances[0].hotWaterZones[0].dhwTemperature, ack: true }); + //await this.setStateAsync('EnergyConsumption', { val: data.energyConsumption, ack: true }); + await this.setStateAsync('gasCalorificValue', { val: data.appliances[0].gasCalorificValue, ack: true }); + await this.setStateAsync('zoneMode', { val: data.appliances[0].climateZones[0].zoneMode, ack: true }); + await this.setStateAsync('waterPressureToLow', { val: data.appliances[0].waterPressureOK, ack: true }); + //await this.setStateAsync('EnergyDelivered', { val: data.energyDelivered, ack: true }); + } catch (error) { - this.log.error(`Error updating devices: ${error.response ? error.response.data : error.message}`); + this.log.error(`Error updating devices: ${error}`); } } async checkTokenValidity(token) { try { - const response = await this.client.get('https://api.bdrthermea.net/Mobile/api/homes/dashboard', { + const response = await got.get('https://api.bdrthermea.net/Mobile/api/homes/dashboard', { headers: { 'Authorization': `Bearer ${token}`, 'Ocp-Apim-Subscription-Key': 'df605c5470d846fc91e848b1cc653ddf', 'x-csrf-token': this.csrfToken } }); - return response.status === 200; + this.log.debug('checkTokenValidity Status:' + response.statusCode) + //this.log.debug('checkTokenValidity:' + response.body); + await this.sleep(2000) + return 200; } catch (error) { this.log.error(`Token validity check failed: ${error.response ? error.response.data : error.message}`); return false; diff --git a/package-lock.json b/package-lock.json index 74be19c..d8398a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,11 +11,9 @@ "dependencies": { "@iobroker/adapter-core": "^3.1.6", "axios": "^1.7.5", - "axios-cookiejar-support": "^5.0.2", "base64url": "^3.0.1", "crypto": "^1.0.1", - "got": "^11.8.6", - "qs": "^6.13.0", + "got": "^14.4.2", "tough-cookie": "^4.1.4", "url": "^0.11.4" }, @@ -1181,12 +1179,17 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", "dev": true }, + "node_modules/@sec-ant/readable-stream": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz", + "integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==" + }, "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.0.0.tgz", + "integrity": "sha512-WDTlVTyvFivSOuyvMeedzg2hdoBLZ3f1uNVuEida2Rl9BrfjrIRjWA/VZIrMRLvSwJYCAlCRA3usDt1THytxWQ==", "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sindresorhus/is?sponsor=1" @@ -1237,14 +1240,14 @@ "dev": true }, "node_modules/@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", "dependencies": { - "defer-to-connect": "^2.0.0" + "defer-to-connect": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=14.16" } }, "node_modules/@tootallnate/once": { @@ -1256,17 +1259,6 @@ "node": ">= 10" } }, - "node_modules/@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, "node_modules/@types/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", @@ -1282,14 +1274,6 @@ "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==" }, - "node_modules/@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/linkify-it": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", @@ -1328,18 +1312,11 @@ "version": "20.14.11", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.11.tgz", "integrity": "sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==", + "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, - "node_modules/@types/responselike": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", - "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.2.tgz", @@ -1508,24 +1485,6 @@ "proxy-from-env": "^1.1.0" } }, - "node_modules/axios-cookiejar-support": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/axios-cookiejar-support/-/axios-cookiejar-support-5.0.2.tgz", - "integrity": "sha512-4KwFqiH62Ry/J+ue1NwqLvBSaK3Bp/Owc9jTe7BS9c22uN8/4MB5pY7HV9QwQjV3ZRonCoSj5V8Pjx911qQqAw==", - "dependencies": { - "http-cookie-agent": "^6.0.5" - }, - "engines": { - "node": ">=18.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/3846masa" - }, - "peerDependencies": { - "axios": ">=0.20.0", - "tough-cookie": ">=4.0.0" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1628,39 +1587,51 @@ "dev": true }, "node_modules/cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", "engines": { - "node": ">=10.6.0" + "node": ">=14.16" } }, "node_modules/cacheable-request": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", - "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-12.0.1.tgz", + "integrity": "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg==", "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" + "@types/http-cache-semantics": "^4.0.4", + "get-stream": "^9.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.4", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.1", + "responselike": "^3.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" } }, "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", + "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", "dependencies": { - "pump": "^3.0.0" + "@sec-ant/readable-stream": "^0.4.1", + "is-stream": "^4.0.1" }, "engines": { - "node": ">=8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/is-stream": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", + "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", + "engines": { + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1834,17 +1805,6 @@ "node": ">=12" } }, - "node_modules/clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1904,6 +1864,7 @@ "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -2043,6 +2004,7 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, "dependencies": { "once": "^1.4.0" } @@ -2574,6 +2536,14 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz", + "integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==", + "engines": { + "node": ">= 18" + } + }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -2846,24 +2816,24 @@ } }, "node_modules/got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dependencies": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", + "version": "14.4.2", + "resolved": "https://registry.npmjs.org/got/-/got-14.4.2.tgz", + "integrity": "sha512-+Te/qEZ6hr7i+f0FNgXx/6WQteSM/QqueGvxeYQQFm0GDfoxLVJ/oiwUKYMTeioColWUTdewZ06hmrBjw6F7tw==", + "dependencies": { + "@sindresorhus/is": "^7.0.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^12.0.1", "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" + "form-data-encoder": "^4.0.2", + "http2-wrapper": "^2.2.1", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^4.0.1", + "responselike": "^3.0.0", + "type-fest": "^4.19.0" }, "engines": { - "node": ">=10.19.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sindresorhus/got?sponsor=1" @@ -2968,40 +2938,6 @@ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" }, - "node_modules/http-cookie-agent": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-6.0.5.tgz", - "integrity": "sha512-sfZ8fDgDP3B1YB+teqSnAK1aPgBu8reUUGxSsndP2XnYN6cM29EURXWXZqQQiaRdor3B4QjpkUNfv21syaO4DA==", - "dependencies": { - "agent-base": "^7.1.1" - }, - "engines": { - "node": ">=18.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/3846masa" - }, - "peerDependencies": { - "tough-cookie": "^4.0.0", - "undici": "^5.11.0 || ^6.0.0" - }, - "peerDependenciesMeta": { - "undici": { - "optional": true - } - } - }, - "node_modules/http-cookie-agent/node_modules/agent-base": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", - "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", - "dependencies": { - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -3017,12 +2953,12 @@ } }, "node_modules/http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", "dependencies": { "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" + "resolve-alpn": "^1.2.0" }, "engines": { "node": ">=10.19.0" @@ -3452,11 +3388,14 @@ } }, "node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lru-cache": { @@ -3551,11 +3490,14 @@ } }, "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", "engines": { - "node": ">=4" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/minimatch": { @@ -3700,7 +3642,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==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/natural-compare": { "version": "1.4.0", @@ -3760,11 +3703,11 @@ } }, "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3806,6 +3749,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -3843,11 +3787,11 @@ } }, "node_modules/p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-4.0.1.tgz", + "integrity": "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg==", "engines": { - "node": ">=8" + "node": ">=14.16" } }, "node_modules/p-limit": { @@ -4055,15 +3999,6 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -4201,11 +4136,14 @@ } }, "node_modules/responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", "dependencies": { - "lowercase-keys": "^2.0.0" + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4604,6 +4542,17 @@ "node": ">=4" } }, + "node_modules/type-fest": { + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.26.0.tgz", + "integrity": "sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", @@ -4631,7 +4580,8 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true }, "node_modules/universalify": { "version": "2.0.1", @@ -4766,7 +4716,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/xmlcreate": { "version": "2.0.4", diff --git a/package.json b/package.json index da965af..a364d41 100644 --- a/package.json +++ b/package.json @@ -27,11 +27,9 @@ "@iobroker/adapter-core": "^3.1.6", "crypto": "^1.0.1", "axios": "^1.7.5", - "qs": "^6.13.0", "url": "^0.11.4", "base64url": "^3.0.1", - "got": "^11.8.6", - "axios-cookiejar-support": "^5.0.2", + "got": "^14.4.2", "tough-cookie": "^4.1.4" }, "devDependencies": {