From f7007a667f4054b73cdb20429df8de01a882f0bc Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 2 Jun 2025 22:53:54 +0500 Subject: [PATCH] ssh logs --- .../templates/baseTemplate/homePage.html | 26 ++++++++++++++++++- baseTemplate/views.py | 13 ++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/homePage.html b/baseTemplate/templates/baseTemplate/homePage.html index 883519647..300f7459d 100755 --- a/baseTemplate/templates/baseTemplate/homePage.html +++ b/baseTemplate/templates/baseTemplate/homePage.html @@ -523,7 +523,7 @@ {$ login.date $} {$ login.session $} - + @@ -1138,6 +1138,30 @@ .refresh-btn:hover .refresh-icon { transform: rotate(360deg); } + + .view-activity-btn { + border: 2px solid #4c5fad; + color: #4c5fad; + background: #fff; + border-radius: 999px; + font-size: 1rem; + font-weight: 700; + padding: 6px 22px; + transition: all 0.2s; + outline: none; + box-shadow: none; + cursor: pointer; + display: inline-block; + vertical-align: middle; + line-height: 1.2; + } + .view-activity-btn:hover, .view-activity-btn:focus { + background: #4c5fad; + color: #fff; + border-color: #4c5fad; + box-shadow: 0 2px 12px rgba(76,95,173,0.10); + text-decoration: none; + } diff --git a/baseTemplate/views.py b/baseTemplate/views.py index c7ba1fc08..79bb67039 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -709,11 +709,14 @@ def getSSHUserActivity(request): shell_history = [] # Disk usage disk_usage = '' - try: - du_out = ProcessUtilities.outputExecutioner(f'du -sh {shell_home}') - disk_usage = du_out.strip().split('\t')[0] if du_out else '' - except Exception: - disk_usage = '' + if os.path.exists(shell_home): + try: + du_out = ProcessUtilities.outputExecutioner(f'du -sh {shell_home}') + disk_usage = du_out.strip().split('\t')[0] if du_out else '' + except Exception: + disk_usage = '' + else: + disk_usage = 'Home directory does not exist' # GeoIP details geoip = {} if login_ip and login_ip not in ['127.0.0.1', 'localhost']: