Skip to content

Commit

Permalink
Merge pull request #1155 from GoldenSwordLLC/stable
Browse files Browse the repository at this point in the history
Fix #842
  • Loading branch information
usmannasir authored Nov 22, 2023
2 parents 76be030 + 03d94d7 commit 589f87a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions cli/cyberPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ def listWebsitesJson(self):

websites = Websites.objects.all()
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)
ipData = f.read()
with open(ipFile, 'r') as f:
ipData = f.read()
ipAddress = ipData.split('\n', 1)[0]

json_data = "["
checker = 0
json_data = []

for items in websites:
if items.state == 0:
Expand All @@ -134,14 +133,8 @@ def listWebsitesJson(self):
state = "Active"
dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress,
'admin': items.admin.userName, 'package': items.package.packageName, 'state': state}
json_data.append(dic)

if checker == 0:
json_data = json_data + json.dumps(dic)
checker = 1
else:
json_data = json_data + ',' + json.dumps(dic)

json_data = json_data + ']'
final_json = json.dumps(json_data)
print(final_json)

Expand Down

0 comments on commit 589f87a

Please sign in to comment.