iobroker.google-sharedlocations2 0.0.1 → 0.0.2

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 CHANGED
@@ -27,9 +27,8 @@ Copyright and trademark of Google are property of Google.
27
27
  Placeholder for the next version (at the beginning of the line):
28
28
  ### **WORK IN PROGRESS**
29
29
  -->
30
-
31
- ### **WORK IN PROGRESS**
32
- * (Garfonso) initial release
30
+ ### 0.0.2 (2026-01-28)
31
+ * (Garfonso) store password encrypted
33
32
 
34
33
  ## License
35
34
  MIT License
package/io-package.json CHANGED
@@ -1,178 +1,197 @@
1
1
  {
2
- "common": {
3
- "name": "google-sharedlocations2",
4
- "version": "0.0.1",
5
- "news": {
6
- "0.0.1": {
7
- "en": "initial release",
8
- "de": "Erstveröffentlichung",
9
- "ru": "Начальная версия",
10
- "pt": "lançamento inicial",
11
- "nl": "Eerste uitgave",
12
- "fr": "Première version",
13
- "it": "Versione iniziale",
14
- "es": "Versión inicial",
15
- "pl": "Pierwsze wydanie",
16
- "uk": "Початкова версія",
17
- "zh-cn": "首次出版"
18
- }
19
- },
20
- "titleLang": {
21
- "en": "Google Shared Locations 2",
22
- "de": "Von Google freigegebene Standorte 2",
23
- "ru": "Общие местоположения Google 2",
24
- "pt": "Locais compartilhados do Google 2",
25
- "nl": "Google gedeelde locaties 2",
26
- "fr": "Emplacements partagés Google 2",
27
- "it": "Posizioni condivise di Google 2",
28
- "es": "Ubicaciones compartidas de Google 2",
29
- "pl": "Udostępnione lokalizacje Google 2",
30
- "uk": "Google Shared Locations 2",
31
- "zh-cn": "Google 共享位置 2"
32
- },
33
- "desc": {
34
- "en": "Share your location with ioBroker via google maps.",
35
- "de": "Teilen Sie Ihren Standort über Google Maps mit ioBroker.",
36
- "ru": "Поделитесь своим местоположением с ioBroker через карты Google.",
37
- "pt": "Compartilhe sua localização com o ioBroker através do Google Maps.",
38
- "nl": "Deel uw locatie met ioBroker via Google Maps.",
39
- "fr": "Partagez votre position avec ioBroker via Google Maps.",
40
- "it": "Condividi la tua posizione con ioBroker tramite Google Maps.",
41
- "es": "Comparte tu ubicación con ioBroker a través de Google Maps.",
42
- "pl": "Udostępnij swoją lokalizację ioBrokerowi za pośrednictwem map Google.",
43
- "uk": "Поділіться своїм місцезнаходженням з ioBroker через карти Google.",
44
- "zh-cn": "通过谷歌地图与 ioBroker 分享您的位置。"
45
- },
46
- "authors": [
47
- "Garfonso <garfonso@mobo.info>"
48
- ],
49
- "keywords": [
50
- "google",
51
- "geofence",
52
- "gps",
53
- "position",
54
- "geo"
55
- ],
56
- "licenseInformation": {
57
- "type": "free",
58
- "license": "MIT"
59
- },
60
- "platform": "Javascript/Node.js",
61
- "icon": "google-sharedlocations2.png",
62
- "enabled": true,
63
- "extIcon": "https://raw.githubusercontent.com/Garfonso/ioBroker.google-sharedlocations2/main/admin/google-sharedlocations2.png",
64
- "readme": "https://github.com/Garfonso/ioBroker.google-sharedlocations2/blob/main/README.md",
65
- "loglevel": "info",
66
- "tier": 3,
67
- "mode": "daemon",
68
- "type": "geoposition",
69
- "compact": true,
70
- "connectionType": "cloud",
71
- "dataSource": "poll",
72
- "adminUI": {
73
- "config": "json"
74
- },
75
- "dependencies": [
76
- {
77
- "js-controller": ">=6.0.11"
78
- }
79
- ],
80
- "globalDependencies": [
81
- {
82
- "admin": ">=7.0.23"
83
- }
84
- ],
85
- "osDependencies": {
86
- "linux": [
87
- "ca-certificates",
88
- "fonts-liberation",
89
- "libappindicator3-1",
90
- "libasound2",
91
- "libatk-bridge2.0-0",
92
- "libatk1.0-0",
93
- "libc6",
94
- "libcairo2",
95
- "libcups2",
96
- "libdbus-1-3",
97
- "libexpat1",
98
- "libfontconfig1",
99
- "libgbm1",
100
- "libgcc1",
101
- "libglib2.0-0",
102
- "libgtk-3-0",
103
- "libnspr4",
104
- "libnss3",
105
- "libpango-1.0-0",
106
- "libpangocairo-1.0-0",
107
- "libstdc++6",
108
- "libx11-6",
109
- "libx11-xcb1",
110
- "libxcb1",
111
- "libxcomposite1",
112
- "libxcursor1",
113
- "libxdamage1",
114
- "libxext6",
115
- "libxfixes3",
116
- "libxi6",
117
- "libxrandr2",
118
- "libxrender1",
119
- "libxss1",
120
- "libxtst6",
121
- "lsb-release",
122
- "wget",
123
- "xdg-utils"
124
- ]
125
- }
2
+ "common": {
3
+ "name": "google-sharedlocations2",
4
+ "version": "0.0.2",
5
+ "news": {
6
+ "0.0.2": {
7
+ "en": "store password encrypted",
8
+ "de": "speicher passwort verschlüsselt",
9
+ "ru": "зашифрованный пароль",
10
+ "pt": "guardar a senha encriptada",
11
+ "nl": "wachtwoord versleuteld opslaan",
12
+ "fr": "crypté du mot de passe de stockage",
13
+ "it": "negozio password crittografato",
14
+ "es": "almacenar contraseña cifrada",
15
+ "pl": "przechowywać zaszyfrowane hasło",
16
+ "uk": "зашифрований паролем",
17
+ "zh-cn": "存储加密密码"
18
+ },
19
+ "0.0.1": {
20
+ "en": "initial release",
21
+ "de": "Erstveröffentlichung",
22
+ "ru": "Начальная версия",
23
+ "pt": "lançamento inicial",
24
+ "nl": "Eerste uitgave",
25
+ "fr": "Première version",
26
+ "it": "Versione iniziale",
27
+ "es": "Versión inicial",
28
+ "pl": "Pierwsze wydanie",
29
+ "uk": "Початкова версія",
30
+ "zh-cn": "首次出版"
31
+ }
126
32
  },
127
- "native": {
128
- "googleUsername": "",
129
- "googlePassword": "",
130
- "pollInterval": 60
33
+ "titleLang": {
34
+ "en": "Google Shared Locations 2",
35
+ "de": "Von Google freigegebene Standorte 2",
36
+ "ru": "Общие местоположения Google 2",
37
+ "pt": "Locais compartilhados do Google 2",
38
+ "nl": "Google gedeelde locaties 2",
39
+ "fr": "Emplacements partagés Google 2",
40
+ "it": "Posizioni condivise di Google 2",
41
+ "es": "Ubicaciones compartidas de Google 2",
42
+ "pl": "Udostępnione lokalizacje Google 2",
43
+ "uk": "Google Shared Locations 2",
44
+ "zh-cn": "Google 共享位置 2"
131
45
  },
132
- "objects": [],
133
- "instanceObjects": [
134
- {
135
- "_id": "info",
136
- "type": "channel",
137
- "common": {
138
- "name": "Information"
139
- },
140
- "native": {}
141
- },
142
- {
143
- "_id": "info.connection",
144
- "type": "state",
145
- "common": {
146
- "role": "indicator.connected",
147
- "name": "Device or service connected",
148
- "type": "boolean",
149
- "read": true,
150
- "write": false,
151
- "def": false
152
- },
153
- "native": {}
154
- },
155
- {
156
- "_id": "info.currentCookies",
157
- "type": "state",
158
- "common": {
159
- "role": "state",
160
- "name": "Current authentication cookies",
161
- "desc": "Overwrite to set cookies manually. Set empty to login again.",
162
- "type": "string",
163
- "read": true,
164
- "write": true,
165
- "def": ""
166
- }
167
- },
168
- {
169
- "_id": "users",
170
- "type": "folder",
171
- "common": {
172
- "name": "Users",
173
- "desc": "Retrieved information on users."
174
- },
175
- "native": {}
176
- }
177
- ]
178
- }
46
+ "desc": {
47
+ "en": "Share your location with ioBroker via google maps.",
48
+ "de": "Teilen Sie Ihren Standort über Google Maps mit ioBroker.",
49
+ "ru": "Поделитесь своим местоположением с ioBroker через карты Google.",
50
+ "pt": "Compartilhe sua localização com o ioBroker através do Google Maps.",
51
+ "nl": "Deel uw locatie met ioBroker via Google Maps.",
52
+ "fr": "Partagez votre position avec ioBroker via Google Maps.",
53
+ "it": "Condividi la tua posizione con ioBroker tramite Google Maps.",
54
+ "es": "Comparte tu ubicación con ioBroker a través de Google Maps.",
55
+ "pl": "Udostępnij swoją lokalizację ioBrokerowi za pośrednictwem map Google.",
56
+ "uk": "Поділіться своїм місцезнаходженням з ioBroker через карти Google.",
57
+ "zh-cn": "通过谷歌地图与 ioBroker 分享您的位置。"
58
+ },
59
+ "authors": [
60
+ "Garfonso <garfonso@mobo.info>"
61
+ ],
62
+ "keywords": [
63
+ "google",
64
+ "geofence",
65
+ "gps",
66
+ "position",
67
+ "geo"
68
+ ],
69
+ "licenseInformation": {
70
+ "type": "free",
71
+ "license": "MIT"
72
+ },
73
+ "platform": "Javascript/Node.js",
74
+ "icon": "google-sharedlocations2.png",
75
+ "enabled": true,
76
+ "extIcon": "https://raw.githubusercontent.com/Garfonso/ioBroker.google-sharedlocations2/main/admin/google-sharedlocations2.png",
77
+ "readme": "https://github.com/Garfonso/ioBroker.google-sharedlocations2/blob/main/README.md",
78
+ "loglevel": "info",
79
+ "tier": 3,
80
+ "mode": "daemon",
81
+ "type": "geoposition",
82
+ "compact": true,
83
+ "connectionType": "cloud",
84
+ "dataSource": "poll",
85
+ "adminUI": {
86
+ "config": "json"
87
+ },
88
+ "dependencies": [
89
+ {
90
+ "js-controller": ">=6.0.11"
91
+ }
92
+ ],
93
+ "globalDependencies": [
94
+ {
95
+ "admin": ">=7.0.23"
96
+ }
97
+ ],
98
+ "osDependencies": {
99
+ "linux": [
100
+ "ca-certificates",
101
+ "fonts-liberation",
102
+ "libappindicator3-1",
103
+ "libasound2",
104
+ "libatk-bridge2.0-0",
105
+ "libatk1.0-0",
106
+ "libc6",
107
+ "libcairo2",
108
+ "libcups2",
109
+ "libdbus-1-3",
110
+ "libexpat1",
111
+ "libfontconfig1",
112
+ "libgbm1",
113
+ "libgcc1",
114
+ "libglib2.0-0",
115
+ "libgtk-3-0",
116
+ "libnspr4",
117
+ "libnss3",
118
+ "libpango-1.0-0",
119
+ "libpangocairo-1.0-0",
120
+ "libstdc++6",
121
+ "libx11-6",
122
+ "libx11-xcb1",
123
+ "libxcb1",
124
+ "libxcomposite1",
125
+ "libxcursor1",
126
+ "libxdamage1",
127
+ "libxext6",
128
+ "libxfixes3",
129
+ "libxi6",
130
+ "libxrandr2",
131
+ "libxrender1",
132
+ "libxss1",
133
+ "libxtst6",
134
+ "lsb-release",
135
+ "wget",
136
+ "xdg-utils"
137
+ ]
138
+ }
139
+ },
140
+ "native": {
141
+ "googleUsername": "",
142
+ "googlePassword": "",
143
+ "pollInterval": 60
144
+ },
145
+ "protectedNative": [
146
+ "googlePassword"
147
+ ],
148
+ "encryptedNative": [
149
+ "googlePassword"
150
+ ],
151
+ "objects": [],
152
+ "instanceObjects": [
153
+ {
154
+ "_id": "info",
155
+ "type": "channel",
156
+ "common": {
157
+ "name": "Information"
158
+ },
159
+ "native": {}
160
+ },
161
+ {
162
+ "_id": "info.connection",
163
+ "type": "state",
164
+ "common": {
165
+ "role": "indicator.connected",
166
+ "name": "Device or service connected",
167
+ "type": "boolean",
168
+ "read": true,
169
+ "write": false,
170
+ "def": false
171
+ },
172
+ "native": {}
173
+ },
174
+ {
175
+ "_id": "info.currentCookies",
176
+ "type": "state",
177
+ "common": {
178
+ "role": "state",
179
+ "name": "Current authentication cookies",
180
+ "desc": "Overwrite to set cookies manually. Set empty to login again.",
181
+ "type": "string",
182
+ "read": true,
183
+ "write": true,
184
+ "def": ""
185
+ }
186
+ },
187
+ {
188
+ "_id": "users",
189
+ "type": "folder",
190
+ "common": {
191
+ "name": "Users",
192
+ "desc": "Retrieved information on users."
193
+ },
194
+ "native": {}
195
+ }
196
+ ]
197
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.google-sharedlocations2",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Share your location with iobroker via google maps.",
5
5
  "author": {
6
6
  "name": "Garfonso",
@@ -36,6 +36,7 @@
36
36
  "@alcalzone/release-script-plugin-manual-review": "^4.0.0",
37
37
  "@iobroker/adapter-dev": "^1.5.0",
38
38
  "@iobroker/dev-server": "^0.8.0",
39
+ "@iobroker/eslint-config": "^2.2.0",
39
40
  "@iobroker/testing": "^5.2.2",
40
41
  "@iobroker/types": "^7.1.0",
41
42
  "@tsconfig/node22": "^22.0.5",
@@ -61,7 +62,8 @@
61
62
  "test": "npm run test:ts && npm run test:package",
62
63
  "translate": "translate-adapter",
63
64
  "release": "release-script",
64
- "dev-server": "dev-server"
65
+ "dev-server": "dev-server",
66
+ "lint": "eslint -c eslint.config.mjs src/"
65
67
  },
66
68
  "bugs": {
67
69
  "url": "https://github.com/Garfonso/ioBroker.google-sharedlocations2/issues"
package/src/main.ts CHANGED
@@ -66,13 +66,13 @@ class GoogleSharedlocations2 extends utils.Adapter {
66
66
  }
67
67
 
68
68
  //start polling positions
69
- await this.pollPositions();
69
+ this.pollPositions();
70
70
  if (this._cookies) {
71
71
  await this.sendRequest();
72
72
  }
73
73
  }
74
74
 
75
- private async pollPositions() {
75
+ private pollPositions(): void {
76
76
  this._pollTimeout = this.setTimeout(async () => {
77
77
  if (!this._cookies) {
78
78
  this.log.debug('Cannot poll positions, no cookies available!');
@@ -85,7 +85,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
85
85
  }, this._pollInterval * 1000);
86
86
  }
87
87
 
88
- private async sendRequest() {
88
+ private async sendRequest(): Promise<void> {
89
89
  if (!this._cookies) {
90
90
  this.log.error('Cannot send request, no cookies available!');
91
91
  await this.setState('info.connection', false, true);
@@ -96,22 +96,22 @@ class GoogleSharedlocations2 extends utils.Adapter {
96
96
  this.log.debug('Sending request with current cookies');
97
97
  const options = {
98
98
  method: 'GET',
99
- url: "https://www.google.com/maps/rpc/locationsharing/read",
99
+ url: 'https://www.google.com/maps/rpc/locationsharing/read',
100
100
  headers: {
101
- 'Cookie': this._cookies,
101
+ Cookie: this._cookies,
102
102
  },
103
103
  params: {
104
- "authuser": 2,
105
- "hl": "en",
106
- "gl": "us",
104
+ authuser: 2,
105
+ hl: 'en',
106
+ gl: 'us',
107
107
  //pb is place on map. Is irrelevant, set to google head quarters here.
108
- "pb": "!1m7!8m6!1m3!1i14!2i8413!3i5385!2i6!3x4095!2m3!1e0!2sm!3i407105169!3m7!2sen!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e1!5m4!1e4!8m2!1e0!1e1!6m9!1e12!2i2!26m1!4b1!30m1!1f1.3953487873077393!39b1!44e1!50e0!23i4111425"
109
- }
108
+ pb: '!1m7!8m6!1m3!1i14!2i8413!3i5385!2i6!3x4095!2m3!1e0!2sm!3i407105169!3m7!2sen!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e1!5m4!1e4!8m2!1e0!1e1!6m9!1e12!2i2!26m1!4b1!30m1!1f1.3953487873077393!39b1!44e1!50e0!23i4111425',
109
+ },
110
110
  };
111
111
 
112
112
  try {
113
113
  const response = await axios.request(options);
114
- this.log.debug('Request successful, response code: ' + response.status);
114
+ this.log.debug(`Request successful, response code: ${response.status}`);
115
115
  const data = response.data.split('\n').slice(1).join('\n');
116
116
  const locationData = JSON.parse(data);
117
117
  const locations = locationData[0];
@@ -129,7 +129,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
129
129
  }
130
130
  }
131
131
  } catch (e) {
132
- this.log.error('Error during request: ' + (e as Error).message);
132
+ this.log.error(`Error during request: ${(e as Error).message}`);
133
133
  if (this._successFullPolls > 0) {
134
134
  //try to get new cookie:
135
135
  await this.loginToGetNewCookies();
@@ -137,7 +137,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
137
137
  }
138
138
  }
139
139
 
140
- private async fillIntoObjects(locationData: any) {
140
+ private async fillIntoObjects(locationData: any): Promise<void> {
141
141
  try {
142
142
  const user = {
143
143
  id: undefined,
@@ -148,31 +148,49 @@ class GoogleSharedlocations2 extends utils.Adapter {
148
148
  address: undefined,
149
149
  battery: undefined,
150
150
  timestamp: undefined,
151
- accuracy: undefined
151
+ accuracy: undefined,
152
152
  };
153
153
 
154
- if(locationData && Array.isArray(locationData)) {
154
+ if (locationData && Array.isArray(locationData)) {
155
155
  // locationData present
156
- if(locationData[0] && locationData[0][0]) user['id'] = locationData[0][0];
157
- if(locationData[0] && locationData[0][1]) user['photoURL'] = locationData[0][1];
158
- if(locationData[0] && locationData[0][3]) user['name'] = locationData[0][3];
159
- if(locationData[1] && locationData[1][1] && locationData[1][1][2]) user['lat'] = locationData[1][1][2];
160
- if(locationData[1] && locationData[1][1] && locationData[1][1][1]) user['long'] = locationData[1][1][1];
161
- if(locationData[1] && locationData[1][4]) user['address'] = locationData[1][4];
162
- if(locationData[13] && locationData[13][1]) user['battery'] = locationData[13][1];
163
- if(locationData[1] && locationData[1][2]) user['timestamp'] = locationData[1][2];
164
- if(locationData[1] && locationData[1][3]) user['accuracy'] = locationData[1][3];
156
+ if (locationData[0] && locationData[0][0]) {
157
+ user.id = locationData[0][0];
158
+ }
159
+ if (locationData[0] && locationData[0][1]) {
160
+ user.photoURL = locationData[0][1];
161
+ }
162
+ if (locationData[0] && locationData[0][3]) {
163
+ user.name = locationData[0][3];
164
+ }
165
+ if (locationData[1] && locationData[1][1] && locationData[1][1][2]) {
166
+ user.lat = locationData[1][1][2];
167
+ }
168
+ if (locationData[1] && locationData[1][1] && locationData[1][1][1]) {
169
+ user.long = locationData[1][1][1];
170
+ }
171
+ if (locationData[1] && locationData[1][4]) {
172
+ user.address = locationData[1][4];
173
+ }
174
+ if (locationData[13] && locationData[13][1]) {
175
+ user.battery = locationData[13][1];
176
+ }
177
+ if (locationData[1] && locationData[1][2]) {
178
+ user.timestamp = locationData[1][2];
179
+ }
180
+ if (locationData[1] && locationData[1][3]) {
181
+ user.accuracy = locationData[1][3];
182
+ }
165
183
  }
166
184
 
167
185
  if (user.id) {
168
- const basepath = `users.${user.id}`;
186
+ const basepath = `users.${user.id as string}`;
169
187
  const deviceObj = {
170
188
  _id: basepath,
171
189
  type: 'device',
172
190
  common: {
173
191
  name: user.name || user.id,
174
192
  },
175
- native: {}
193
+ native: {},
176
194
  };
177
195
  await this.setObjectNotExistsAsync(basepath, deviceObj as ioBroker.SettableDeviceObject);
178
196
 
@@ -188,7 +206,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
188
206
  },
189
207
  native: {},
190
208
  });
191
- await this.setState(`${basepath}.photoURL`, {val: user.photoURL, ts: user.timestamp, ack: true});
209
+ await this.setState(`${basepath}.photoURL`, { val: user.photoURL, ts: user.timestamp, ack: true });
192
210
  }
193
211
 
194
212
  if (user.name) {
@@ -203,7 +221,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
203
221
  },
204
222
  native: {},
205
223
  });
206
- await this.setState(`${basepath}.name`, {val: user.name, ts: user.timestamp, ack: true});
224
+ await this.setState(`${basepath}.name`, { val: user.name, ts: user.timestamp, ack: true });
207
225
  }
208
226
 
209
227
  if (user.lat) {
@@ -218,7 +236,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
218
236
  },
219
237
  native: {},
220
238
  });
221
- await this.setState(`${basepath}.lat`, {val: user.lat, ts: user.timestamp, ack: true});
239
+ await this.setState(`${basepath}.lat`, { val: user.lat, ts: user.timestamp, ack: true });
222
240
  }
223
241
 
224
242
  if (user.long) {
@@ -233,7 +251,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
233
251
  },
234
252
  native: {},
235
253
  });
