From fa26fafcde86e0cdff96174137d208e544dc8c62 Mon Sep 17 00:00:00 2001 From: Troplo Date: Tue, 25 Oct 2022 17:24:51 +1100 Subject: [PATCH] 1.0.33 --- backend/lib/socket.js | 15 +++----- frontend/package.json | 2 +- frontend/src/App.vue | 9 +++++ frontend/src/components/Header.vue | 17 +++++++-- .../Communications/CommunicationsChat.vue | 38 ++++++++++++++----- 5 files changed, 56 insertions(+), 25 deletions(-) diff --git a/backend/lib/socket.js b/backend/lib/socket.js index 4ddb81c..04fb848 100644 --- a/backend/lib/socket.js +++ b/backend/lib/socket.js @@ -17,6 +17,7 @@ module.exports = { } }) if (user && socket.user.id) { + console.log(user.id + " client connect") console.log(socket.user.id) socket.join(user.id) socket.emit("siteState", { @@ -48,6 +49,7 @@ module.exports = { }) }) socket.on("ping", () => { + console.log(user.id + " client ping") socket.emit("pong") }) socket.on("bcBots/deleteMessage", (e) => { @@ -60,11 +62,7 @@ module.exports = { } }) socket.on("idle", async () => { - const user = await User.findOne({ - where: { - id: socket.user.id - } - }) + console.log(user.id + " client online") if (user.storedStatus === "online") { friends.forEach((friend) => { io.to(friend.friendId).emit("userStatus", { @@ -82,11 +80,7 @@ module.exports = { } }) socket.on("online", async () => { - const user = await User.findOne({ - where: { - id: socket.user.id - } - }) + console.log(user.id + " client online") if (user.storedStatus === "online") { friends.forEach((friend) => { io.to(friend.friendId).emit("userStatus", { @@ -104,6 +98,7 @@ module.exports = { } }) socket.on("disconnect", async function () { + console.log(user.id + " client disconnected") const clients = io.sockets.adapter.rooms.get(user.id) || new Set() if (!clients.size || clients.size === 0) { friends.forEach((friend) => { diff --git a/frontend/package.json b/frontend/package.json index c7bf75d..f6dd600 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "colubrina", - "version": "1.0.32", + "version": "1.0.33", "description": "Simple instant communication.", "private": true, "author": "Troplo ", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 0010cbd..c838a06 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -490,6 +490,15 @@ export default { touchEndX: null }), computed: { + /*chat() { + try { + return this.$store.state.chats.find( + (item) => item.id === parseInt(this.$route.params.id) + ) + } catch { + return null + } + },*/ creatorJSON: { get() { return JSON.stringify(this.$store.state.themeEngine.theme) diff --git a/frontend/src/components/Header.vue b/frontend/src/components/Header.vue index a8c12a6..0c09331 100644 --- a/frontend/src/components/Header.vue +++ b/frontend/src/components/Header.vue @@ -545,11 +545,11 @@ Debug