diff --git a/README.Docker.md b/README.Docker.md index 0733278..bfb9867 100644 --- a/README.Docker.md +++ b/README.Docker.md @@ -16,6 +16,7 @@ services: - TZ=Europe/Lisbon - EDENRED_USERNAME= - EDENRED_PIN= + - EDENRED_VERSION= # default 4.1.0 - EDENRED_ACCOUNT_MAP=comma separated vlue (Both EDENRED_ACCOUNT_MAP and ACTUAL_ACCOUNT_MAP need to have the same size) - ACTUAL_ACCOUNT_MAP=#comma separated vlue - ACTUAL_SERVER_URL= @@ -29,6 +30,7 @@ services: docker run -d --name myedenredactual \ - e 'EDENRED_USERNAME=' \ - e 'EDENRED_PIN=' \ + - e 'EDENRED_VERSION=' \ - e 'EDENRED_ACCOUNT_MAP=' \ - e 'ACTUAL_ACCOUNT_MAP=' \ - e 'ACTUAL_SERVER_URL= ' \ diff --git a/config.js b/config.js index 48664d7..2eb3d6d 100644 --- a/config.js +++ b/config.js @@ -8,6 +8,7 @@ const ACTUAL_SERVER_PASSWORD = process.env.ACTUAL_SERVER_PASSWORD || ""; const APP_PORT = process.env.APP_PORT || 3000; const APP_URL = process.env.APP_URL || "http://localhost" +const EDENRED_VERSION = process.env.EDENRED_VERSION || "4.1.0"; const EDENRED_USERNAME = process.env.EDENRED_USERNAME || ""; const EDENRED_PIN = process.env.EDENRED_PIN || ""; @@ -34,6 +35,7 @@ function getAppConfigFromEnv() { APP_URL, EDENRED_USERNAME, EDENRED_PIN, + EDENRED_VERSION, EDENRED_ACCOUNT_MAP, ACTUAL_ACCOUNT_MAPPING, EDENRED_ACCOUNT_MAPPING, diff --git a/docker-compose.yaml b/docker-compose.yaml index 80779ef..c445a40 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,9 +9,9 @@ services: - PUID=1003 - PGID=100 - TZ=Europe/Lisbon - #- EDENRED_USERNAME= deprecated for now - #- EDENRED_PASSWORD=deprecated for now - - EDENRED_TOKEN= + - EDENRED_USERNAME= + - EDENRED_PIN= + - EDENRED_VERSION= # default 4.1.0 - EDENRED_ACCOUNT_MAP= #comma separated vlue (Both EDENRED_ACCOUNT_MAP and ACTUAL_ACCOUNT_MAP need to have the same size) - ACTUAL_ACCOUNT_MAP= #comma separated vlue - ACTUAL_SERVER_URL= diff --git a/edenredService.js b/edenredService.js index 05b3924..8feb57d 100644 --- a/edenredService.js +++ b/edenredService.js @@ -11,7 +11,7 @@ const authenticate = async () => { appType: "IOS", appVersion: "4.1.0" }; - const token = await fetch('https://www.myedenred.pt/edenred-customer/v2/authenticate/pin?appVersion=4.1.0&appType=IOS&channel=MOBILE', { + const token = await fetch('https://www.myedenred.pt/edenred-customer/v2/authenticate/pin?appVersion='+ appConfig.EDENRED_VERSION +'&appType=IOS&channel=MOBILE', { method: 'POST', body: JSON.stringify(u), headers: {