From 1ee81127347649126fe6f180de2955b5ee5d4a1c Mon Sep 17 00:00:00 2001 From: user Date: Fri, 28 Feb 2025 13:46:27 +0300 Subject: [PATCH] fixes --- app/client_bot/routers/content.py | 8 ++++++-- app/core/models/_telegram/templates/player.py | 2 +- requirements.txt | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/client_bot/routers/content.py b/app/client_bot/routers/content.py index 14b8ed7..a1ae536 100644 --- a/app/client_bot/routers/content.py +++ b/app/client_bot/routers/content.py @@ -140,7 +140,11 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use if True or not decrypted_content.meta.get('telegram_file_cache_preview'): try: # Construct URL for trimmed preview using decrypted content - preview_url = f"{PROJECT_HOST}/api/v1/storage/{decrypted_content.cid.serialize_v2(include_accept_type=True)}?seconds_limit=30" + preview_content = db_session.query(StoredContent).filter_by( + hash=content.meta.get('converted_content', {}).get('low_preview') + ).first() + + preview_url = preview_content.web_url if content_type_declared == 'video': preview_message = await query.bot.send_video( chat_id=CACHE_CHAT_ID, # Cache chat id defined in configuration @@ -169,7 +173,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use make_log("OwnedContent", f"Error uploading preview {content_type_declared}: {e}", level='error') content_share_link = { - 'text': user.translated('p_shareLinkContext').format(title=audio_title), + 'text': user.translated('p_shareLinkContext').format(title=' – '.join(audio_title)), 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}" } diff --git a/app/core/models/_telegram/templates/player.py b/app/core/models/_telegram/templates/player.py index 31e310c..8d6b651 100644 --- a/app/core/models/_telegram/templates/player.py +++ b/app/core/models/_telegram/templates/player.py @@ -169,7 +169,7 @@ class PlayerTemplates: or bool(self.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content.id).first()) or bool(self.db_session.query(UserContent).filter( and_( - StarsInvoice.user_id == self.user, + StarsInvoice.user_id == self.user.id, StarsInvoice.content_hash == content['encrypted_content'].hash, StarsInvoice.paid == True ) diff --git a/requirements.txt b/requirements.txt index fc83dd3..ab07d7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ websockets==10.0 sqlalchemy==2.0.23 python-dotenv==1.0.0 pymysql==1.1.0 -aiogram==3.4.1 +aiogram==3.13.0 pytonconnect==0.3.0 base58==2.1.1 tonsdk==1.0.13