add oauth app connected

This commit is contained in:
lendry
2026-06-26 10:49:34 +03:00
parent d5e6b58955
commit b81c0cedbb
18 changed files with 838 additions and 59 deletions

View File

@@ -36,6 +36,16 @@ export function getMessageCopyText(message: ChatMessage, visibleText?: string) {
return '';
}
function looksLikeEncryptedPayload(content?: string | null) {
if (!content?.trim().startsWith('{')) return false;
try {
const parsed = JSON.parse(content) as { v?: unknown; ciphertext?: unknown; kind?: unknown };
return typeof parsed === 'object' && parsed !== null && ('v' in parsed || 'ciphertext' in parsed || 'kind' in parsed);
} catch {
return false;
}
}
export function getMessagePreviewText(message: ChatMessage, visibleText?: string) {
if (message.type === 'SYSTEM') {
return resolveNativeEmojiContent(message.content?.trim() ?? 'Системное сообщение');
@@ -44,7 +54,7 @@ export function getMessagePreviewText(message: ChatMessage, visibleText?: string
return `📊 Опрос: ${message.poll.question}`;
}
const text = getMessageCopyText(message, visibleText);
if (text) return text;
if (text && !looksLikeEncryptedPayload(text)) return text;
if (message.type === 'IMAGE') return '📷 Фото';
if (message.type === 'VOICE') return '🎤 Голосовое';
if (message.type === 'AUDIO') return '🎵 Аудио';