236
- await this.setState(`${basepath}.long`, { val: user.long, ts: user.timestamp, ack: true});
254
+ await this.setState(`${basepath}.long`, { val: user.long, ts: user.timestamp, ack: true });
237
255
  }
238
256
 
239
257
  if (user.address) {
@@ -248,7 +266,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
248
266
  },
249
267
  native: {},
250
268
  });
251
- await this.setState(`${basepath}.address`, { val: user.address, ts: user.timestamp, ack: true});
269
+ await this.setState(`${basepath}.address`, { val: user.address, ts: user.timestamp, ack: true });
252
270
  }
253
271
 
254
272
  if (user.battery !== undefined) {
@@ -260,11 +278,11 @@ class GoogleSharedlocations2 extends utils.Adapter {
260
278
  read: true,
261
279
  write: false,
262
280
  role: 'value.battery',
263
- unit: '%'
281
+ unit: '%',
264
282
  },
265
283
  native: {},
266
284
  });
267
- await this.setState(`${basepath}.battery`, { val: user.battery, ts: user.timestamp, ack: true});
285
+ await this.setState(`${basepath}.battery`, { val: user.battery, ts: user.timestamp, ack: true });
268
286
  }
269
287
 
270
288
  if (user.accuracy !== undefined) {
@@ -276,15 +294,15 @@ class GoogleSharedlocations2 extends utils.Adapter {
276
294
  read: true,
277
295
  write: false,
278
296
  role: 'value.gps.accuracy',
279
- unit: 'm'
297
+ unit: 'm',
280
298
  },
281
299
  native: {},
282
300
  });
