From 1e4f0b69641ada6941f4596582b6f0c68765c6a0 Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Thu, 14 May 2026 14:19:29 +0400 Subject: [PATCH] api --- BACKEND.md | 8 ++++---- BACKEND_CHANGES.md | 4 ++-- DEPLOY.md | 6 +++--- proxy.conf.json | 13 +++---------- public/Fastcheck_API (1).txt | 26 +++++++++++++------------- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/BACKEND.md b/BACKEND.md index bfdba2f..5447c1d 100644 --- a/BACKEND.md +++ b/BACKEND.md @@ -1,6 +1,6 @@ # Fastcheck Backend — требования к серверу -Документ для команды бэкенда. Описывает, что должен реализовать сервер `api.fastcheck.store`, чтобы веб-фронт (этот репозиторий) полностью заработал. +Документ для команды бэкенда. Описывает, что должен реализовать сервер `fastcheck.store/api`, чтобы веб-фронт (этот репозиторий) полностью заработал. --- @@ -8,7 +8,7 @@ ### 1.1 Транспорт - **Протокол**: HTTPS обязателен (валидный TLS-сертификат, Let's Encrypt или иной). -- **Хост**: `api.fastcheck.store` (или другой — тогда поправить `FASTCHECK_API` в `src/app/api.ts`). +- **Хост**: `fastcheck.store/api` (или другой — тогда поправить `FASTCHECK_API` в `src/app/api.ts`). - **Формат тел запроса/ответа**: `application/json; charset=utf-8`. ### 1.2 CORS — **критично** @@ -44,7 +44,7 @@ Authorization: {"sessionID":"1AF3781BF6B94604B771AEA1D44FA63A"} ## 2. Эндпоинты -База: `https://api.fastcheck.store` +База: `https://fastcheck.store/api` ### 2.1 `GET /ping` Healthcheck. Ответ: `200 { "message": "pong" }`. Без авторизации. @@ -192,7 +192,7 @@ Logout / закрытие попапа. ## 4. Чеклист «готово к проду» -- [ ] HTTPS с валидным сертификатом на `api.fastcheck.store`. +- [ ] HTTPS с валидным сертификатом на `fastcheck.store/api`. - [ ] CORS разрешает домен фронта на всех 6 эндпоинтах + OPTIONS. - [ ] `GET /ping` отвечает. - [ ] Полный цикл: `GET /websession` → бот ставит `Status:true` → `GET /websession/:id` это видит. diff --git a/BACKEND_CHANGES.md b/BACKEND_CHANGES.md index 965ef6d..e185f7a 100644 --- a/BACKEND_CHANGES.md +++ b/BACKEND_CHANGES.md @@ -137,11 +137,11 @@ Body: ## 6. CORS + HTTPS + DNS (блокер) -Сейчас `https://api.fastcheck.store` даёт `ERR_NAME_NOT_RESOLVED` — +Сейчас `https://fastcheck.store/api` даёт `ERR_NAME_NOT_RESOLVED` — домен не резолвится. Без этого тестировать нечего. Минимально: -- Поднять DNS A-запись на `api.fastcheck.store`. +- Поднять DNS A-запись на `fastcheck.store`. - Валидный TLS-сертификат (Let's Encrypt подойдёт). - На все эндпоинты + `OPTIONS` отвечать заголовками: ``` diff --git a/DEPLOY.md b/DEPLOY.md index f13696d..061ce0c 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -20,7 +20,7 @@ npm run build # production-сборка Эндпоинты заданы в `src/app/api.ts`: -- `FASTCHECK_API` — `https://api.fastcheck.store` +- `FASTCHECK_API` — `https://fastcheck.store/api` - `QR_API` — `https://qr.vitanova.network:567/qr` (legacy, на текущих страницах не используется) Имя Telegram-бота — в `src/app/pages/fastcheck-page/fastcheck-page.ts` (поле `telegramBot`, сейчас `DexarSupport_bot`). @@ -104,7 +104,7 @@ RewriteRule . /index.html [L] ## 5. CORS на backend -`api.fastcheck.store` должен возвращать заголовки CORS, разрешающие домен фронта: +`fastcheck.store/api` должен возвращать заголовки CORS, разрешающие домен фронта: ``` Access-Control-Allow-Origin: https://pay.example.com @@ -149,5 +149,5 @@ EXPOSE 80 1. Открой `https://pay.example.com/` — должна быть форма фастчека. 2. Открой `https://pay.example.com/new` напрямую — должна открыться страница создания (не 404). -3. В DevTools → Network проверь, что запросы к `https://api.fastcheck.store/...` идут без CORS-ошибок. +3. В DevTools → Network проверь, что запросы к `https://fastcheck.store/api/...` идут без CORS-ошибок. 4. Нажми «Оплатить» с заполненными полями — должен открыться popup с QR Telegram (`@DexarSupport_bot`). diff --git a/proxy.conf.json b/proxy.conf.json index a61d3c6..ee02d92 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -1,9 +1,9 @@ { - "/proxy/fastcheck": { - "target": "https://api.fastcheck.store", + "/proxy/fastcheck-store": { + "target": "https://fastcheck.store", "secure": true, "changeOrigin": true, - "pathRewrite": { "^/proxy/fastcheck": "" }, + "pathRewrite": { "^/proxy/fastcheck-store": "" }, "logLevel": "debug" }, "/proxy/qr-vitanova": { @@ -12,12 +12,5 @@ "changeOrigin": true, "pathRewrite": { "^/proxy/qr-vitanova": "" }, "logLevel": "debug" - }, - "/proxy/fastcheck-store": { - "target": "https://fastcheck.store", - "secure": true, - "changeOrigin": true, - "pathRewrite": { "^/proxy/fastcheck-store": "" }, - "logLevel": "debug" } } diff --git a/public/Fastcheck_API (1).txt b/public/Fastcheck_API (1).txt index ee210a8..661d596 100644 --- a/public/Fastcheck_API (1).txt +++ b/public/Fastcheck_API (1).txt @@ -1,4 +1,4 @@ -eFastcheck.store +eFastcheck.store General Information Information exchange with the Fastcheck server is realized via RESTful API. All requests to the server must be executed via HTTPS using GET||POST||PUT||DELETE requests to the given ROOT address. Body of requests must be in JSON format. All not public requests must be signed by the client and the public key must be sent to the server for client identification and sign checking. @@ -6,9 +6,9 @@ Information exchange with the Fastcheck server is realized via RESTful API. All Check if server is available -Client needs to periodically check if the server is available by sending “ping” to the client. On error corresponding message must be shown. +Client needs to periodically check if the server is available by sending ping to the client. On error corresponding message must be shown. Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type GET Path /ping Request Parameters: @@ -26,7 +26,7 @@ ________________ Create new websession Creates a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr). Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type GET Path /websession Request Parameters: @@ -36,7 +36,7 @@ Request Parameters: } Response (OK): { -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A” +"sessionId": 1AF3781BF6B94604B771AEA1D44FA63A "userId" : "", "expires" : "sessionId", "userSessionId": "", @@ -48,7 +48,7 @@ ________________ Check websession status Check if the user is already logged in. a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr). Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type GET Path /websession/:webSessionID Request Parameters: @@ -58,7 +58,7 @@ Request Parameters: } Response (OK): { -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”, +"sessionId": 1AF3781BF6B94604B771AEA1D44FA63A, "userId" : "kHaAe9roaC2uq63AKGE/8+Ti/t/iFro68QhEZ1dRGLo", "expires" : "sessionId", "userSessionId": "8A94EFEFD003426A9B456C48CAC99BE6", @@ -68,12 +68,12 @@ ________________ Delete websession status Delete the session to log out from the system. Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type DELETE Path /websession/:webSessionID Request Parameters: { -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A” +"sessionId": 1AF3781BF6B94604B771AEA1D44FA63A } Response (OK): { @@ -84,14 +84,14 @@ ________________ Check Fastcheck status Check if fastcheck exists and get the amount assigned to check. Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type GET Path /fastcheck Request Parameters: { -"fastcheck": “1234-5678-0001”, +"fastcheck": 1234-5678-0001, } Response (OK): { @@ -103,7 +103,7 @@ ________________ New Fastcheck Create a fastcheck for a given amount. The Users must have a sufficient amount on the balance. Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type POST Path /fastcheck HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"} @@ -123,7 +123,7 @@ ________________ Accept Fastcheck Accept fastcheck to the user balance. Protocol: https -Root Path: api.Fastcheck.store +Root Path: fastcheck.store/api Type POST Path /fastcheck HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"}