This commit is contained in:
user 2025-02-28 13:46:27 +03:00
parent 3525f73b99
commit 1ee8112734
3 changed files with 8 additions and 4 deletions

View File

@ -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'): if True or not decrypted_content.meta.get('telegram_file_cache_preview'):
try: try:
# Construct URL for trimmed preview using decrypted content # 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': if content_type_declared == 'video':
preview_message = await query.bot.send_video( preview_message = await query.bot.send_video(
chat_id=CACHE_CHAT_ID, # Cache chat id defined in configuration 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') make_log("OwnedContent", f"Error uploading preview {content_type_declared}: {e}", level='error')
content_share_link = { 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()}" 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}"
} }

View File

@ -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_by(owner_address=user_wallet_address, status='active', content_id=content.id).first())
or bool(self.db_session.query(UserContent).filter( or bool(self.db_session.query(UserContent).filter(
and_( and_(
StarsInvoice.user_id == self.user, StarsInvoice.user_id == self.user.id,
StarsInvoice.content_hash == content['encrypted_content'].hash, StarsInvoice.content_hash == content['encrypted_content'].hash,
StarsInvoice.paid == True StarsInvoice.paid == True
) )

View File

@ -3,7 +3,7 @@ websockets==10.0
sqlalchemy==2.0.23 sqlalchemy==2.0.23
python-dotenv==1.0.0 python-dotenv==1.0.0
pymysql==1.1.0 pymysql==1.1.0
aiogram==3.4.1 aiogram==3.13.0
pytonconnect==0.3.0 pytonconnect==0.3.0
base58==2.1.1 base58==2.1.1
tonsdk==1.0.13 tonsdk==1.0.13