From e7437afebd796fe0650299e69d682ef8d714070e Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 19 Sep 2019 13:41:46 +0500 Subject: [PATCH] Feature: Auto Request 15 days trial for LSWS Ent --- manageSSL/templates/manageSSL/manageSSL.html | 19 +++++++++---------- serverStatus/serverStatusUtil.py | 15 ++++++++++++--- .../serverStatus/litespeedStatus.html | 17 +++++++++++++++++ serverStatus/views.py | 7 ++++++- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/manageSSL/templates/manageSSL/manageSSL.html b/manageSSL/templates/manageSSL/manageSSL.html index bf2c904ac..b769e1add 100755 --- a/manageSSL/templates/manageSSL/manageSSL.html +++ b/manageSSL/templates/manageSSL/manageSSL.html @@ -48,21 +48,20 @@
-
-

{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}

-
+
+

{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}

+
-
-

{% trans "SSL Issued for" %} {$ sslDomain $}

-
+
+

{% trans "SSL Issued for" %} {$ sslDomain $}

+
-
-

{% trans "Could not connect to server. Please refresh this page." %}

-
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
-
diff --git a/serverStatus/serverStatusUtil.py b/serverStatus/serverStatusUtil.py index d5f241e1f..a821fcb9c 100755 --- a/serverStatus/serverStatusUtil.py +++ b/serverStatus/serverStatusUtil.py @@ -61,13 +61,22 @@ class ServerStatusUtil: if ServerStatusUtil.executioner(command, statusFile) == 0: return 0 + if os.path.exists('/usr/local/CyberCP/lsws-5.3.8/'): + shutil.rmtree('/usr/local/CyberCP/lsws-5.3.8') + + command = 'tar zxf lsws-5.3.8-ent-x86_64-linux.tar.gz -C /usr/local/CyberCP' if ServerStatusUtil.executioner(command, statusFile) == 0: return 0 - writeSerial = open('/usr/local/CyberCP/lsws-5.3.8/serial.no', 'w') - writeSerial.writelines(licenseKey) - writeSerial.close() + if licenseKey == 'trial': + command = 'wget -q --output-document=/usr/local/CyberCP/lsws-5.3.8/trial.key http://license.litespeedtech.com/reseller/trial.key' + if ServerStatusUtil.executioner(command, statusFile) == 0: + return 0 + else: + writeSerial = open('/usr/local/CyberCP/lsws-5.3.8/serial.no', 'w') + writeSerial.writelines(licenseKey) + writeSerial.close() shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', '/usr/local/CyberCP/lsws-5.3.8/') shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', '/usr/local/CyberCP/lsws-5.3.8/') diff --git a/serverStatus/templates/serverStatus/litespeedStatus.html b/serverStatus/templates/serverStatus/litespeedStatus.html index f25b87598..7871de5fb 100755 --- a/serverStatus/templates/serverStatus/litespeedStatus.html +++ b/serverStatus/templates/serverStatus/litespeedStatus.html @@ -158,8 +158,25 @@
+
+
+ + +
+ + +
+ +
+
+

{% trans "Note: If you select 15 days trial there is no need to enter the serial key, CyberPanel will auto fetch 15 days trial key for you. Make sure this server have not used trial already." %}

+
+
+ +
diff --git a/serverStatus/views.py b/serverStatus/views.py index 90ddeea71..ce9bf3f7c 100755 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -343,8 +343,13 @@ def switchTOLSWS(request): data = json.loads(request.body) + try: + licenseKey = data['licenseKey'] + except: + licenseKey = 'trial' + execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/serverStatus/serverStatusUtil.py" - execPath = execPath + " switchTOLSWS --licenseKey " + data['licenseKey'] + execPath = execPath + " switchTOLSWS --licenseKey " + licenseKey ProcessUtilities.popenExecutioner(execPath) time.sleep(2)