Compare commits
3 Commits
cf29cecfd6
...
547ac89987
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
547ac89987 | ||
|
|
130ad9c35a | ||
|
|
adfc6add6f |
@@ -42,6 +42,20 @@ export function TextParser(props: TextParserProps) {
|
|||||||
const theme = useMantineTheme();
|
const theme = useMantineTheme();
|
||||||
let entityCount = 0;
|
let entityCount = 0;
|
||||||
|
|
||||||
|
const UNICODE_EMOJI_SEQUENCE_REGEX =
|
||||||
|
/(?:\p{Regional_Indicator}{2}|[0-9#*]\uFE0F?\u20E3|\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\p{Emoji_Modifier})?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\p{Emoji_Modifier})?)*)/u;
|
||||||
|
|
||||||
|
const UNICODE_EMOJI_SEQUENCE_REGEX_GLOBAL = new RegExp(
|
||||||
|
UNICODE_EMOJI_SEQUENCE_REGEX.source,
|
||||||
|
"gu"
|
||||||
|
);
|
||||||
|
|
||||||
|
const toUnified = (value: string): string =>
|
||||||
|
Array.from(value)
|
||||||
|
.map((ch) => ch.codePointAt(0)?.toString(16))
|
||||||
|
.filter(Boolean)
|
||||||
|
.join("-");
|
||||||
|
|
||||||
const formatRules : FormatRule[] = [
|
const formatRules : FormatRule[] = [
|
||||||
{
|
{
|
||||||
pattern: [
|
pattern: [
|
||||||
@@ -120,18 +134,21 @@ export function TextParser(props: TextParserProps) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// unicode emojis
|
// unicode emojis (including composite sequences)
|
||||||
pattern: [/\p{Emoji_Presentation}/u],
|
pattern: [UNICODE_EMOJI_SEQUENCE_REGEX],
|
||||||
render: (match: string) => {
|
render: (match: string) => {
|
||||||
let textWithoutEmojis = props.text.replace(/\p{Emoji_Presentation}/gu, '');
|
const textWithoutEmojis = props.text.replace(UNICODE_EMOJI_SEQUENCE_REGEX_GLOBAL, "");
|
||||||
if(textWithoutEmojis.length <= (props.oversizeIfTextSmallerThan ?? 0)) {
|
const unified = toUnified(match);
|
||||||
return <Emoji size={40} unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
|
||||||
|
if (textWithoutEmojis.length <= (props.oversizeIfTextSmallerThan ?? 0)) {
|
||||||
|
return <Emoji size={40} unified={unified}></Emoji>;
|
||||||
}
|
}
|
||||||
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
|
||||||
|
return <Emoji unified={unified}></Emoji>;
|
||||||
},
|
},
|
||||||
flush: (match: string) => {
|
flush: (match: string) => {
|
||||||
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
return <Emoji unified={toUnified(match)}></Emoji>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// :emoji_code:
|
// :emoji_code:
|
||||||
|
|||||||
@@ -238,6 +238,10 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
* Если это групповое сообщение, то получаем ключ группы
|
* Если это групповое сообщение, то получаем ключ группы
|
||||||
*/
|
*/
|
||||||
decryptKey = await getGroupKey(props.dialog);
|
decryptKey = await getGroupKey(props.dialog);
|
||||||
|
/**
|
||||||
|
* Приводим к HEX так как этого требует формат расшифровки вложений в приложении
|
||||||
|
*/
|
||||||
|
decryptKey = Buffer.from(decryptKey).toString('hex');
|
||||||
}
|
}
|
||||||
if(!message.from_me && !hasGroup(props.dialog)){
|
if(!message.from_me && !hasGroup(props.dialog)){
|
||||||
/**
|
/**
|
||||||
@@ -569,7 +573,7 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
content: content,
|
content: content,
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
readed: 0,
|
readed: 0,
|
||||||
chacha_key: groupKey,
|
chacha_key: Buffer.from(groupKey).toString('hex'),
|
||||||
from_me: 1,
|
from_me: 1,
|
||||||
plain_message: decryptedContent,
|
plain_message: decryptedContent,
|
||||||
delivered: DeliveredMessageState.DELIVERED,
|
delivered: DeliveredMessageState.DELIVERED,
|
||||||
@@ -723,7 +727,7 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
content: content,
|
content: content,
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
readed: idle ? 0 : 1,
|
readed: idle ? 0 : 1,
|
||||||
chacha_key: groupKey,
|
chacha_key: Buffer.from(groupKey).toString('hex'),
|
||||||
from_me: fromPublicKey == publicKey ? 1 : 0,
|
from_me: fromPublicKey == publicKey ? 1 : 0,
|
||||||
plain_message: decryptedContent,
|
plain_message: decryptedContent,
|
||||||
delivered: DeliveredMessageState.DELIVERED,
|
delivered: DeliveredMessageState.DELIVERED,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
export const APP_VERSION = "1.2.0";
|
export const APP_VERSION = "1.2.1";
|
||||||
export const CORE_MIN_REQUIRED_VERSION = "1.5.5";
|
export const CORE_MIN_REQUIRED_VERSION = "1.5.5";
|
||||||
|
|
||||||
export const RELEASE_NOTICE = `
|
export const RELEASE_NOTICE = `
|
||||||
**Обновление v1.2.0** :emoji_1f631:
|
**Обновление v1.2.1** :emoji_1f631:
|
||||||
- Повышена стабильность звонков.
|
- Исправлена ошибка, из-за которой вложения в групповых диалогах могли не расшифроваться.
|
||||||
|
- Исправлено отображение emoji.
|
||||||
|
- Добавлена поддержка skin-tone модификаторов для emoji.
|
||||||
`;
|
`;
|
||||||
Reference in New Issue
Block a user