iobroker.boschindego
Advanced tools
Comparing version 1.3.8 to 1.3.9
{ | ||
"common": { | ||
"name": "boschindego", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"news": { | ||
"1.3.9": { | ||
"en": "revert to jsconfonfig and move from captche to codeurl\nFix Responsive Design", | ||
"de": "zurück zu jsconfonfig und von captche zu codeurl\nReparieren Responsive Design", | ||
"ru": "вернуться к jsconfonfig и перейти от captche к codeurl\nРеакция", | ||
"pt": "reverter para jsconfonfig e mover de captche para codeurl\nFix Design responsivo", | ||
"nl": "terug naar jsconfonfig en verplaatsen van captche naar codeurl\nResponsief ontwerp repareren", | ||
"fr": "revenir à jsconfonfig et passer de captche à codeurl\nCorriger la conception réactive", | ||
"it": "tornare a jsconfonfig e passare da captche a codeurl\nRisolvere il disegno reattivo", | ||
"es": "volver a jsconfonfig y pasar de captche a codeurl\nDiseño responsivo fijo", | ||
"pl": "revert to jsconfonfig and move from captche to codeurl\nNapraw projekt odpowiedzi", | ||
"uk": "перевернутися до jsconfonfig і перемістити з captche до codeurl\nФіксований адаптивний дизайн", | ||
"zh-cn": "返回到 jsconfonfig 并从卡普切移到编码器\n修复响应设计" | ||
}, | ||
"1.3.8": { | ||
@@ -134,3 +147,3 @@ "en": "jsonConfig has been reverted due to captcha requirements.", | ||
"adminUI": { | ||
"config": "materialize" | ||
"config": "json" | ||
}, | ||
@@ -137,0 +150,0 @@ "dependencies": [ |
358
main.js
@@ -137,172 +137,174 @@ 'use strict'; | ||
async login() { | ||
if (!this.config.captcha) { | ||
this.log.error('Please set capcha in the instance settings'); | ||
if (!this.config.captcha || !this.config.captcha.startsWith('msauth.com.bosch.indegoconnect')) { | ||
this.log.error('Please set code url in the instance settings'); | ||
return; | ||
} | ||
const loginForm = await this.requestClient({ | ||
method: 'get', | ||
url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize', | ||
params: { | ||
nonce: 'b_x1uhAjiy3iKMcXX1TKbJnBph18-J_Hms4vvWeE7qw', | ||
response_type: 'code', | ||
code_challenge_method: 'S256', | ||
scope: | ||
'openid profile email https://prodindego.onmicrosoft.com/indego-mobile-api/Indego.Mower.User offline_access', | ||
code_challenge: '5C1HXuvfGjAo-6TVzy_95lQNmpAjorsngCwiD3w3VHs', | ||
redirect_uri: 'msauth.com.bosch.indegoconnect.cloud://auth/', | ||
client_id: '65bb8c9d-1070-4fb4-aa95-853618acc876', | ||
state: 'aylWn_85vBUdNlHPC_KeGoqrcsyi5VCxjQjvttvD85g', | ||
}, | ||
headers: { | ||
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | ||
'Accept-Language': 'de-de', | ||
'User-Agent': | ||
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1', | ||
}, | ||
}) | ||
.then((res) => { | ||
this.log.debug(JSON.stringify(res.data)); | ||
return JSON.parse(res.data.split('var SETTINGS = ')[1].split(';')[0]); | ||
}) | ||
.catch((error) => { | ||
this.log.error(error); | ||
error.response && this.log.error(JSON.stringify(error.response.data)); | ||
}); | ||
if (!loginForm || !loginForm.csrf || !loginForm.transId) { | ||
this.log.error('Could not extract login form'); | ||
this.log.error(JSON.stringify(loginForm)); | ||
return; | ||
} | ||
let formData = ''; | ||
// const loginForm = await this.requestClient({ | ||
// method: 'get', | ||
// url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize', | ||
// params: { | ||
// nonce: 'b_x1uhAjiy3iKMcXX1TKbJnBph18-J_Hms4vvWeE7qw', | ||
// response_type: 'code', | ||
// code_challenge_method: 'S256', | ||
// scope: | ||
// 'openid profile email https://prodindego.onmicrosoft.com/indego-mobile-api/Indego.Mower.User offline_access', | ||
// code_challenge: '5C1HXuvfGjAo-6TVzy_95lQNmpAjorsngCwiD3w3VHs', | ||
// redirect_uri: 'msauth.com.bosch.indegoconnect.cloud://auth/', | ||
// client_id: '65bb8c9d-1070-4fb4-aa95-853618acc876', | ||
// state: 'aylWn_85vBUdNlHPC_KeGoqrcsyi5VCxjQjvttvD85g', | ||
// }, | ||
// headers: { | ||
// Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | ||
// 'Accept-Language': 'de-de', | ||
// 'User-Agent': | ||
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1', | ||
// }, | ||
// }) | ||
// .then((res) => { | ||
// this.log.debug(JSON.stringify(res.data)); | ||
// return JSON.parse(res.data.split('var SETTINGS = ')[1].split(';')[0]); | ||
// }) | ||
// .catch((error) => { | ||
// this.log.error(error); | ||
// error.response && this.log.error(JSON.stringify(error.response.data)); | ||
// }); | ||
// if (!loginForm || !loginForm.csrf || !loginForm.transId) { | ||
// this.log.error('Could not extract login form'); | ||
// this.log.error(JSON.stringify(loginForm)); | ||
// return; | ||
// } | ||
// let formData = ''; | ||
const loginUrl = await this.requestClient({ | ||
method: 'get', | ||
url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/unified', | ||
params: { | ||
claimsexchange: 'BoschIDExchange', | ||
csrf_token: loginForm.csrf, | ||
tx: loginForm.transId, | ||
p: 'B2C_1A_signup_signin', | ||
diags: | ||
'{"pageViewId":"281eab4f-ef89-4f5c-a546-ffad0bb1b00b","pageId":"CombinedSigninAndSignup","trace":[{"ac":"T005","acST":1699567715,"acD":1},{"ac":"T021 - URL:https://swsasharedprodb2c.blob.core.windows.net/b2c-templates/bosch/unified.html","acST":1699567715,"acD":712},{"ac":"T019","acST":1699567716,"acD":9},{"ac":"T004","acST":1699567716,"acD":4},{"ac":"T003","acST":1699567716,"acD":1},{"ac":"T035","acST":1699567716,"acD":0},{"ac":"T030Online","acST":1699567716,"acD":0},{"ac":"T002","acST":1699567791,"acD":0}]}', | ||
}, | ||
headers: { | ||
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | ||
'Accept-Language': 'de-de', | ||
'User-Agent': | ||
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1', | ||
}, | ||
}) | ||
.then((res) => { | ||
this.log.debug(JSON.stringify(res.data)); | ||
formData = this.extractHidden(res.data); | ||
return res.request.path; | ||
}) | ||
.catch((error) => { | ||
this.log.error(error); | ||
error.response && this.log.error(JSON.stringify(error.response.data)); | ||
}); | ||
const loginParams = qs.parse(loginUrl.split('?')[1]); | ||
const loginUrlPath = loginUrl.split('?')[0]; | ||
if (!loginParams || !loginParams.ReturnUrl) { | ||
this.log.error('Could not extract login params'); | ||
this.log.error(JSON.stringify(loginParams)); | ||
return; | ||
} | ||
// const token = this.cookieJar.getCookiesSync('https://singlekey-id.com/auth/').find((cookie) => cookie.key === 'X-CSRF-FORM-TOKEN'); | ||
const userResponse = await this.requestClient({ | ||
method: 'post', | ||
maxBodyLength: Infinity, | ||
url: 'https://singlekey-id.com' + loginUrlPath, | ||
headers: { | ||
'content-type': 'application/x-www-form-urlencoded', | ||
accept: '*/*', | ||
'hx-request': 'true', | ||
'sec-fetch-site': 'same-origin', | ||
'hx-boosted': 'true', | ||
'accept-language': 'de-DE,de;q=0.9', | ||
'sec-fetch-mode': 'cors', | ||
origin: 'https://singlekey-id.com', | ||
'user-agent': | ||
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1', | ||
'sec-fetch-dest': 'empty', | ||
}, | ||
params: loginParams, | ||
data: { | ||
'UserIdentifierInput.EmailInput.StringValue': this.config.username, | ||
'h-captcha-response': this.config.captcha, | ||
__RequestVerificationToken: formData['undefined'], | ||
}, | ||
}) | ||
.then((res) => { | ||
this.log.debug(JSON.stringify(res.data)); | ||
return this.extractHidden(res.data); | ||
}) | ||
.catch((error) => { | ||
this.log.error(error); | ||
error.response && this.log.error(JSON.stringify(error.response.data)); | ||
}); | ||
if (!userResponse) { | ||
this.log.error('Could not extract user data'); | ||
return; | ||
} | ||
await this.requestClient({ | ||
method: 'post', | ||
maxBodyLength: Infinity, | ||
url: 'https://singlekey-id.com' + loginUrlPath + '/password', | ||
headers: { | ||
'content-type': 'application/x-www-form-urlencoded', | ||
accept: '*/*', | ||
'hx-request': 'true', | ||
'sec-fetch-site': 'same-origin', | ||
'hx-boosted': 'true', | ||
'accept-language': 'de-DE,de;q=0.9', | ||
'sec-fetch-mode': 'cors', | ||
origin: 'https://singlekey-id.com', | ||
'user-agent': | ||
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1', | ||
'sec-fetch-dest': 'empty', | ||
}, | ||
params: loginParams, | ||
data: { | ||
Password: this.config.password, | ||
RememberMe: 'true', | ||
__RequestVerificationToken: userResponse['undefined'], | ||
}, | ||
}).catch((error) => { | ||
this.log.error(error); | ||
error.response && this.log.error(JSON.stringify(error.response.data)); | ||
}); | ||
// const loginUrl = await this.requestClient({ | ||
// method: 'get', | ||
// url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/unified', | ||
// params: { | ||
// claimsexchange: 'BoschIDExchange', | ||
// csrf_token: loginForm.csrf, | ||
// tx: loginForm.transId, | ||
// p: 'B2C_1A_signup_signin', | ||
// diags: | ||
// '{"pageViewId":"281eab4f-ef89-4f5c-a546-ffad0bb1b00b","pageId":"CombinedSigninAndSignup","trace":[{"ac":"T005","acST":1699567715,"acD":1},{"ac":"T021 - URL:https://swsasharedprodb2c.blob.core.windows.net/b2c-templates/bosch/unified.html","acST":1699567715,"acD":712},{"ac":"T019","acST":1699567716,"acD":9},{"ac":"T004","acST":1699567716,"acD":4},{"ac":"T003","acST":1699567716,"acD":1},{"ac":"T035","acST":1699567716,"acD":0},{"ac":"T030Online","acST":1699567716,"acD":0},{"ac":"T002","acST":1699567791,"acD":0}]}', | ||
// }, | ||
// headers: { | ||
// Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | ||
// 'Accept-Language': 'de-de', | ||
// 'User-Agent': | ||
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1', | ||
// }, | ||
// }) | ||
// .then((res) => { | ||
// this.log.debug(JSON.stringify(res.data)); | ||
// formData = this.extractHidden(res.data); | ||
// return res.request.path; | ||
// }) | ||
// .catch((error) => { | ||
// this.log.error(error); | ||
// error.response && this.log.error(JSON.stringify(error.response.data)); | ||
// }); | ||
// const loginParams = qs.parse(loginUrl.split('?')[1]); | ||
// const loginUrlPath = loginUrl.split('?')[0]; | ||
// if (!loginParams || !loginParams.ReturnUrl) { | ||
// this.log.error('Could not extract login params'); | ||
// this.log.error(JSON.stringify(loginParams)); | ||
// return; | ||
// } | ||
// // const token = this.cookieJar.getCookiesSync('https://singlekey-id.com/auth/').find((cookie) => cookie.key === 'X-CSRF-FORM-TOKEN'); | ||
// const userResponse = await this.requestClient({ | ||
// method: 'post', | ||
// maxBodyLength: Infinity, | ||
// url: 'https://singlekey-id.com' + loginUrlPath, | ||
// headers: { | ||
// 'content-type': 'application/x-www-form-urlencoded', | ||
// accept: '*/*', | ||
// 'hx-request': 'true', | ||
// 'sec-fetch-site': 'same-origin', | ||
// 'hx-boosted': 'true', | ||
// 'accept-language': 'de-DE,de;q=0.9', | ||
// 'sec-fetch-mode': 'cors', | ||
// origin: 'https://singlekey-id.com', | ||
// 'user-agent': | ||
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1', | ||
// 'sec-fetch-dest': 'empty', | ||
// }, | ||
// params: loginParams, | ||
// data: { | ||
// 'UserIdentifierInput.EmailInput.StringValue': this.config.username, | ||
// 'h-captcha-response': this.config.captcha, | ||
// __RequestVerificationToken: formData['undefined'], | ||
// }, | ||
// }) | ||
// .then((res) => { | ||
// this.log.debug(JSON.stringify(res.data)); | ||
// return this.extractHidden(res.data); | ||
// }) | ||
// .catch((error) => { | ||
// this.log.error(error); | ||
// error.response && this.log.error(JSON.stringify(error.response.data)); | ||
// }); | ||
// if (!userResponse) { | ||
// this.log.error('Could not extract user data'); | ||
// return; | ||
// } | ||
// await this.requestClient({ | ||
// method: 'post', | ||
// maxBodyLength: Infinity, | ||
// url: 'https://singlekey-id.com' + loginUrlPath + '/password', | ||
// headers: { | ||
// 'content-type': 'application/x-www-form-urlencoded', | ||
// accept: '*/*', | ||
// 'hx-request': 'true', | ||
// 'sec-fetch-site': 'same-origin', | ||
// 'hx-boosted': 'true', | ||
// 'accept-language': 'de-DE,de;q=0.9', | ||
// 'sec-fetch-mode': 'cors', | ||
// origin: 'https://singlekey-id.com', | ||
// 'user-agent': | ||
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1', | ||
// 'sec-fetch-dest': 'empty', | ||
// }, | ||
// params: loginParams, | ||
// data: { | ||
// Password: this.config.password, | ||
// RememberMe: 'true', | ||
// __RequestVerificationToken: userResponse['undefined'], | ||
// }, | ||
// }).catch((error) => { | ||
// this.log.error(error); | ||
// error.response && this.log.error(JSON.stringify(error.response.data)); | ||
// }); | ||
const htmlForm = await this.requestClient({ | ||
method: 'get', | ||
url: 'https://singlekey-id.com' + loginParams.ReturnUrl, | ||
}); | ||
const formDataAuth = this.extractHidden(htmlForm.data); | ||
const response = await this.requestClient({ | ||
method: 'post', | ||
url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/oauth2/authresp', | ||
headers: { | ||
'content-type': 'application/x-www-form-urlencoded', | ||
accept: 'application/json, text/plain, */*', | ||
'accept-language': 'de-de', | ||
}, | ||
data: formDataAuth, | ||
}) | ||
.then((res) => { | ||
this.log.debug(JSON.stringify(res.data)); | ||
return; | ||
}) | ||
.catch((error) => { | ||
if (error && error.message.includes('Unsupported protocol')) { | ||
return qs.parse(error.request._options.path.split('?')[1]); | ||
} | ||
this.log.error('Authresp step faild'); | ||
this.log.error(error); | ||
error.response && this.log.error(JSON.stringify(error.response.data)); | ||
}); | ||
if (!response) { | ||
return; | ||
} | ||
// const htmlForm = await this.requestClient({ | ||
// method: 'get', | ||
// url: 'https://singlekey-id.com' + loginParams.ReturnUrl, | ||
// }); | ||
// const formDataAuth = this.extractHidden(htmlForm.data); | ||
// const response = await this.requestClient({ | ||
// method: 'post', | ||
// url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/oauth2/authresp', | ||
// headers: { | ||
// 'content-type': 'application/x-www-form-urlencoded', | ||
// accept: 'application/json, text/plain, */*', | ||
// 'accept-language': 'de-de', | ||
// }, | ||
// data: formDataAuth, | ||
// }) | ||
// .then((res) => { | ||
// this.log.debug(JSON.stringify(res.data)); | ||
// return; | ||
// }) | ||
// .catch((error) => { | ||
// if (error && error.message.includes('Unsupported protocol')) { | ||
// return qs.parse(error.request._options.path.split('?')[1]); | ||
// } | ||
// this.log.error('Authresp step faild'); | ||
// this.log.error(error); | ||
// error.response && this.log.error(JSON.stringify(error.response.data)); | ||
// }); | ||
// if (!response) { | ||
// return; | ||
// } | ||
const response = qs.parse(this.config.captcha.split('?')[1]); | ||
await this.requestClient({ | ||
@@ -546,2 +548,7 @@ method: 'post', | ||
{ | ||
path: 'config', | ||
url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/config', | ||
desc: 'Config', | ||
}, | ||
{ | ||
path: 'predictive', | ||
@@ -592,2 +599,3 @@ url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/predictive', | ||
const url = element.url.replace('$id', id); | ||
this.log.debug('Fetch data from ' + url); | ||
await this.requestClient({ | ||
@@ -613,4 +621,11 @@ method: element.method || 'get', | ||
const preferedArrayName = null; | ||
const parseOptions = { | ||
forceIndex: forceIndex, | ||
preferedArrayName: preferedArrayName, | ||
channelName: element.desc, | ||
states: this.states, | ||
}; | ||
if (element.path === 'alerts') { | ||
this.alerts[id] = data; | ||
parseOptions.deleteBeforeUpdate = true; | ||
} | ||
@@ -638,8 +653,3 @@ if (element.path === 'state') { | ||
} | ||
this.json2iob.parse(id + '.' + element.path, data, { | ||
forceIndex: forceIndex, | ||
preferedArrayName: preferedArrayName, | ||
channelName: element.desc, | ||
states: this.states, | ||
}); | ||
this.json2iob.parse(id + '.' + element.path, data, parseOptions); | ||
if (element.path != 'map') { | ||
@@ -808,4 +818,4 @@ await this.setObjectNotExistsAsync(id + '.' + element.path + '.json', { | ||
if (type === 'reset') { | ||
urlArray.push(baseUrl); | ||
if (exec === 'blade') { | ||
urlArray.push(baseUrl); | ||
data = { | ||
@@ -819,3 +829,4 @@ needs_service: false, | ||
for (const alert of this.alerts[deviceId]) { | ||
urlArray.push(baseUrl + '/alerts/' + alert.id); | ||
const alertId = alert.id || alert.alert_id; | ||
urlArray.push('https://api.indego-cloud.iot.bosch-si.com/api/v1/alerts/' + alertId); | ||
} | ||
@@ -827,2 +838,3 @@ } else { | ||
} | ||
if (type === 'calendar') { | ||
@@ -829,0 +841,0 @@ urlArray.push(baseUrl + '/predictive/calendar'); |
{ | ||
"name": "iobroker.boschindego", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"description": "Adapter for Bosch Indego Mower", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -30,2 +30,7 @@ ![Logo](admin/boschindego.png) | ||
--> | ||
### 1.3.9 (2025-01-18) | ||
- revert to jsconfonfig and move from captche to codeurl | ||
- (simatec) Fix Responsive Design | ||
### 1.3.8 (2025-01-04) | ||
@@ -92,3 +97,3 @@ | ||
Copyright (c) 2024-2030 TA2k <tombox2020@gmail.com> | ||
Copyright (c) 2024-2025 TA2k <tombox2020@gmail.com> | ||
@@ -95,0 +100,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
189613
12
1186
115