283
- await this.setState(`${basepath}.accuracy`, { val: user.accuracy, ts: user.timestamp, ack: true});
301
+ await this.setState(`${basepath}.accuracy`, { val: user.accuracy, ts: user.timestamp, ack: true });
284
302
  }
285
303
  }
286
304
  } catch (e) {
287
- this.log.error('Could not parse user location data: ' + (e as Error).message);
305
+ this.log.error(`Could not parse user location data: ${(e as Error).message}`);
288
306
  }
289
307
  }
290
308
 
@@ -301,12 +319,8 @@ class GoogleSharedlocations2 extends utils.Adapter {
301
319
  this.log.debug('Starting browser.');
302
320
  this._browser = await puppeteer.launch({
303
321
  headless: true,
304
- args: [
305
- '--no-sandbox',
306
- '--disable-setuid-sandbox',
307
- '--disable-blink-features=AutomationControlled'
308
- ],
309
- ignoreDefaultArgs: ['--enable-automation'] //hide automation flag, did not help.
322
+ args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-blink-features=AutomationControlled'],
323
+ ignoreDefaultArgs: ['--enable-automation'], //hide automation flag, did not help.
310
324
  });
311
325
  this.log.debug('browser started, opening new page.');
312
326
  const page = await this._browser.newPage();
@@ -315,13 +329,19 @@ class GoogleSharedlocations2 extends utils.Adapter {
315
329
  await page.evaluateOnNewDocument(() => {
316
330
  Object.defineProperty(navigator, 'webdriver', { get: () => false });
317
331
  });
318
- await page.setUserAgent({ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' });
332
+ await page.setUserAgent({
333
+ userAgent:
334
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
335
+ });
319
336
 
320
337
  this.log.debug('going to google login page.');
321
- await page.goto('https://accounts.google.com/ServiceLogin?hl=de&continue=https://www.google.com/maps&gae=cb-eomtm', {
322
- waitUntil: 'networkidle2',
323
- timeout: 60000
324
- });
338
+ await page.goto(
339
+ 'https://accounts.google.com/ServiceLogin?hl=de&continue=https://www.google.com/maps&gae=cb-eomtm',
340
+ {
341
+ waitUntil: 'networkidle2',
342
+ timeout: 60000,
343
+ },
344
+ );
325
345
 
326
346
  this.log.debug('filling in username and clicking next.');
327
347
  await page.locator('#identifierId').fill(this.config.googleUsername);
@@ -358,7 +378,7 @@ class GoogleSharedlocations2 extends utils.Adapter {
358
378
  }
359
379
  this._browser = null;
360
380
  } catch (e) {
361
- this.log.error('Error in puppeteer: ' + (e as Error).message);
381
+ this.log.error(`Error in puppeteer: ${(e as Error).message}`);
362
382
  }
363
383
  }
364
384
 
@@ -379,7 +399,10 @@ class GoogleSharedlocations2 extends utils.Adapter {
379
399
  }
380
400
  if (this._browser) {
381
401
  //ignore results here.
382
- this._browser.close().then(() => {}).catch(() => {});
402
+ this._browser
403
+ .close()
404
+ .then(() => {})
405
+ .catch(() => {});
383
406
  }
384
407
  callback();
385
408
  } catch (error) {
@@ -419,7 +442,9 @@ class GoogleSharedlocations2 extends utils.Adapter {
419
442
  await this.sendRequest();
420
443
  }
421
444
  } else {
422
- this.log.info('Current cookies state was changed from outside the adapter, updating internal cookie store.');
445
+ this.log.info(
446
+ 'Current cookies state was changed from outside the adapter, updating internal cookie store.',
447
+ );
423
448
  this._cookies = state.val as string;
424
449
  }
425
450
  }
@@ -442,9 +467,9 @@ class GoogleSharedlocations2 extends utils.Adapter {
442
467
  // }
443
468
  }
444
469
  //if (require.main !== module) {
445
- // Export the constructor in compact mode
446
- //module.exports = (options: Partial<utils.AdapterOptions> | undefined) => new GoogleSharedlocations2(options);
470
+ // Export the constructor in compact mode
471
+ //module.exports = (options: Partial<utils.AdapterOptions> | undefined) => new GoogleSharedlocations2(options);
447
472
  //} else {
448
- // otherwise start the instance directly
449
- (() => new GoogleSharedlocations2())();
473
+ // otherwise start the instance directly
474
+ (() => new GoogleSharedlocations2())();
450
475
  //}
@@ -0,0 +1,9 @@
1
+ // iobroker prettier configuration file
2
+ import prettierConfig from '@iobroker/eslint-config/prettier.config.mjs';
3
+
4
+ export default {
5
+ ...prettierConfig,
6
+ // Adjust these to match your preferences:
7
+ useTabs: false, // or false for spaces
8
+ singleQuote: true, // or true for single quotes
9
+ };