This commit is contained in:
@@ -88,8 +88,16 @@ jobs:
|
|||||||
find packs -maxdepth 3 -type f 2>/dev/null || true
|
find packs -maxdepth 3 -type f 2>/dev/null || true
|
||||||
test -n "$(find packs -type f -print -quit 2>/dev/null)" || { echo "packs is empty"; exit 1; }
|
test -n "$(find packs -type f -print -quit 2>/dev/null)" || { echo "packs is empty"; exit 1; }
|
||||||
|
|
||||||
- name: Install SCP in Docker container
|
- name: Clean files before upload
|
||||||
run: apt-get install -y openssh-client
|
uses: appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SDU_SSH_HOST }}
|
||||||
|
username: ${{ secrets.SDU_SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SDU_SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
mkdir -p "${{ secrets.SDU_SSH_PACKS }}"
|
||||||
|
find "${{ secrets.SDU_SSH_PACKS }}" -mindepth 1 -type f -delete
|
||||||
|
|
||||||
- name: Upload to SSH using SCP
|
- name: Upload to SSH using SCP
|
||||||
uses: appleboy/scp-action@master
|
uses: appleboy/scp-action@master
|
||||||
@@ -101,4 +109,4 @@ jobs:
|
|||||||
source: "packs/*"
|
source: "packs/*"
|
||||||
target: "${{ secrets.SDU_SSH_PACKS }}"
|
target: "${{ secrets.SDU_SSH_PACKS }}"
|
||||||
strip_components: 1
|
strip_components: 1
|
||||||
rm: true
|
rm: false
|
||||||
@@ -2,8 +2,9 @@ import { useAttachment } from "@/app/providers/AttachmentProvider/useAttachment"
|
|||||||
import { AttachmentProps } from "./MessageAttachments";
|
import { AttachmentProps } from "./MessageAttachments";
|
||||||
import { Avatar, Box, Flex, Text } from "@mantine/core";
|
import { Avatar, Box, Flex, Text } from "@mantine/core";
|
||||||
import { useRosettaColors } from "@/app/hooks/useRosettaColors";
|
import { useRosettaColors } from "@/app/hooks/useRosettaColors";
|
||||||
import { IconPhoneOutgoing, IconX } from "@tabler/icons-react";
|
import { IconPhoneIncoming, IconPhoneOutgoing, IconX } from "@tabler/icons-react";
|
||||||
import { translateDurationToTime } from "@/app/providers/CallProvider/translateDurationTime";
|
import { translateDurationToTime } from "@/app/providers/CallProvider/translateDurationTime";
|
||||||
|
import { usePublicKey } from "@/app/providers/AccountProvider/usePublicKey";
|
||||||
|
|
||||||
export function MessageCall(props: AttachmentProps) {
|
export function MessageCall(props: AttachmentProps) {
|
||||||
const {
|
const {
|
||||||
@@ -13,9 +14,10 @@ export function MessageCall(props: AttachmentProps) {
|
|||||||
props.attachment,
|
props.attachment,
|
||||||
props.parent,
|
props.parent,
|
||||||
);
|
);
|
||||||
|
const publicKey = usePublicKey();
|
||||||
const preview = getPreview();
|
const preview = getPreview();
|
||||||
const callerRole = preview.split("::")[0];
|
const caller = props.parent.from == publicKey;
|
||||||
const duration = parseInt(preview.split("::")[1]);
|
const duration = parseInt(preview);
|
||||||
const colors = useRosettaColors();
|
const colors = useRosettaColors();
|
||||||
const error = duration == 0;
|
const error = duration == 0;
|
||||||
|
|
||||||
@@ -30,13 +32,11 @@ export function MessageCall(props: AttachmentProps) {
|
|||||||
<Flex gap={'sm'} direction={'row'}>
|
<Flex gap={'sm'} direction={'row'}>
|
||||||
<Avatar bg={error ? colors.error : colors.brandColor} size={40}>
|
<Avatar bg={error ? colors.error : colors.brandColor} size={40}>
|
||||||
{!error && <>
|
{!error && <>
|
||||||
{callerRole == "0" && (
|
{!caller && (
|
||||||
<IconPhoneOutgoing color={'white'} size={22}></IconPhoneOutgoing>
|
<IconPhoneIncoming color={'white'} size={22}></IconPhoneIncoming>
|
||||||
)}
|
)}
|
||||||
{callerRole == "1" && (
|
{caller && (
|
||||||
<IconPhoneOutgoing color={'white'} size={22} style={{
|
<IconPhoneOutgoing color={'white'} size={22}></IconPhoneOutgoing>
|
||||||
transform: 'rotate(180deg)'
|
|
||||||
}}></IconPhoneOutgoing>
|
|
||||||
)}
|
)}
|
||||||
</>}
|
</>}
|
||||||
{error && <>
|
{error && <>
|
||||||
@@ -45,7 +45,7 @@ export function MessageCall(props: AttachmentProps) {
|
|||||||
</Avatar>
|
</Avatar>
|
||||||
<Flex direction={'column'} gap={5}>
|
<Flex direction={'column'} gap={5}>
|
||||||
<Text size={'sm'}>{
|
<Text size={'sm'}>{
|
||||||
error ? (callerRole == "0" ? "Missed call" : "Rejected call") : (callerRole == "0" ? "Incoming call" : "Outgoing call")
|
error ? (!caller ? "Missed call" : "Rejected call") : (!caller ? "Incoming call" : "Outgoing call")
|
||||||
}</Text>
|
}</Text>
|
||||||
{!error &&
|
{!error &&
|
||||||
<Text size={'xs'} c={colors.chevrons.active}>
|
<Text size={'xs'} c={colors.chevrons.active}>
|
||||||
|
|||||||
@@ -119,6 +119,20 @@ export function TextParser(props: TextParserProps) {
|
|||||||
return <>{match}</>;
|
return <>{match}</>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// unicode emojis
|
||||||
|
pattern: [/\p{Emoji_Presentation}/u],
|
||||||
|
render: (match: string) => {
|
||||||
|
let textWithoutEmojis = props.text.replace(/\p{Emoji_Presentation}/gu, '');
|
||||||
|
if(textWithoutEmojis.length <= (props.oversizeIfTextSmallerThan ?? 0)) {
|
||||||
|
return <Emoji size={40} unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
}
|
||||||
|
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
},
|
||||||
|
flush: (match: string) => {
|
||||||
|
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// :emoji_code:
|
// :emoji_code:
|
||||||
pattern: [/:emoji_([a-zA-Z0-9_-]+):/],
|
pattern: [/:emoji_([a-zA-Z0-9_-]+):/],
|
||||||
|
|||||||
@@ -462,21 +462,18 @@ export function CallProvider(props : CallProviderProps) {
|
|||||||
* Отправляет сообщение в диалог с звонящим с информацией о звонке
|
* Отправляет сообщение в диалог с звонящим с информацией о звонке
|
||||||
*/
|
*/
|
||||||
const generateCallAttachment = () => {
|
const generateCallAttachment = () => {
|
||||||
let preview = "";
|
if(roleRef.current != CallRole.CALLER){
|
||||||
if(roleRef.current == CallRole.CALLER){
|
/**
|
||||||
preview += "1::";
|
* Только звонящий отправляет информацию о звонке в виде вложения, чтобы ее можно было отобразить в UI диалога, например длительность звонка
|
||||||
|
*/
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if(roleRef.current == CallRole.CALLEE){
|
|
||||||
preview += "0::";
|
|
||||||
}
|
|
||||||
preview += duration.toString();
|
|
||||||
|
|
||||||
sendMessage(activeCall, "", [{
|
sendMessage(activeCall, "", [{
|
||||||
id: generateRandomKey(16),
|
id: generateRandomKey(16),
|
||||||
preview: preview,
|
preview: duration.toString(),
|
||||||
type: AttachmentType.CALL,
|
type: AttachmentType.CALL,
|
||||||
blob: ""
|
blob: ""
|
||||||
}], false);
|
}], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const accept = () => {
|
const accept = () => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export enum AttachmentType {
|
|||||||
MESSAGES = 1,
|
MESSAGES = 1,
|
||||||
FILE = 2,
|
FILE = 2,
|
||||||
AVATAR = 3,
|
AVATAR = 3,
|
||||||
CALL
|
CALL = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Attachment {
|
export interface Attachment {
|
||||||
|
|||||||
Reference in New Issue
Block a user