-
-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] "cyberpanel listWebsitesJson" requires json.loads() to be ran twice to get compliant JSON #842
Comments
Looks like this has been fixed. Not sure what commit did this, but thanks regardless. |
Correction, this has not been fixed. |
Since I've gotten no input on this at all, here's the fix for this. I'll also send a PR for this as well. def listWebsitesJson(self):
try:
websites = Websites.objects.all()
ipFile = "/etc/cyberpanel/machineIP"
with open(ipFile, 'r') as f:
ipData = f.read()
ipAddress = ipData.split('\n', 1)[0]
json_data = []
for items in websites:
if items.state == 0:
state = "Suspended"
else:
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)
final_json = json.dumps(json_data)
print(final_json)
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print(0) |
#1155 has been created for this. |
usmannasir
added a commit
that referenced
this issue
Nov 22, 2023
This has been fixed in #1155 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
"cyberpanel listWebsitesJson" requires json.loads() to be ran twice to get compliant JSON
NOTE: Do not include any personal or sensitive information, such as email addresses or passwords.
To Reproduce
Run the following Python:
You'll see that json.loads() needs to be ran twice rather than once.
Expected behavior
Only one json.loads() to be needed
Screenshots
If applicable, add screenshots to help explain your problem.
Not needed
Operating system:
Please enter your answer here (e.g. Ubuntu 20.04 LTS)
Ubuntu 20.04 LTS
CyberPanel version:
Please enter your answer here (e.g. 2.1.1).
"cyberpanel version" says 2.1.1
Additional context
No additional context
The text was updated successfully, but these errors were encountered: