From c471ffdec704174937f42344b754869e1308e36f Mon Sep 17 00:00:00 2001 From: emile Date: Sat, 10 Aug 2024 14:34:31 +0300 Subject: [PATCH] new --- osinaweb/.DS_Store | Bin 10244 -> 10244 bytes osinaweb/db.sqlite3 | Bin 1945600 -> 1945600 bytes .../__pycache__/consumers.cpython-310.pyc | Bin 15015 -> 15067 bytes osinaweb/osichat/consumers.py | 6 +- osinaweb/osinacore/.DS_Store | Bin 10244 -> 10244 bytes osinaweb/osinacore/templates/.DS_Store | Bin 12292 -> 12292 bytes .../chat_templates/partials/new-visitor.html | 10 +++- .../account_activation_email.html | 54 ------------------ osinaweb/static/js/osichat-admin/osichat.js | 8 ++- osinaweb/static/js/osichat/visitors.js | 6 ++ 10 files changed, 26 insertions(+), 58 deletions(-) diff --git a/osinaweb/.DS_Store b/osinaweb/.DS_Store index e6b1582c8138a15920dcf92c39b78fca5881280b..bfc9270641f742abbacaa3d983943b7a89993965 100644 GIT binary patch delta 25 gcmZn(XbIRLC&4JTSzbb!k__J?@ZmWGzI-3vCtse;muFXa zs(;lNqWWJ(?zdCBrS105Hp*Xm(b3RV4?zor8UmUm2_l5D2$%Ns;+{?sG+`xdgq^4& z9E6i_5!FNuQETq$%-4CJ(}e(%IzXV~BvnM3j0FWDQ32+`H%8pFj$6JMj&-(^CbN5; zeX2ckCM=a-n>9>NjAmz&dQMKrlc@=)c5W?YfDy`?z zp+r`n8V^Tf14DfU-|wv4Lq$URbXv~fM=@z!&1I*@WJT4ZY9KYLPDM|$xc`O~3u~NN zSZmHlt&Q%;bBF)NYslYpw>YdcP5bHH)A{anzCE5kddJMW`NE*J(N;1X5x&(~HEI87 z@3ECk5aE|>wgq-MWDF+xW&^Bp>|d{}2vEX6!WHi?Y7h$&P!R^S--sl5mFhY_0bv1P zML}Xk0@5T!Ai)9US3>Z-1gHT;z>2J5P>}#Nk+hRls7fatude zs>z}tp#VaF_8r$P9>#gXXCB7=tz2D|%VS|bF|TT$)QnYkx;&+Y4DGtUcx5qZ4=)V| zFS-Ha`-kSOJF%1+)-tz;LUK>A7bZpqdWL%DdV}5B9LC+Zr8#*b+&7}=cayPn3iaI^ QKHCTVbFgOTWB+d3Pyg*22mk;8 delta 722 zcmZ9~&1=(O90%|ueM_??SvR$d$)JkEp)NdmX_}{4e3^&`H+JzT?5$mASK7_4i&a?1 z3KexTBJy||9s38=PI8-qmmSxO=&hi58{YKlZ+74?51;49m*P~R)ifB`<>2LTWSA;5w# z;6NAX_Vx<=!HN=Qb)=ia$R0l26(e$9!>nCr#@y*aY2{nWix!DlbFE`l@ zHcS2g4f;lz`D_lM#7qg}O74D9Uz|5BXVP&Bg>*?TI^{|FPMzNpfCzd(1oVPFZ~~kJ zr#yZu`djra&}|ahkA8c(TKq*mwxWFfpcVBFTK&;oAt2N!aYxLGim)%#NX(V`334U& zunT&&EA8;PIh?DME822#T3f12EzaVshILi5Y*kY=gh$4N+f;x`tUX|<(en|wj+UNY z!V8v@)6INo?w+2RDlHV8qLa?&v)TNzaeTQkGA7n(`e-G&c1w!!$H(LK+NR{yHcwY4 zeLZ6JRY*P?8W;bz_ee%!49;sXLB@spnqiseP+iCyP#-g4X5Fiba&6q#6NH~IA)jHn zM5lRZLSFNeD=P}`r>L&0B(kksB9B&-3lO;C#CUFUgZL&!+0Dih3z!&RPrf3xg^_)8 zr*t?MBj4tSs_$7CPi(%ZwV#oZbMr)<#Y{kjruyMbjINt|4Lz6`6E|NozRt*4wRxTC cEk>Yyo#x(*j7uk9wOGvfYICJ!A|s;#0D7!cEC2ui 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 7ee740786d51cc4c934b7ad1ca591b597d2b717a..3878a539e826fac728839dae8368e93a5cd727b1 100644 GIT binary patch delta 314 zcmZn(XbG6$F8U^hRb&SoBg$;^U049N`n40#O245bXY45AE-OgN$xi}Wa$~Zsq!Oo? zsJMirl(dxW((wZP#TohKp2_)n0Y#~0nW^OwnLu`MW>xCscquhzWrxto^-@ye z$qEc0z!{R4pO?z1><|FvGECkerD!e5sKltvXu@dAXwT@u7|0mJn9P{Nn9EqiSPW6c h#0a4omL9LEL zwS}26kZER8Tg%BIs;qAv6rY`wo0s1?d7qd(W7p($5@M6*NpdruoxDm?iBnWmOk6@z zN?LOARmnTj5t+&PdBK@gsqq5*#TohKoQiZPing)x({2%?CI5kfP_LTM<) iSPXLI<{8rYEE5|lHnS`IVwwC<(0+4;=wc?Iw-o`yz(KwM diff --git a/osinaweb/osinacore/templates/.DS_Store b/osinaweb/osinacore/templates/.DS_Store index 0c2f6aa2951f05b62b3698a58a80d76122cf3aec..a8d9e49d62c37104aa902458289411efe0781319 100644 GIT binary patch delta 171 zcmZokXi1o`ZSr$(lV3-`Jt~U9DF#qHvLD|i50y~%(cTBcbEmW7N zt~RnX(@`)nFs#*4sJ1jR0J4qEYHK+;M3wcegW|Jua`W=LCL5~DGj?x2C+x+#IYn|g z+hhes(aqcn)-3FN49N@`42hE&g~TSlhJOen$t Dva=(e 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(); + } + }); }