diff --git a/bot/handlers/user/subscription/core.py b/bot/handlers/user/subscription/core.py index 0493d35..9f86679 100644 --- a/bot/handlers/user/subscription/core.py +++ b/bot/handlers/user/subscription/core.py @@ -238,23 +238,22 @@ async def my_subscription_command_handler( # Build rows to prepend above the base "back" markup prepend_rows = [] - # 1) Mini-app connect button on top if enabled, otherwise fall back to config link URL - if settings.SUBSCRIPTION_MINI_APP_URL: + # 1) Connect button: prefer the actual subscription URL; fall back to mini-app + cfg_link_val = connect_button_url or config_link_display + if cfg_link_val: + prepend_rows.append([ + InlineKeyboardButton( + text=get_text("connect_button"), + url=cfg_link_val, + ) + ]) + elif settings.SUBSCRIPTION_MINI_APP_URL: prepend_rows.append([ InlineKeyboardButton( text=get_text("connect_button"), web_app=WebAppInfo(url=settings.SUBSCRIPTION_MINI_APP_URL), ) ]) - else: - cfg_link_val = connect_button_url or config_link_display - if cfg_link_val: - prepend_rows.append([ - InlineKeyboardButton( - text=get_text("connect_button"), - url=cfg_link_val, - ) - ]) if settings.MY_DEVICES_SECTION_ENABLED: max_devices_value = active.get("max_devices") diff --git a/bot/keyboards/inline/user_keyboards.py b/bot/keyboards/inline/user_keyboards.py index 1a90ced..cd9efd9 100644 --- a/bot/keyboards/inline/user_keyboards.py +++ b/bot/keyboards/inline/user_keyboards.py @@ -444,17 +444,17 @@ def get_connect_and_main_keyboard( builder = InlineKeyboardBuilder() button_target = connect_button_url or config_link - if settings.SUBSCRIPTION_MINI_APP_URL: + if button_target: + builder.row( + InlineKeyboardButton(text=_("connect_button"), url=button_target) + ) + elif settings.SUBSCRIPTION_MINI_APP_URL: builder.row( InlineKeyboardButton( text=_("connect_button"), web_app=WebAppInfo(url=settings.SUBSCRIPTION_MINI_APP_URL), ) ) - elif button_target: - builder.row( - InlineKeyboardButton(text=_("connect_button"), url=button_target) - ) else: builder.row( InlineKeyboardButton(