From 63c4bc61c3b6a7afdbfb060d0683d2759261c048 Mon Sep 17 00:00:00 2001 From: uniknow <000-drakon@mail.ru> Date: Sun, 6 Oct 2024 17:55:21 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B3=D0=BB=D0=BE=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 11 ++- src/lib/chat.js | 41 ++++++++ src/routes/c/+page.svelte | 160 +++++++++++++++++++++++++++++-- src/routes/settings/+page.svelte | 8 +- src/routes/submit/+page.svelte | 15 ++- 5 files changed, 218 insertions(+), 17 deletions(-) diff --git a/.env b/.env index 7df4e84..d3c441d 100644 --- a/.env +++ b/.env @@ -1,5 +1,12 @@ # at the end without / -PUBLIC_URL="https://docs.black-phoenix.ru" +PUBLIC_URL="https://chat.black-phoenix.ru/api" + +# api https://chat.black-phoenix.ru/api +# main https://docs.black-phoenix.ru + #websocket -PUBLIC_WSS="wss://docs.black-phoenix.ru" \ No newline at end of file +PUBLIC_WSS="wss://docs.black-phoenix.ru" + +# api wss://docs.black-phoenix.ru/api" +# main wss://docs.black-phoenix.ru" \ No newline at end of file diff --git a/src/lib/chat.js b/src/lib/chat.js index 822eabb..f73b7c3 100644 --- a/src/lib/chat.js +++ b/src/lib/chat.js @@ -1,5 +1,46 @@ import { PUBLIC_URL } from '$env/static/public'; +export async function GetInviteLink(chatId) { + let token = localStorage.getItem("BPChat") + const response = await fetch(`${PUBLIC_URL}/api/chat/create_invitation_link?chat_id=${chatId}`, + { + method:"GET", + credentials:"include", + headers:{ + 'accept': 'application/json', + 'Authorization': token, + }}) + + if(response.ok){ + let data = await response.json() + return data.invitation_link + } else { + console.log(response.status) + return false + } +} + +export async function addingToChat(code){ + + let token = localStorage.getItem("BPChat") + const response = await fetch(`${PUBLIC_URL}/api/chat/invite_to_chat/${code}`, + { + method:"GET", + credentials:"include", + headers:{ + 'accept': 'application/json', + 'Authorization': token, + } + }) + + if(response.ok){ + window.location.href = '/c' + } else { + return false + } + +} + export async function getLastMessages(chatId,msgLoaded){ let token = localStorage.getItem('BPChat') diff --git a/src/routes/c/+page.svelte b/src/routes/c/+page.svelte index 271a0a0..2471bdc 100644 --- a/src/routes/c/+page.svelte +++ b/src/routes/c/+page.svelte @@ -1,12 +1,13 @@ @@ -505,6 +526,32 @@ let pinOrNot = false
+
+ +
+

{pickedChatName}

+
+ +
+ {pickedChatImg} +
+ + + +
+ + {pickedChatImg} + +
+ скопировано + +
+ +
@@ -515,9 +562,11 @@ let pinOrNot = false {/if}
- + + + {#if helperDivBoolShow == true}
event.preventDefault()} @@ -665,18 +714,107 @@ let pinOrNot = false
-

- +

Made by:

-

Uniknow and urec56

- +

uniknow and Urec56

+