diff --git a/README.md b/README.md index 51d6262..2b06986 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ curl -X POST http://localhost:3000/clear-all-sms **Пример запроса:** ```bash -curl http://localhost:3000/balance +curl http://localhost:3000/balance.php ``` **Ответ:** @@ -171,7 +171,7 @@ environment: - `POST /sms/send` - `GET /sms/view-all-sms` - `POST /sms/clear-all-sms` -- `GET /sms/balance` +- `GET /sms/balance.php` - `GET /sms/` - веб-интерфейс Изменение порта в docker-compose.yml: diff --git a/VERSION b/VERSION index 9fc80f9..87a0871 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 \ No newline at end of file +0.3.3 \ No newline at end of file diff --git a/server.js b/server.js index deb9951..c71e269 100644 --- a/server.js +++ b/server.js @@ -86,7 +86,17 @@ router.post("/clear-all-sms", (req, res) => { }); // GET /balance - get account balance (SMSC API compatible) -router.get("/balance", (req, res) => { +router.get("/balance.php", (req, res) => { + const { login, psw } = req.query; + + if (!login || !psw) { + return res.json({ error: "Отсутствуют обязательные параметры", error_code: 1 }); + } + + if (login !== AUTH_LOGIN || psw !== AUTH_PASSWORD) { + return res.json({ error: "Ошибка авторизации", error_code: 2 }); + } + res.json({ balance: "1000.00" }); });