леня + жопа
This commit is contained in:
parent
8e3cc37cc2
commit
0143526428
3 changed files with 17 additions and 5 deletions
|
@ -5,6 +5,8 @@ export default function createWebSocket(url, token, onMessageCallback, maxRetrie
|
||||||
token = token.split(" ")[1];
|
token = token.split(" ")[1];
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
|
closeWebSocket();
|
||||||
|
|
||||||
socket = new WebSocket(url, [token]);
|
socket = new WebSocket(url, [token]);
|
||||||
|
|
||||||
socket.addEventListener('message', (event) => {
|
socket.addEventListener('message', (event) => {
|
||||||
|
@ -38,7 +40,16 @@ export default function createWebSocket(url, token, onMessageCallback, maxRetrie
|
||||||
socket.onerror = (error) => {
|
socket.onerror = (error) => {
|
||||||
console.error('WebSocket error observed:', error)
|
console.error('WebSocket error observed:', error)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeWebSocket() {
|
||||||
|
if (socket) {
|
||||||
|
socket.close();
|
||||||
|
socket = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
connect()
|
connect()
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,12 @@
|
||||||
let submitButton
|
let submitButton
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
token = localStorage.getItem('BPChat')
|
|
||||||
|
|
||||||
|
token = localStorage.getItem('BPChat')
|
||||||
userData = await UserCheck()
|
userData = await UserCheck()
|
||||||
//console.log(userData)
|
|
||||||
avatars = await getAvatarHistory(token)
|
avatars = await getAvatarHistory(token)
|
||||||
console.log(avatars)
|
|
||||||
oldName = userData.username
|
oldName = userData.username
|
||||||
oldEmail = userData.email
|
oldEmail = userData.email
|
||||||
console.log(oldEmail)
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -178,6 +175,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function existingUser(){
|
async function existingUser(){
|
||||||
|
|
||||||
if((newName.length <= 2) && (newName != "")){
|
if((newName.length <= 2) && (newName != "")){
|
||||||
nameError = "ник от 2 символов"
|
nameError = "ник от 2 символов"
|
||||||
} else{
|
} else{
|
||||||
|
@ -328,6 +326,7 @@
|
||||||
|
|
||||||
.error{
|
.error{
|
||||||
color:var(--disable);
|
color:var(--disable);
|
||||||
|
padding-top:0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submitDiv{
|
.submitDiv{
|
||||||
|
|
|
@ -139,8 +139,10 @@
|
||||||
if((messageText != "") || image != null){
|
if((messageText != "") || image != null){
|
||||||
|
|
||||||
console.log(`${messageText} - текст, ${image} - картинка`)
|
console.log(`${messageText} - текст, ${image} - картинка`)
|
||||||
if(messageText == "жопа")
|
if(messageText == "жопа"){
|
||||||
messageText = "жопа съела трусы O.O"
|
messageText = "жопа съела трусы O.O"
|
||||||
|
image = "https://images.black-phoenix.ru/static/images/images/%D0%B6%D0%BE%D0%BF%D0%B0%20%D1%81%D1%8A%D0%B5%D0%BB%D0%B0%20%D1%82%D1%80%D1%83%D1%81%D1%8B.jpg"
|
||||||
|
}
|
||||||
|
|
||||||
socket.send(JSON.stringify({flag: flag,
|
socket.send(JSON.stringify({flag: flag,
|
||||||
message: messageText,
|
message: messageText,
|
||||||
|
|
Loading…
Add table
Reference in a new issue