Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Swaggeroo committed Jan 7, 2024
1 parent 6902391 commit 88b0290
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ services:
#- SYNC_MODE=0 # 0 = bidirectional, 1 = bring master, 2 = google master
#- TIMEOUT=60 # minutes
#- BRING_LIST_NAME=Groceries
#- GOOGLE_TOKEN=<your token>
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You need to provide the following environment variables:
| `SYNC_MODE` | 0 = bidirectional, 1 = bring master, 2 = google master | 0 | No |
| `TIMEOUT` | Timeout between syncs in *minutes* \| 0 = only run once (with the provided docker-compose it will restart infinitely) | 60 | No |
| `BRING_LIST_NAME` | Name of your Bring List | Using first list in Response | No |
| `GOOGLE_TOKEN` | Overwrite Token logic with your own provided token | | No |

### Sync modes
| Mode | Description |
Expand All @@ -30,7 +31,7 @@ You need to provide the following environment variables:
| 2 | Google master. Changes in Google Keep will be reflected in Bring. Bring changes will be ignored. |

### Please note
- **!!Important!!** I couldn't get the Google Auth work in the container. Therefore I first ran the script locally and copied the token.txt file to the container. YES you need not matching dependencies (At least I needed). You probably need to install them manually. If you know how to fix this, please let me know.
- **!!Important!!** I couldn't get the Google Auth work in the container. Therefore I first ran the script locally and copied the token.txt file to the container or used the GOOGLE_TOKEN env var. YES you need not matching dependencies (At least I needed). You probably need to install them manually. If you know how to fix this, please let me know.
- The token.txt file is used to store the Google Auth token. It is created automatically. You can delete it at any time to force a new login. Keep it safe as it can be used to access your Google account.
- I didn't tested expiration of the token yet. If it expires, the script will probably crash. At the next run it should delete the token.txt and crash again. After that it should work again. With docker this should be no problem as the container will be restarted automatically.
- At first run the script will take the keep and bring lists and merge them (Only with SYNC_MODE 0). After that it will only sync changes.
6 changes: 6 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def login():
token = keep.getMasterToken()
with open('./data/token.txt', 'w') as fnew:
fnew.write(str(token))
elif os.environ.get('GOOGLE_TOKEN') is not None:
print("Using provided google token")
keep.resume(GOOGLE_EMAIL, os.environ.get('GOOGLE_TOKEN'))
token = keep.getMasterToken()
with open('./data/token.txt', 'w') as f:
f.write(str(token))
else:
print("Getting new google token")
keep.login(GOOGLE_EMAIL, GOOGLE_PASSWORD)
Expand Down

0 comments on commit 88b0290

Please sign in to comment.