webapp open in browser option
This commit is contained in:
@@ -60,6 +60,7 @@ MODES_TITLES: Final[dict[str, str]] = {
|
||||
"RANDOM_SUBSCRIPTIONS_ENABLED": "Случайные страны",
|
||||
"COUNTRY_SELECTION_ENABLED": "Режим стран",
|
||||
"REMNAWAVE_WEBAPP_ENABLED": "Remna WebApp",
|
||||
"REMNAWAVE_WEBAPP_OPEN_IN_BROWSER": "WebApp в браузере",
|
||||
"HAPP_CRYPTOLINK_ENABLED": "Happ-ссылки",
|
||||
"LEGACY_LINKS_ENABLED": "Старые ссылки",
|
||||
"DIRECT_START_DISABLED": "Тихий режим",
|
||||
|
||||
@@ -14,6 +14,7 @@ from config import (
|
||||
DOWNLOAD_PC,
|
||||
HAPP_CRYPTOLINK,
|
||||
REMNAWAVE_WEBAPP,
|
||||
REMNAWAVE_WEBAPP_OPEN_IN_BROWSER,
|
||||
SUPPORT_CHAT_URL,
|
||||
WEBHOOK_HOST,
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
from sqlalchemy import update
|
||||
|
||||
from bot import bot
|
||||
from config import REMNAWAVE_WEBAPP, SUPPORT_CHAT_URL
|
||||
from config import REMNAWAVE_WEBAPP, REMNAWAVE_WEBAPP_OPEN_IN_BROWSER, SUPPORT_CHAT_URL
|
||||
from core.bootstrap import BUTTONS_CONFIG, MODES_CONFIG
|
||||
from database import (
|
||||
get_key_details,
|
||||
@@ -216,6 +216,7 @@ async def key_cluster_mode(
|
||||
else:
|
||||
if await is_full_remnawave_cluster(least_loaded_cluster, session):
|
||||
use_webapp = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_ENABLED", REMNAWAVE_WEBAPP))
|
||||
open_in_browser = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_OPEN_IN_BROWSER", REMNAWAVE_WEBAPP_OPEN_IN_BROWSER))
|
||||
if use_webapp and final_link:
|
||||
use_webapp = await process_remnawave_webapp_override(
|
||||
remnawave_webapp=use_webapp,
|
||||
@@ -229,7 +230,10 @@ async def key_cluster_mode(
|
||||
and isinstance(final_link, str)
|
||||
and final_link.startswith(("http://", "https://"))
|
||||
):
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=final_link)))
|
||||
if open_in_browser:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, url=final_link))
|
||||
else:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=final_link)))
|
||||
if tv_button_enabled:
|
||||
builder.row(InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{email}"))
|
||||
else:
|
||||
|
||||
@@ -22,6 +22,7 @@ from config import (
|
||||
REMNAWAVE_LOGIN,
|
||||
REMNAWAVE_PASSWORD,
|
||||
REMNAWAVE_WEBAPP,
|
||||
REMNAWAVE_WEBAPP_OPEN_IN_BROWSER,
|
||||
SUPPORT_CHAT_URL,
|
||||
)
|
||||
from core.bootstrap import BUTTONS_CONFIG, MODES_CONFIG
|
||||
@@ -756,6 +757,7 @@ async def finalize_key_creation(
|
||||
)
|
||||
|
||||
use_webapp = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_ENABLED", REMNAWAVE_WEBAPP))
|
||||
open_in_browser = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_OPEN_IN_BROWSER", REMNAWAVE_WEBAPP_OPEN_IN_BROWSER))
|
||||
if use_webapp and webapp_url:
|
||||
use_webapp = await process_remnawave_webapp_override(
|
||||
remnawave_webapp=use_webapp,
|
||||
@@ -770,7 +772,10 @@ async def finalize_key_creation(
|
||||
builder.row(InlineKeyboardButton(text=ROUTER_BUTTON, callback_data=f"connect_router|{key_name}"))
|
||||
else:
|
||||
if use_webapp and webapp_url:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=webapp_url)))
|
||||
if open_in_browser:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, url=webapp_url))
|
||||
else:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=webapp_url)))
|
||||
if tv_button_enabled:
|
||||
builder.row(InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{email}"))
|
||||
else:
|
||||
|
||||
@@ -23,6 +23,7 @@ from config import (
|
||||
REMNAWAVE_LOGIN,
|
||||
REMNAWAVE_PASSWORD,
|
||||
REMNAWAVE_WEBAPP,
|
||||
REMNAWAVE_WEBAPP_OPEN_IN_BROWSER,
|
||||
TOGGLE_CLIENT,
|
||||
USE_COUNTRY_SELECTION,
|
||||
)
|
||||
@@ -393,6 +394,7 @@ async def build_key_view_payload(session: AsyncSession, key_name: str):
|
||||
|
||||
country_selection_enabled = bool(MODES_CONFIG.get("COUNTRY_SELECTION_ENABLED", USE_COUNTRY_SELECTION))
|
||||
remnawave_webapp_enabled = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_ENABLED", REMNAWAVE_WEBAPP))
|
||||
open_in_browser = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_OPEN_IN_BROWSER", REMNAWAVE_WEBAPP_OPEN_IN_BROWSER))
|
||||
happ_cryptolink_enabled = bool(MODES_CONFIG.get("HAPP_CRYPTOLINK_ENABLED", HAPP_CRYPTOLINK))
|
||||
|
||||
response_message = key_message(
|
||||
@@ -423,6 +425,10 @@ async def build_key_view_payload(session: AsyncSession, key_name: str):
|
||||
if is_full_remnawave and final_link and use_webapp and not happ_cryptolink_enabled:
|
||||
if vless_enabled:
|
||||
builder.row(InlineKeyboardButton(text=ROUTER_BUTTON, callback_data=f"connect_router|{key_name}"))
|
||||
elif open_in_browser:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, url=final_link))
|
||||
if tv_button_enabled:
|
||||
builder.row(InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{key_name}"))
|
||||
else:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=final_link)))
|
||||
if tv_button_enabled:
|
||||
|
||||
@@ -13,6 +13,7 @@ from config import (
|
||||
NOTIFY_INACTIVE,
|
||||
NOTIFY_INACTIVE_TRAFFIC,
|
||||
REMNAWAVE_WEBAPP,
|
||||
REMNAWAVE_WEBAPP_OPEN_IN_BROWSER,
|
||||
SUPPORT_CHAT_URL,
|
||||
)
|
||||
from core.bootstrap import MODES_CONFIG, NOTIFICATIONS_CONFIG
|
||||
@@ -141,6 +142,7 @@ async def notify_users_no_traffic(bot: Bot, session: AsyncSession, current_time:
|
||||
return
|
||||
|
||||
remnawave_webapp_enabled = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_ENABLED", REMNAWAVE_WEBAPP))
|
||||
open_in_browser = bool(MODES_CONFIG.get("REMNAWAVE_WEBAPP_OPEN_IN_BROWSER", REMNAWAVE_WEBAPP_OPEN_IN_BROWSER))
|
||||
|
||||
messages = []
|
||||
keys_to_mark_notified = []
|
||||
@@ -195,7 +197,10 @@ async def notify_users_no_traffic(bot: Bot, session: AsyncSession, current_time:
|
||||
final_link = key.key or key.remnawave_link
|
||||
|
||||
if is_full_remnawave and final_link and remnawave_webapp_enabled:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=final_link)))
|
||||
if open_in_browser:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, url=final_link))
|
||||
else:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, web_app=WebAppInfo(url=final_link)))
|
||||
else:
|
||||
builder.row(InlineKeyboardButton(text=CONNECT_DEVICE, callback_data=f"connect_device|{email}"))
|
||||
except Exception as error:
|
||||
|
||||
Reference in New Issue
Block a user