Merge pull request #1155 from GoldenSwordLLC/stable

Fix https://github.com/usmannasir/cyberpanel/issues/842
This commit is contained in:
Usman Nasir 2023-11-22 08:32:55 +04:00 committed by GitHub
commit 589f87aeb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 11 deletions

View File

@ -120,12 +120,11 @@ class cyberPanel:
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:
@ -134,14 +133,8 @@ class cyberPanel:
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)