Skip to content

Commit e7437af

Browse files
committed
Feature: Auto Request 15 days trial for LSWS Ent
1 parent 6b59900 commit e7437af

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

manageSSL/templates/manageSSL/manageSSL.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,20 @@ <h3 class="content-box-header">
4848
<div class="form-group">
4949
<label class="col-sm-3 control-label"></label>
5050
<div class="col-sm-6">
51-
<div ng-hide="canNotIssue" class="alert alert-danger">
52-
<p>{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}</p>
53-
</div>
51+
<div ng-hide="canNotIssue" class="alert alert-danger">
52+
<p>{% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}</p>
53+
</div>
5454

55-
<div ng-hide="sslIssued" class="alert alert-success">
56-
<p>{% trans "SSL Issued for" %} <strong>{$ sslDomain $}</strong></p>
57-
</div>
55+
<div ng-hide="sslIssued" class="alert alert-success">
56+
<p>{% trans "SSL Issued for" %} <strong>{$ sslDomain $}</strong></p>
57+
</div>
5858

59-
<div ng-hide="couldNotConnect" class="alert alert-danger">
60-
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
61-
</div>
59+
<div ng-hide="couldNotConnect" class="alert alert-danger">
60+
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
61+
</div>
6262
</div>
6363

6464

65-
6665
</div>
6766

6867

serverStatus/serverStatusUtil.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,22 @@ def installLiteSpeed(licenseKey, statusFile):
6161
if ServerStatusUtil.executioner(command, statusFile) == 0:
6262
return 0
6363

64+
if os.path.exists('/usr/local/CyberCP/lsws-5.3.8/'):
65+
shutil.rmtree('/usr/local/CyberCP/lsws-5.3.8')
66+
67+
6468
command = 'tar zxf lsws-5.3.8-ent-x86_64-linux.tar.gz -C /usr/local/CyberCP'
6569
if ServerStatusUtil.executioner(command, statusFile) == 0:
6670
return 0
6771

68-
writeSerial = open('/usr/local/CyberCP/lsws-5.3.8/serial.no', 'w')
69-
writeSerial.writelines(licenseKey)
70-
writeSerial.close()
72+
if licenseKey == 'trial':
73+
command = 'wget -q --output-document=/usr/local/CyberCP/lsws-5.3.8/trial.key http://license.litespeedtech.com/reseller/trial.key'
74+
if ServerStatusUtil.executioner(command, statusFile) == 0:
75+
return 0
76+
else:
77+
writeSerial = open('/usr/local/CyberCP/lsws-5.3.8/serial.no', 'w')
78+
writeSerial.writelines(licenseKey)
79+
writeSerial.close()
7180

7281
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', '/usr/local/CyberCP/lsws-5.3.8/')
7382
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', '/usr/local/CyberCP/lsws-5.3.8/')

serverStatus/templates/serverStatus/litespeedStatus.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,25 @@ <h3 class="content-box-header">
158158
<div class="col-sm-4">
159159
<button type="button" ng-click="switchTOLSWS()"
160160
class="btn btn-primary btn-lg">{% trans "Switch" %}</button>
161+
<button type="button" ng-click="switchTOLSWS()"
162+
class="btn btn-primary btn-lg">{% trans "Get 15 Days Trial" %}</button>
161163

162164
</div>
165+
<div class="col-sm-4">
166+
167+
168+
</div>
169+
</div>
170+
171+
<div class="form-group">
172+
<label class="col-sm-3 control-label"></label>
173+
<div class="col-sm-6">
174+
<div class="alert alert-info">
175+
<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>
176+
</div>
177+
</div>
178+
179+
163180
</div>
164181

165182
</form>

serverStatus/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,13 @@ def switchTOLSWS(request):
343343

344344
data = json.loads(request.body)
345345

346+
try:
347+
licenseKey = data['licenseKey']
348+
except:
349+
licenseKey = 'trial'
350+
346351
execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/serverStatus/serverStatusUtil.py"
347-
execPath = execPath + " switchTOLSWS --licenseKey " + data['licenseKey']
352+
execPath = execPath + " switchTOLSWS --licenseKey " + licenseKey
348353

349354
ProcessUtilities.popenExecutioner(execPath)
350355
time.sleep(2)

0 commit comments

Comments
 (0)