Skip to content

Commit

Permalink
chore: release v1.2.3
Browse files Browse the repository at this point in the history
- login fixed
  • Loading branch information
TA2k committed Nov 28, 2024
1 parent a82035a commit 406ff02
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 165 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Use id.remote.\* to control the mower
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### 1.2.3 (2024-11-28)

- login fixed

### 1.2.2 (2024-10-18)

- fix login
Expand Down
44 changes: 18 additions & 26 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "boschindego",
"version": "1.2.2",
"version": "1.2.3",
"news": {
"1.2.3": {
"en": "login fixed",
"de": "Login gefixt",
"ru": "фиксированный",
"pt": "login fixo",
"nl": "login vast",
"fr": "login corrigé",
"it": "login fisso",
"es": "login fijo",
"pl": "login stały",
"uk": "логін",
"zh-cn": "登录已固定"
},
"1.2.2": {
"en": "fix login",
"de": "zurück zur übersicht",
Expand Down Expand Up @@ -80,19 +93,6 @@
"pl": "naprawa przepływu logowania",
"uk": "виправити потік логіна",
"zh-cn": "fix 伐木"
},
"1.0.2": {
"en": "added client timeout",
"de": "client timeout",
"ru": "добавлено timeout клиента",
"pt": "adicionado timeout cliente",
"nl": "voegde cliënt time-out toe",
"fr": "client ajouté timeout",
"it": "timeout client aggiunto",
"es": "tiempo adicional cliente",
"pl": "uproszczony czas klienta",
"uk": "доданий клієнт",
"zh-cn": "增加客户时间"
}
},
"titleLang": {
Expand Down Expand Up @@ -121,12 +121,8 @@
"uk": "Адаптер для косарки Bosch Indego",
"zh-cn": "适用于博世 Indego 割草机的适配器"
},
"authors": [
"TA2k <[email protected]>"
],
"keywords": [
"Indego"
],
"authors": ["TA2k <[email protected]>"],
"keywords": ["Indego"],
"licenseInformation": {
"license": "MIT",
"type": "free"
Expand Down Expand Up @@ -163,12 +159,8 @@
}
}
},
"encryptedNative": [
"password"
],
"protectedNative": [
"password"
],
"encryptedNative": ["password"],
"protectedNative": ["password"],
"native": {
"username": "",
"password": "",
Expand Down
39 changes: 15 additions & 24 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,12 @@ class Boschindego extends utils.Adapter {
if (this.session.access_token) {
await this.getDeviceList();
await this.updateDevices();
this.updateInterval = setInterval(
async () => {
await this.updateDevices();
},
this.config.interval * 60 * 1000,
);
this.refreshTokenInterval = setInterval(
async () => {
await this.refreshToken();
},
(this.session.expires_in - 100 || 3500) * 1000,
);
this.updateInterval = setInterval(async () => {
await this.updateDevices();
}, this.config.interval * 60 * 1000);
this.refreshTokenInterval = setInterval(async () => {
await this.refreshToken();
}, (this.session.expires_in - 100 || 3500) * 1000);
}
}

Expand All @@ -132,8 +126,7 @@ class Boschindego extends utils.Adapter {
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',
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',
Expand Down Expand Up @@ -161,7 +154,7 @@ class Boschindego extends utils.Adapter {
}
let formData = '';

const loginParams = await this.requestClient({
const loginUrl = await this.requestClient({
method: 'get',
url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/unified',
params: {
Expand All @@ -182,13 +175,14 @@ class Boschindego extends utils.Adapter {
.then((res) => {
this.log.debug(JSON.stringify(res.data));
formData = this.extractHidden(res.data);
return qs.parse(res.request.path.split('?')[1]);
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));
Expand All @@ -198,7 +192,7 @@ class Boschindego extends utils.Adapter {
const userResponse = await this.requestClient({
method: 'post',
maxBodyLength: Infinity,
url: 'https://singlekey-id.com/auth/de-de/login',
url: 'https://singlekey-id.com' + loginUrlPath,
headers: {
'content-type': 'application/x-www-form-urlencoded',
accept: '*/*',
Expand Down Expand Up @@ -233,7 +227,7 @@ class Boschindego extends utils.Adapter {
await this.requestClient({
method: 'post',
maxBodyLength: Infinity,
url: 'https://singlekey-id.com/auth/de-de/login/password',
url: 'https://singlekey-id.com' + loginUrlPath + '/password',
headers: {
'content-type': 'application/x-www-form-urlencoded',
accept: '*/*',
Expand Down Expand Up @@ -547,10 +541,7 @@ class Boschindego extends utils.Adapter {
}

for (const id of this.deviceArray) {
if (
(this.config.getMap && this.lastState[id] == null) ||
(this.lastState[id] >= 500 && this.lastState[id] <= 799)
) {
if ((this.config.getMap && this.lastState[id] == null) || (this.lastState[id] >= 500 && this.lastState[id] <= 799)) {
this.log.debug('Add map to update because of state ' + this.lastState[id]);
statusArray.push({
path: 'map',
Expand Down Expand Up @@ -654,7 +645,7 @@ class Boschindego extends utils.Adapter {
//add location to map
map = map.replace(
'</svg>',
`<circle cx="${state.svg_xPos}" cy="${state.svg_yPos}" r="20" stroke="black" stroke-width="3" fill="yellow"/> </svg>`,
`<circle cx="${state.svg_xPos}" cy="${state.svg_yPos}" r="20" stroke="black" stroke-width="3" fill="yellow"/> </svg>`
);
//transparent background
map = map.replace('ry="0" fill="#FAFAFA"', 'ry="0" fill="#00000" fill-opacity="0.0"');
Expand Down
Loading

0 comments on commit 406ff02

Please sign in to comment.