Skip to content

Commit

Permalink
0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed May 12, 2024
1 parent a1fb5da commit 84f87fa
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Adapter for FordPass

## Changelog

### 0.2.1 (2024-05-10)

- fixed login and added domain ending in settings
Expand Down
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"common": {
"name": "ford",
"version": "0.2.1",
"version": "0.2.2",
"news": {
"0.2.1": {
"0.2.2": {
"en": "fixed login and added domain ending in settings",
"de": "Login gefixt und Domain-Ende hinzugefügt in den Einstellungen",
"ru": "фиксированный логин и добавленный домен, заканчивающийся в настройках",
Expand Down
17 changes: 10 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Ford extends utils.Adapter {
this.log.error('Username or password missing');
return;
}
this.domain = this.config.domain || 'de';
this.currentDomain = this.config.domain || 'de';
this.subscribeStates('*');

await this.login();
Expand All @@ -95,7 +95,10 @@ class Ford extends utils.Adapter {
const loginForm = await this.requestClient({
method: 'get',
maxBodyLength: Infinity,
url: 'https://login.ford.' + this.domain + '/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/oauth2/v2.0/authorize',
url:
'https://login.ford.' +
this.currentDomain +
'/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/oauth2/v2.0/authorize',
headers: {
'user-agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
Expand Down Expand Up @@ -152,7 +155,7 @@ class Ford extends utils.Adapter {
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15',
Referer:
'https://login.ford.' +
this.domain +
this.currentDomain +
'/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/oauth2/v2.0/authorize?redirect_uri=fordapp%3A%2F%2Fuserauthorized&response_type=code&scope=09852200-05fd-41f6-8c21-d36d3497dc64%20openid&max_age=3600&login_hint=eyJyZWFsbSI6ICJjbG91ZElkZW50aXR5UmVhbG0ifQ%3D%3D&code_challenge=zqeXnKibRiFPmdFOYTUqBJz9lJ7ahQjzPncyN8QroVg&code_challenge_method=S256&client_id=09852200-05fd-41f6-8c21-d36d3497dc64&language_code=de-DE&ford_application_id=667D773E-1BDC-4139-8AD0-2B16474E8DC7&country_code=DEU',
'Sec-Fetch-Dest': 'empty',
},
Expand All @@ -174,7 +177,7 @@ class Ford extends utils.Adapter {
maxBodyLength: Infinity,
url:
'https://login.ford.' +
this.domain +
this.currentDomain +
'/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/SelfAsserted?tx=' +
loginForm.transId +
'&p=B2C_1A_SignInSignUp_de-DE',
Expand All @@ -185,7 +188,7 @@ class Ford extends utils.Adapter {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
accept: 'application/json, text/javascript, */*; q=0.01',
'x-requested-with': 'XMLHttpRequest',
origin: 'https://login.ford.' + this.domain + '',
origin: 'https://login.ford.' + this.currentDomain + '',
'accept-language': 'de-DE,de;q=0.9,en-DE;q=0.8,en-US;q=0.7,en;q=0.6',
},
data: { request_type: 'RESPONSE', signInName: this.config.username, password: this.config.password },
Expand All @@ -209,7 +212,7 @@ class Ford extends utils.Adapter {
maxBodyLength: Infinity,
url:
'https://login.ford.' +
this.domain +
this.currentDomain +
'/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/api/CombinedSigninAndSignup/confirmed?rememberMe=false&csrf_token=' +
loginForm.csrf +
'&tx=StateProperties=' +
Expand Down Expand Up @@ -245,7 +248,7 @@ class Ford extends utils.Adapter {
const midToken = await this.requestClient({
method: 'post',
maxBodyLength: Infinity,
url: 'https://login.ford.' + this.domain + '/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/oauth2/v2.0/token',
url: 'https://login.ford.' + this.currentDomain + '/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE/oauth2/v2.0/token',
headers: {
'x-dynatrace': 'MT_3_31_2178850551_22-0_997d5837-2d14-4fbb-a338-5c70d678d40e_0_11083_292',
'content-type': 'application/x-www-form-urlencoded',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.ford",
"version": "0.2.1",
"version": "0.2.2",
"description": "Adapter for FordPass",
"author": {
"name": "TA2k",
Expand Down

0 comments on commit 84f87fa

Please sign in to comment.