diff --git a/osinaweb/.DS_Store b/osinaweb/.DS_Store index e6b1582c..bfc92706 100644 Binary files a/osinaweb/.DS_Store and b/osinaweb/.DS_Store differ diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 801b849e..feeaf72e 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc index f4fce16b..97af924d 100644 Binary files a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc and b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc differ diff --git a/osinaweb/osichat/consumers.py b/osinaweb/osichat/consumers.py index e6bf4e12..c43c6e8a 100644 --- a/osinaweb/osichat/consumers.py +++ b/osinaweb/osichat/consumers.py @@ -78,7 +78,11 @@ class Osichat(WebsocketConsumer): event = { 'type': 'get_chats_handler', } - self.get_chats_handler(event) + + if data.get('whereAmI') == 'Chats': + self.get_chats_handler(event) + else: + self.get_visitors_handler(event) if event_type == 'get_chats': event = { diff --git a/osinaweb/osinacore/.DS_Store b/osinaweb/osinacore/.DS_Store index 7ee74078..3878a539 100644 Binary files a/osinaweb/osinacore/.DS_Store and b/osinaweb/osinacore/.DS_Store differ diff --git a/osinaweb/osinacore/templates/.DS_Store b/osinaweb/osinacore/templates/.DS_Store index 0c2f6aa2..a8d9e49d 100644 Binary files a/osinaweb/osinacore/templates/.DS_Store and b/osinaweb/osinacore/templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/chat_templates/partials/new-visitor.html b/osinaweb/osinacore/templates/chat_templates/partials/new-visitor.html index 11b1c228..d295a5b2 100644 --- a/osinaweb/osinacore/templates/chat_templates/partials/new-visitor.html +++ b/osinaweb/osinacore/templates/chat_templates/partials/new-visitor.html @@ -15,9 +15,15 @@

{{visitor.ip_address}}

-

{{visitor.visitorlog_set.all.last.url}}

+

+ {% if not visitor.visitorlog_set.all.last.title %} + {{ visitor.visitorlog_set.all.last.url|slice:":26" }}{% if visitor.visitorlog_set.all.last.url|length > 26 %}…{% endif %} + {% else %} + {{ visitor.visitorlog_set.all.last.title|slice:":26" }}{% if visitor.visitorlog_set.all.last.title|length > 26 %}…{% endif %} + {% endif %} +

- +

{{visitor.total_duration}}

diff --git a/osinaweb/osinacore/templates/email_templates/account_activation_email.html b/osinaweb/osinacore/templates/email_templates/account_activation_email.html index d05a5752..e69de29b 100644 --- a/osinaweb/osinacore/templates/email_templates/account_activation_email.html +++ b/osinaweb/osinacore/templates/email_templates/account_activation_email.html @@ -1,54 +0,0 @@ - - - - - - Account Activation - - - -
-

Activate your account at Ositcom

-

Hello {{ user.first_name }},

-

Thank you for signing up! To help us confirm your identity, please click the button below to activate your account and verify your email address:

-

Activate Account

-

If you didn't request this, you can safely ignore this email.

-

Regards,
The Ositcom Team

-
- - diff --git a/osinaweb/static/js/osichat-admin/osichat.js b/osinaweb/static/js/osichat-admin/osichat.js index a17355ee..313d13d3 100644 --- a/osinaweb/static/js/osichat-admin/osichat.js +++ b/osinaweb/static/js/osichat-admin/osichat.js @@ -4,6 +4,7 @@ let admin_chat_domain = "osina.ositcom.com"; let userId = document.getElementById('userId').textContent.trim(); let osichatadminroomSocket = null; let currentChatId = null; +let whereAmI = null; // FUNCTIONS TO SHOW & HIDE THE LOADER function showLoader() { @@ -39,7 +40,8 @@ function initializeOsichat(){ osichatroomsSocket.send(JSON.stringify({ 'event_type': 'set_client_type', 'client_type': 'website_admin', - 'user_id': userId + 'user_id': userId, + 'whereAmI': whereAmI === 'Visitors' ? 'Visitors' : 'Chats' // Default to 'Chats' if not 'Visitors' })); }; @@ -148,6 +150,7 @@ const chatsTab = document.getElementById('chatsTab'); const visitorsTab = document.getElementById('visitorsTab'); function switchToChats() { + whereAmI = 'Chats'; chatsTab.classList.add('bg-white', 'text-secondosiblue', 'shadow-md'); chatsTab.classList.remove('bg-gray-100', 'text-gray-400'); visitorsTab.classList.add('bg-gray-100', 'text-gray-400'); @@ -159,6 +162,7 @@ function switchToChats() { } function switchToVisitors() { + whereAmI = 'Visitors'; visitorsTab.classList.add('bg-white', 'text-secondosiblue', 'shadow-md'); visitorsTab.classList.remove('bg-gray-100', 'text-gray-400'); chatsTab.classList.add('bg-gray-100', 'text-gray-400'); @@ -172,6 +176,8 @@ function switchToVisitors() { chatsTab.addEventListener('click', switchToChats); visitorsTab.addEventListener('click', switchToVisitors); + + let updateInterval; function updateOnlineDurations() { document.querySelectorAll('.visitor').forEach(visitorDiv => { diff --git a/osinaweb/static/js/osichat/visitors.js b/osinaweb/static/js/osichat/visitors.js index 5f16f4e4..4f5a32bb 100644 --- a/osinaweb/static/js/osichat/visitors.js +++ b/osinaweb/static/js/osichat/visitors.js @@ -115,6 +115,12 @@ async function initializeVisitorsWebSocket() { visitorsSocket.onerror = (error) => { console.error('WebSocket error:', error); }; + + window.addEventListener('offline', () => { + if (visitorsSocket) { + visitorsSocket.close(); + } + }); }