diff --git a/site/app.py b/site/app.py index f8f82ab..1f445ff 100644 --- a/site/app.py +++ b/site/app.py @@ -5,7 +5,7 @@ from flask import Flask from routes.main import bp as main_bp from routes.api import bp as api_bp -VERSION = "1.0.4" +VERSION = "1.0.5" app = Flask(__name__, template_folder="templates", static_folder="static") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") diff --git a/site/routes/main.py b/site/routes/main.py index d9c46a8..a9f6462 100644 --- a/site/routes/main.py +++ b/site/routes/main.py @@ -26,6 +26,23 @@ def _client_id(token): return "" +def _token_info(token): + import base64, json + try: + parts = token.split(".") + if len(parts) >= 2: + payload = base64.urlsafe_b64decode(parts[1] + "==") + d = json.loads(payload) + return { + "email": d.get("email", ""), + "company": d.get("company_name", ""), + "client_id": d.get("ClientID", ""), + } + except Exception: + pass + return {} + + @bp.route("/", methods=["GET", "POST"]) def index(): env_token = current_app.config["NUBES_API_TOKEN"] @@ -88,6 +105,7 @@ def index(): env_token_masked=_mask(env_token), has_user_token=bool(user_token), client_id=_client_id(active_token), + token_info=_token_info(active_token), instance_groups=instance_groups) diff --git a/site/templates/index.html b/site/templates/index.html index c5fd198..64e5dcd 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -16,6 +16,7 @@
Nubes v{{ config.VERSION if config else '?' }} + {% if token_info.email %}{{ token_info.email }} | {{ token_info.company }} | test{% endif %}