Feature: Auto Request 15 days trial for LSWS Ent

This commit is contained in:
Usman Nasir 2019-09-19 13:41:46 +05:00
parent 6b59900153
commit e7437afebd
4 changed files with 44 additions and 14 deletions

View File

@ -48,21 +48,20 @@
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-6">
<div ng-hide="canNotIssue" class="alert alert-danger">
<p>{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="canNotIssue" class="alert alert-danger">
<p>{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="sslIssued" class="alert alert-success">
<p>{% trans "SSL Issued for" %} <strong>{$ sslDomain $}</strong></p>
</div>
<div ng-hide="sslIssued" class="alert alert-success">
<p>{% trans "SSL Issued for" %} <strong>{$ sslDomain $}</strong></p>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>

View File

@ -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/')

View File

@ -158,8 +158,25 @@
<div class="col-sm-4">
<button type="button" ng-click="switchTOLSWS()"
class="btn btn-primary btn-lg">{% trans "Switch" %}</button>
<button type="button" ng-click="switchTOLSWS()"
class="btn btn-primary btn-lg">{% trans "Get 15 Days Trial" %}</button>
</div>
<div class="col-sm-4">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-6">
<div class="alert alert-info">
<p>{% 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." %}</p>
</div>
</div>
</div>
</form>

View File

@ -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)