From b7e62f0468642bee72c74e69b443e4dd244a052b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Wed, 17 Jun 2026 09:05:33 +0400 Subject: [PATCH] =?UTF-8?q?v0.5.147:=20/v2/impersonation-check=20=E2=80=94?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=BE=20=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BF=D1=83=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2/server.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/v2/server.js b/v2/server.js index 6d25198..2758419 100644 --- a/v2/server.js +++ b/v2/server.js @@ -90,31 +90,21 @@ function createV2Router() { } }); - // ── GET /v2/impersonation-check — IAM impersonation: все GET эндпоинты ─ - router.get('/impersonation-check', async (req, res) => { - const token = req.session && req.session.token; - if (!token) return res.send('

Нет токена

Войти

'); - - const endpoints = [ - { name: 'status', url: 'https://auth-api.ngcloud.ru/api/v1/impersonation/status' }, - { name: 'history', url: 'https://auth-api.ngcloud.ru/api/v1/impersonation/history' }, - { name: 'history/all', url: 'https://auth-api.ngcloud.ru/api/v1/impersonation/history/all' }, - ]; - - const results = {}; - for (const ep of endpoints) { - try { - const data = await iamFetch(token, ep.url); - results[ep.name] = { ok: true, data }; - } catch (e) { - results[ep.name] = { ok: false, error: e.message }; - } - } - + // ── GET /v2/impersonation-check — тест: просто текст ───────────── + router.get('/impersonation-check', (req, res) => { res.set('Content-Type', 'text/html; charset=utf-8'); - res.send(iamStatPage(results)); + res.send('Impersonation Check' + + '' + + '

✅ Impersonation Check — работает!

' + + '

Путь /v2/impersonation-check доступен.

' + + '

Версия: ' + config.version + '

' + + '

← На CRUD

' + + ''); }); + // ── /v2/app — пользовательский CRUD (только с сессией) ────────────── + // ── /v2/app — пользовательский CRUD (только с сессией) ────────────── router.use('/app', enhanceImpersonation, resolveContext, createUserRouter());