Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a51848d
update travis.yml
Apollon77 Sep 1, 2019
484c6d1
update appveyor.yml
Apollon77 Sep 1, 2019
ccdbea7
update travis.yml
Apollon77 Sep 5, 2021
84bbbf2
update appveyor.yml
Apollon77 Sep 5, 2021
007812e
* adjust travis testing
Apollon77 Sep 5, 2021
2cd7c97
store cookie in configuration
Garfonso Jun 1, 2020
a4e7596
fixed warnings and updated dependencies
Garfonso Jun 1, 2020
c5e8ca2
fixed tests (locally)
Garfonso Jun 1, 2020
4a049e0
updated readme & bumped version
Garfonso Jun 1, 2020
fffe404
increase minimum poll time to 60s
Garfonso Jun 2, 2020
c1beb66
fix checkConnection
Garfonso Jun 2, 2020
2f6f4f0
improved errorhandling
Garfonso Jun 3, 2020
4a92b43
Update io-package.json
Garfonso Jun 3, 2020
21e816e
update readme and clarify error message
Garfonso Jun 7, 2020
53f68a3
fixed more object creation warnings
Garfonso Jun 18, 2020
2f6426c
try to fix 500 error (?)
Garfonso Jan 13, 2021
3b41804
fixed 500 errors and updated dependencies
Garfonso Jan 13, 2021
432a1e1
v2.1.0
Garfonso Feb 14, 2021
4f306ae
improveCookie two times (like HASS)
Garfonso Feb 14, 2021
5d9e348
fix package error
Garfonso Feb 14, 2021
d22785d
v2.1.1
Garfonso Apr 3, 2021
ce0b6a2
improve cookie update
Garfonso May 20, 2021
3fe91dd
fix adapter stays green even without updates
Garfonso May 20, 2021
1569733
fix crash on get users from db
Garfonso May 20, 2021
70b9ef5
Update README.md
Garfonso May 20, 2021
cd2203d
update dependencies
Garfonso May 21, 2021
063daac
chore: release v2.1.2
Garfonso May 21, 2021
b7dac85
Update .gitignore
Garfonso May 31, 2021
e57f41c
add tier 2
Garfonso May 31, 2021
b65c6d6
add release-script
Garfonso May 31, 2021
fc7c302
augment cookie also from position updates if contain new infos.
Garfonso May 31, 2021
532ae1b
delete augmented cookie on update from user
Garfonso May 31, 2021
503b9d1
Update package-lock.json
Garfonso May 31, 2021
33eee9d
Update README.md
Garfonso May 31, 2021
857695f
chore: release v2.1.3
Garfonso May 31, 2021
fdda7ef
Bump ini from 1.3.5 to 1.3.8
dependabot[bot] Jun 5, 2021
e1f1cd8
Bump y18n from 3.2.1 to 3.2.2
dependabot[bot] Jun 5, 2021
5e7392e
Bump hosted-git-info from 2.8.8 to 2.8.9
dependabot[bot] Jun 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/admin/i18n
/.idea
/node_modules
/node_modules
/.dev-server
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ os:
- windows
language: node_js
node_js:
- '6'
- '8'
- '10'
- '12'
- '14'
- '16'
before_script:
- export NPMVERSION=$(echo "$($(which npm) -v)"|cut -c1)
- 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm@5; fi'
Expand Down
71 changes: 64 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,85 @@ ioBroker adapter for google-sharedlocations
[![Build Status](https://travis-ci.org/t4qjXH8N/ioBroker.google-sharedlocations.svg?branch=master)](https://travis-ci.org/t4qjXH8N/ioBroker.google-sharedlocations)
[![Build status](https://ci.appveyor.com/api/projects/status/d5rora9wgp7otg23/branch/master?svg=true)](https://ci.appveyor.com/project/t4qjXH8N/iobroker-google-sharedlocations/branch/master)

# NOTE: Google does not allow logins without Javascript anymore. Hence this adapter will be useless until another solution is found.

## Description
This is an ioBroker-adapter that can retrieve the location data of users that are sharing their location via google shared locations. It can not retrieve the location of the user that is used to access google.
This is an ioBroker-adapter that can retrieve the location data of users that are sharing their location via google shared
locations. It can not retrieve the location of the user that is used to access google.

Circularly shaped geofences can be defined in the adapter config. These geofences can be associated with users, i.e. that a state is toogled if the user enters or leaves a geofence.
Circularly shaped geofences can be defined in the adapter config. These geofences can be associated with users, i.e.
that a state is toogled if the user enters or leaves a geofence.

The adapter can receive and process a bunch of messages, please have a look at main.js for details. Sometimes the recovery email address has to be used to solve a challenge by Googles, therefore it may have to be entered in the adapter.
The adapter can receive and process a bunch of messages, please have a look at main.js for details.

## Usage
There are three possibilities to login into your Google account. The first possibility is to enter your account credentials and the recovery email address associated with the account. If the first possibility fails, use the second possibility . The second possibility retrieves the cookie using a proxy. If the second possibility fails, you can enter the cookie directly. Two factor authentification has to be disabled for the user.
Because the adapter won't retreive any information about the user logged in, it is advised to create a new user dedicated for ioBroker.

### General setup
1. Create a new Google account for iobroker. I will call it "iobroker-Google-Account" later in the document.
2. Log in with different Google accounts on all smartphones that should be tracked and start location sharing in Google Maps App.
3. Open a "private browsing" window in your Web browser and log into google.com/maps with your iobroker-Google-Account.
You should now see a bunch of people with their locations on the map.
4. Copy the Cookie as described [below](#login).
5. Close the window, do **not** log out of the session!

### Login
Currently login via the adapter is not possible. In future versions the adapter might create a proxy server and you'll have to
login via the browser once, similar to the alexa2 adapter. But currently you'll have to enter the cookie in the configuration page
manually in order to login. For this, do the following:
1. Open a private browsing window (if not done already)
2. Log in to google.com/maps (.com is important!) with your ioBroker-Google-Account (if not done already)
3. Open Developer Tools of your browser (ctrl+shift+I)
4. Navigate to network analysis
5. select any successful (Status = 200) GET (method) Request from google.com (Host column) (if the window is empty, hit F5 in the browser)
6. In the headers window copy all contents (ctrl+a then ctrl+c) from the line Cookie.
![Screenshot](admin/google-cookie.JPG)

## Troubleshooting
### instance indicator is green but no location data is received or instance indicator is yellow and the log says "please login manually"
In this case check the google account of the user that is used by the google-sharedlocations adapter. Log in with a browser and check if google blocked some logins. Click on a blocked login and confirm to google that this was you. Additionally check that two factor authentification is turned off.
In this case check the google account of the user that is used by the google-sharedlocations adapter. Log in with a
browser and check if google blocked some logins. Click on a blocked login and confirm to google that this was you.
Additionally check that two factor authentification is turned off.

If you still experience problems please open an issue. Please set the adapter level to debug and publish the log there. Otherwise I have no change to help.

## Donation
If this project helped you to reduce developing time, you can give me a cup of coffee or a bottle of beer via PayPal(chvorholt@gmail.com) :-)

## Changelog
<!--
Placeholder for next versions (this needs to be indented):
### __WORK IN PROGRESS__
npm install @alcalzone/release-script
-->
### 2.1.3 (2021-05-31)
- update cookie info also on position updates (Garfonso)

### 2.1.2 (2021-05-21)
- fix adapter stays green even without updates (Garfonso)
- improve cookie update (Garfonso)
- fix crash on get users that prevents saving options (Garfonso)

### 2.1.1 (03-Apr-2021)
- call account page at least every day now. (Garfonso)

### 2.1.0 (14-Feb-2021)
- major rework of async logic (Garfonso)
- add call to account page in order to get longer lasting cookie (Garfonso)
- replace now unsupported request-library (Garfonso)

### 2.0.3 (13-Jan-2021)
- fixed 500 errors (Garfonso)

### 2.0.2 (30-Jun-2020)
- fixed warnings from wrong object fields - fences (Garfonso)

### 2.0.1 (03-Jun-2020)
- enforced min_polling_interval (Garfonso)
- improved error logging (Garfonso)

### 2.0.0 (01-Jun-2020)
- fixed warnings from wrong object fields (Garfonso)
- removed authentication and allowed user to copy in cookie (Garfonso)

#### 1.5.4 (14-Apr-2019)
- user groups are no longer created

Expand Down
Binary file added admin/google-cookie.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 15 additions & 28 deletions admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
}
}

var oldCookie = "";
// the function loadSettings has to exist ...
function load(settings, onChange) {
if (!settings) return;
oldCookie = settings.google_cookie;

let fences = settings.fences || [];

Expand Down Expand Up @@ -183,13 +185,18 @@
let obj = {};
$('.value').each(function () {
let $this = $(this);
if ($this.attr('type') == 'checkbox') {
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});

if (obj.google_cookie !== oldCookie) {
console.debug('Cookie updated -> delete old augmented cookie.');
socket.emit('setState', 'google-sharedlocations.' + instance + '.info.augmented_cookie', '');
}

// Get edited table
obj.fences = table2values('values');

Expand All @@ -209,14 +216,9 @@
return;
}

let credentials =
'{' +
'"google_username": "' + $('#google_username.value').val() + '",' +
'"google_password": "' + $('#google_password.value').val() + '",' +
'"google_verify_email": "' + $('#google_verify_email.value').val() + '"' +
'}';
let cookie = $('#google_cookie.value').val();

sendTo('google-sharedlocations.' + instance, 'checkConnection', credentials, function (conn_status) {
sendTo('google-sharedlocations.' + instance, 'checkConnection', {cookie}, function (conn_status) {
if(conn_status === true) {
showMessage(_('Connection successful!'), 'Connection test', 'info');
} else {
Expand All @@ -238,14 +240,9 @@
return;
}

let credentials =
'{' +
'"google_username": "' + $('#google_username.value').val() + '",' +
'"google_password": "' + $('#google_password.value').val() + '",' +
'"google_verify_email": "' + $('#google_verify_email.value').val() + '"' +
'}';
let cookie = $('#google_cookie.value').val();

sendTo('google-sharedlocations.' + instance, 'getUsers', credentials, function (users) {
sendTo('google-sharedlocations.' + instance, 'getUsers', {cookie}, function (users) {
updateUsersInTable(users, null);
});
});
Expand All @@ -272,18 +269,8 @@
</div>
<div class="row">
<div class="input-field col s12 m8 l4">
<input class="value" id="google_username" type="text">
<label for="google_username" class="translate active">google_username</label>
</div>
<div class="input-field col s12 m8 l4">
<input class="value" id="google_password" type="password">
<label for="google_password" class="translate active">google_password</label>
</div>
</div>
<div class="row">
<div class="input-field col s12 m8 l4">
<input class="value" id="google_verify_email" type="text">
<label for="google_verify_email" class="translate active">google_verify_email</label>
<input class="value" id="google_cookie" type="text">
<label for="google_cookie" class="translate active">google_cookie</label>
</div>
</div>
<div class="row">
Expand Down Expand Up @@ -337,4 +324,4 @@
</div>
</body>

</html>
</html>
44 changes: 11 additions & 33 deletions admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ systemDictionary = {
"es": "Configuración del adaptador de ubicación compartida de Google",
"pl": "Ustawienia adaptera Google sharedlocations"
},
"google_password": {
"en": "Password",
"de": "Passwort",
"ru": "пароль",
"pt": "Senha",
"nl": "Wachtwoord",
"fr": "Mot de passe",
"it": "Parola d'ordine",
"es": "Contraseña",
"pl": "Hasło"
},
"google_polling_interval": {
"en": "Polling interval (s), 0 = disabled",
"de": "Abrufintervall (s), 0 = deaktiviert",
Expand All @@ -101,27 +90,16 @@ systemDictionary = {
"es": "Intervalo de sondeo (s), 0 = deshabilitado",
"pl": "Interwał odpytywania (s), 0 = wyłączony"
},
"google_username": {
"en": "Username",
"de": "Nutzername",
"ru": "имя пользователя",
"pt": "Nome de usuário",
"nl": "Gebruikersnaam",
"fr": "Nom d'utilisateur",
"it": "Nome utente",
"es": "Nombre de usuario",
"pl": "Nazwa Użytkownika"
},
"google_verify_email": {
"en": "Recovery email address",
"de": "Email zur Kontowiederherstellung",
"ru": "Восстановить адрес электронной почты",
"pt": "Endereço de e-mail de recuperação",
"nl": "Herstel e-mailadres",
"fr": "Adresse mail de secours",
"it": "Indirizzo email di recupero",
"es": "Dirección de correo electrónico de recuperación",
"pl": "Odzyskiwanie adres e-mail"
"google_cookie": {
"en": "Google Cookie",
"de": "Google Cookie",
"ru": "Google Cookie",
"pt": "Google Cookie",
"nl": "Google Cookie",
"fr": "Google Cookie",
"it": "Google Cookie",
"es": "Google Cookie",
"pl": "Google Cookie"
},
"login_data": {
"en": "Login data",
Expand Down Expand Up @@ -299,4 +277,4 @@ systemDictionary = {
"es": "Otros adaptadores",
"pl": "Inne adaptery"
}
};
};
5 changes: 2 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: 'test-{build}'
environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '8'
- nodejs_version: '10'
- nodejs_version: '12'
- nodejs_version: '14'
- nodejs_version: '16'
platform:
- x86
- x64
Expand Down
Loading