This commit is contained in:
usmannasir
2025-05-18 13:35:44 +05:00
parent efcc4453cb
commit be923247c0
3 changed files with 71 additions and 271 deletions

View File

@@ -29,15 +29,10 @@
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
} }
.header-logo:hover { #uploadBoxLabel,#htmlEditorLable{
transform: translateY(-2px); background: -moz-linear-gradient(#a4dbf5, #8cc5e0);
box-shadow: var(--card-shadow-hover); background: -webkit-linear-gradient(#a4dbf5, #8cc5e0);
} background: -o-linear-gradient(#a4dbf5, #8cc5e0);
.header-logo img {
height: 32px;
width: auto;
filter: brightness(0.8) contrast(1.2);
} }
.my-drop-zone { .my-drop-zone {
@@ -60,220 +55,59 @@
border-radius: 3px; border-radius: 3px;
} }
.header-logo span { #htmlEditorContent{
font-size: 1.125rem; width: 100%;
font-weight: 500; height: 500px;
color: var(--text-primary);
} }
/* Top Actions Bar */ #htmlEditorStyles{
margin-bottom: 2%;
margin-top: 2%;
}
.flex-wrap { .flex-wrap {
padding: 0.5rem;
background: var(--background-lighter);
border-radius: 0.5rem;
box-shadow: var(--card-shadow);
margin: 0.5rem 0;
}
.nav {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 0.5rem; }
padding: 0.5rem; .mt-5 {
margin-top: 5px !important;
}
.mt-10 {
margin-top: 10px;
}
.mt-20 {
margin-top: 20px;
}
.mt-30 {
margin-top: 30px;
}
.mr-10 {
margin-right: 10px;
}
.mb-10 {
margin-bottom: 10px;
}
.ml-10 {
margin-left: 10px;
}
.my-10 {
margin-top: 10px;
margin-bottom: 10px;
} }
/* Enhanced Action Buttons */ .mx-5 {
.nav-item .nav-link { margin-left: 5px;
display: inline-flex; margin-right: 5px;
align-items: center;
padding: 0.75rem 1.25rem;
color: var(--text-secondary);
background: var(--background-lighter);
border: 1.5px solid var(--border-color);
border-radius: 0.75rem;
transition: var(--transition-bounce);
font-size: 0.875rem;
font-weight: 600;
text-decoration: none;
box-shadow: var(--button-shadow);
} }
.mx-10 {
.nav-item .nav-link:hover { margin-left: 10px;
color: var(--primary-color); margin-right: 10px;
border-color: var(--primary-color);
background: var(--background-lighter);
transform: translateY(-2px);
box-shadow: var(--button-shadow-hover);
} }
.header-logo {
.nav-item .nav-link i { width: 315px;
margin-right: 0.5rem; /* text-align: center;*/
font-size: 1rem; font-size: 16px;
} float: left;
position: relative;
/* File Manager Layout */
.row {
margin: 0;
background: var(--background-lighter);
}
/* Modern File List Section */
.table {
background: var(--background-lighter);
border-radius: 1.25rem;
box-shadow: var(--card-shadow);
overflow: hidden;
border: 1.5px solid var(--border-color);
margin-top: 1.5rem;
}
#tableHead th {
background: var(--background-light);
padding: 1.25rem 1.5rem;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--text-secondary);
border-bottom: 1.5px solid var(--border-color);
}
.table tbody tr {
transition: var(--transition-smooth);
}
.table tbody tr:hover {
background: var(--hover-bg);
transform: translateY(-1px);
box-shadow: var(--button-shadow);
}
.table td {
padding: 1.25rem 1.5rem;
vertical-align: middle;
color: var(--text-secondary);
font-size: 0.875rem;
border-bottom: 1px solid var(--border-color);
}
/* Enhanced File Actions */
.file-actions {
display: flex;
gap: 0.75rem;
opacity: 0;
transition: var(--transition-smooth);
}
.file-action-btn {
padding: 0.625rem;
border-radius: 0.75rem;
border: 1.5px solid var(--border-color);
background: var(--background-lighter);
color: var(--text-secondary);
transition: var(--transition-bounce);
box-shadow: var(--button-shadow);
}
.file-action-btn:hover {
color: var(--primary-color);
border-color: var(--primary-color);
background: var(--background-lighter);
transform: translateY(-2px);
box-shadow: var(--button-shadow-hover);
}
/* Modern Tree View */
.tree-item {
display: flex;
align-items: center;
padding: 0.75rem 1rem;
border-radius: 0.75rem;
cursor: pointer;
transition: var(--transition-smooth);
margin: 0.25rem 0;
}
.tree-item:hover {
background: var(--hover-bg);
transform: translateX(4px);
}
.tree-item i {
margin-right: 0.5rem;
font-size: 1rem;
}
/* File List */
.file-list {
background: var(--background-lighter);
border-radius: 0.5rem;
margin: 1rem;
}
.file-list-header {
display: flex;
align-items: center;
padding: 0.75rem 1rem;
background: var(--background-light);
border-bottom: 1px solid var(--border-color);
border-top-left-radius: 0.5rem;
border-top-right-radius: 0.5rem;
}
.file-item {
display: flex;
align-items: center;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--border-color);
transition: all 0.15s ease;
}
.file-item:hover {
background: var(--hover-bg);
}
.file-item-icon {
margin-right: 0.75rem;
color: var(--secondary-color);
}
.file-item-name {
flex: 1;
font-size: 0.875rem;
color: var(--text-primary);
}
.file-item-size {
width: 100px;
text-align: right;
font-size: 0.875rem;
color: var(--text-secondary);
}
.file-item-date {
width: 150px;
text-align: right;
font-size: 0.875rem;
color: var(--text-secondary);
}
.file-item-permissions {
width: 100px;
text-align: right;
font-family: monospace;
font-size: 0.875rem;
color: var(--text-secondary);
}
/* Enhanced Path Navigation */
.path-nav {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 1rem 1.5rem;
background: var(--background-light);
border-bottom: 1.5px solid var(--border-color);
border-radius: 1rem 1rem 0 0;
} }
a.nav-link { a.nav-link {
@@ -287,41 +121,15 @@ a.nav-link:hover {
transform: translateY(-1px); transform: translateY(-1px);
} }
.path-nav-separator { .point-events {
color: var(--border-color); pointer-events: all;
} }
/* Selection Styles */ .card-header {
.selected { padding: .75rem 1.25rem;
background: var(--hover-bg); margin-bottom: 0;
border-color: var(--primary-color); background-color: transparent;
} border-bottom: none;
/* Modern Current Path Display */
#currentRPath {
font-size: 0.875rem;
color: var(--text-secondary);
background-color: var(--background-light);
border: 1.5px solid var(--border-color);
padding: 1rem 1.25rem;
border-radius: 1rem;
margin-bottom: 1.5rem;
transition: var(--transition-bounce);
box-shadow: var(--button-shadow);
}
#currentRPath:hover {
border-color: var(--primary-color);
transform: translateY(-1px);
box-shadow: var(--button-shadow-hover);
}
/* Enhanced File Icons */
i.fa.fa-folder {
color: var(--warning-color) !important;
margin-right: 0.75rem;
font-size: 1.25rem;
transition: var(--transition-smooth);
} }
.form-control { .form-control {
padding: 0.5rem 1rem; padding: 0.5rem 1rem;

View File

@@ -6,7 +6,6 @@ import shlex
import subprocess import subprocess
import socket import socket
from plogical.processUtilities import ProcessUtilities from plogical.processUtilities import ProcessUtilities
try: try:
from websiteFunctions.models import ChildDomains, Websites from websiteFunctions.models import ChildDomains, Websites
except: except:
@@ -15,6 +14,7 @@ from plogical.acl import ACLManager
class sslUtilities: class sslUtilities:
Server_root = "/usr/local/lsws" Server_root = "/usr/local/lsws"
redisConf = '/usr/local/lsws/conf/dvhost_redis.conf' redisConf = '/usr/local/lsws/conf/dvhost_redis.conf'
@@ -48,6 +48,7 @@ class sslUtilities:
except BaseException as msg: except BaseException as msg:
return 0, str(msg) return 0, str(msg)
@staticmethod @staticmethod
def CheckIfSSLNeedsToBeIssued(virtualHostName): def CheckIfSSLNeedsToBeIssued(virtualHostName):
#### if website already have an SSL, better not issue again - need to check for wild-card #### if website already have an SSL, better not issue again - need to check for wild-card
@@ -60,6 +61,7 @@ class sslUtilities:
if os.path.exists(ProcessUtilities.debugPath): if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(f'SSL provider for {virtualHostName} is {SSLProvider}.') logging.CyberCPLogFileWriter.writeToFile(f'SSL provider for {virtualHostName} is {SSLProvider}.')
#### totally seprate check to see if both non-www and www are covered #### totally seprate check to see if both non-www and www are covered
if SSLProvider == "(STAGING) Let's Encrypt": if SSLProvider == "(STAGING) Let's Encrypt":
@@ -71,8 +73,7 @@ class sslUtilities:
if len(domains) > 1: if len(domains) > 1:
### need further checks here to see if ssl is valid for less then 15 days etc ### need further checks here to see if ssl is valid for less then 15 days etc
logging.CyberCPLogFileWriter.writeToFile( logging.CyberCPLogFileWriter.writeToFile(
'[CheckIfSSLNeedsToBeIssued] SSL exists for %s and both versions are covered, just need to ensure if SSL is valid for less then 15 days.' % ( '[CheckIfSSLNeedsToBeIssued] SSL exists for %s and both versions are covered, just need to ensure if SSL is valid for less then 15 days.' % (virtualHostName), 0)
virtualHostName), 0)
pass pass
else: else:
return sslUtilities.ISSUE_SSL return sslUtilities.ISSUE_SSL
@@ -85,7 +86,7 @@ class sslUtilities:
now = datetime.now() now = datetime.now()
diff = finalDate - now diff = finalDate - now
if int(diff.days) >= 15 and SSLProvider != 'Denial': if int(diff.days) >= 15 and SSLProvider!='Denial':
logging.CyberCPLogFileWriter.writeToFile( logging.CyberCPLogFileWriter.writeToFile(
'[CheckIfSSLNeedsToBeIssued] SSL exists for %s and is not ready to fetch new SSL., skipping..' % ( '[CheckIfSSLNeedsToBeIssued] SSL exists for %s and is not ready to fetch new SSL., skipping..' % (
virtualHostName), 0) virtualHostName), 0)
@@ -144,6 +145,7 @@ class sslUtilities:
return str(msg) return str(msg)
return 0 return 0
@staticmethod @staticmethod
def checkSSLIPv6Listener(): def checkSSLIPv6Listener():
try: try:
@@ -153,8 +155,7 @@ class sslUtilities:
return 1 return 1
except BaseException as msg: except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile( logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
return str(msg) return str(msg)
return 0 return 0
@@ -664,7 +665,7 @@ context /.well-known/acme-challenge {
try: try:
command = acmePath + " --issue -d " + virtualHostName + " -d www." + virtualHostName \ command = acmePath + " --issue -d " + virtualHostName + " -d www." + virtualHostName \
+ ' -d ' + aliasDomain + ' -d www.' + aliasDomain \ + ' -d ' + aliasDomain + ' -d www.' + aliasDomain\
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \ + ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w /usr/local/lsws/Example/html -k ec-256 --force --server letsencrypt' + ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w /usr/local/lsws/Example/html -k ec-256 --force --server letsencrypt'
@@ -698,16 +699,13 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain=None):
if os.path.exists(pathToStoreSSLFullChain): if os.path.exists(pathToStoreSSLFullChain):
import OpenSSL import OpenSSL
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, open(pathToStoreSSLFullChain, 'r').read())
open(pathToStoreSSLFullChain, 'r').read())
SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8') SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8')
if SSLProvider != 'Denial': if SSLProvider != 'Denial':
if sslUtilities.installSSLForDomain(domain) == 1: if sslUtilities.installSSLForDomain(domain) == 1:
logging.CyberCPLogFileWriter.writeToFile( logging.CyberCPLogFileWriter.writeToFile("We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www).")
"We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www).") return [1, "We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www)." + " [issueSSLForDomain]"]
return [1,
"We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www)." + " [issueSSLForDomain]"]
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=' + domain + '" -keyout ' + pathToStoreSSLPrivKey + ' -out ' + pathToStoreSSLFullChain command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=' + domain + '" -keyout ' + pathToStoreSSLPrivKey + ' -out ' + pathToStoreSSLFullChain
cmd = shlex.split(command) cmd = shlex.split(command)

View File

@@ -4185,13 +4185,7 @@ Require valid-user
port = ProcessUtilities.fetchCurrentPort() port = ProcessUtilities.fetchCurrentPort()
webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify' webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify'
webhookURL = webhookURL.replace(' ', '%20')
if website.externalApp == 'github':
command = "ssh-keygen -f /home/%s/.ssh/%s -t rsa -N ''" % (self.domain, website.externalApp)
ProcessUtilities.executioner(command, website.externalApp)
configContent = """Host github.com
proc = httpProc(request, 'websiteFunctions/setupGit.html', proc = httpProc(request, 'websiteFunctions/setupGit.html',
{'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL}) {'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL})
return proc.render() return proc.render()