Skip to content

Commit

Permalink
Updated instructions and demo compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinscham committed Sep 8, 2023
1 parent facc173 commit 6265362
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
74 changes: 43 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
<div align="center">

![Duolingo Logo](duolingo.png)

<h1>Duolingo API Dockerized</h1>

Duolingo API Dockerized is a Python-based Docker image which allows you to set up a basic JSON API to get cached data about your Duolingo Account.
Serves your Duolingo progress info as JSON.

Based on [KartikTalwar/Duolingo](https://github.com/KartikTalwar/Duolingo), utilizing modifications from [lidiaCirrone/pw-duolingo-data](https://github.com/lidiaCirrone/pw-duolingo-data).

</div>

## Example Setup

See `example.docker-compose.yml`. You'll need to provide your own `docker-compose.yml`, which you can base on this example file.

In case you'd like to run this behind a nginx reverse proxy, you can use `nginx.conf` as a reference.

version: '3.2'
```yml
version: '3.2'

# e.g. swag reverse proxy network
networks:
yourNetwork:
external: true

# e.g. swag reverse proxy network
services:
duolingo-data:
image: ghcr.io/marvinscham/duolingo-api-dockerized:latest
container_name: duolingo-data
restart: unless-stopped
environment:
- TIMEZONE=Europe/Berlin
- DUO_USERNAME=yourUsername
- DUO_JWT=yourJWT
- SERVER_URL=https://duo.your-domain.com
- XP_SUMMARY_DAYS=30
- UPDATE_INTERVAL=15
- MAX_RETRIES=3
# ports:
# - 80:7000
networks:
yourNetwork:
external: true

services:
duolingo-data:
build: .
container_name: duolingo-data
restart: unless-stopped
environment:
- TIMEZONE=Europe/Berlin
- DUO_USERNAME=yourUsername
- DUO_PASSWORD=yourPassword
- SERVER_URL=https://your-domain.com
- XP_SUMMARY_DAYS=30
- UPDATE_INTERVAL=15
- MAX_RETRIES=3
# ports:
# - 80:7000
networks:
- yourNetwork
- yourNetwork
```
## Environment Variables
Expand All @@ -48,17 +50,27 @@ In case you'd like to run this behind a nginx reverse proxy, you can use `nginx.
- Default: `Europe/Berlin`
- `DUO_USERNAME`
- Required for login
- `DUO_PASSWORD`
- Required for login
- `DUO_JWT`
- Login token (**Not your password!** Info on obtaining this is in the following segment)
- `SERVER_URL`
- Used for connectivity self check
- Example: `https://your-domain.com`no trailing slash!
- Example: `https://your-domain.com` without trailing slash!
- `XP_SUMMARY_DAYS`
- Number of past days to get data from. Might stop working properly if > 300
- Number of past days to get data from. _Might stop working properly if > 300_
- Default: `30`
- `UPDATE_INTERVAL`
- Time in minutes to request fresh data from Duolingo
- Default: `15`
- `MAX_RETRIES`
- How often the app should retry in case of some connection error (retry interval 60 seconds)
- Default: `3`

## Grabbing your JWT

Login on [Duolingo](duolingo.com) and run the following JavaScript in your browser console. The returned string is your JWT.

```js
document.cookie.match(new RegExp('(^| )jwt_token=([^;]+)'))[0].slice(11);
```

The token currently does not expire but will break if you change your Duolingo password.
8 changes: 4 additions & 4 deletions example.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ networks:

services:
duolingo-data:
build: .
image: ghcr.io/marvinscham/duolingo-api-dockerized:latest
container_name: duolingo-data
restart: unless-stopped
environment:
- TIMEZONE=Europe/Berlin
- DUO_USERNAME=yourUsername
- DUO_PASSWORD=yourPassword
- SERVER_URL=https://your-domain.com
- DUO_JWT=yourJWT
- SERVER_URL=https://duo.your-domain.com
- XP_SUMMARY_DAYS=30
- UPDATE_INTERVAL=15
- MAX_RETRIES=3
# ports:
# - 80:7000
networks:
- yourNetwork
- yourNetwork

0 comments on commit 6265362

Please sign in to comment.