mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 22:36:12 +01:00
Add RESTful API support for listing child domains: Implement listChildDomainsJson endpoint in the API, allowing users to retrieve child domain details with authentication. Update README to document the new API functionality and usage examples. Remove obsolete utility scripts for Windows and Linux to streamline the project.
https://github.com/usmannasir/cyberpanel/issues/1120
This commit is contained in:
@@ -142,6 +142,27 @@ class cyberPanel:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print(0)
|
||||
|
||||
def listChildDomainsJson(self):
|
||||
try:
|
||||
child_domains = ChildDomains.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 child_domains:
|
||||
dic = {'parent_site': items.master.domain,
|
||||
'domain': items.domain,
|
||||
'path': items.path,
|
||||
'ssl': items.ssl,
|
||||
'php_version': items.phpSelection}
|
||||
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)
|
||||
|
||||
def listWebsitesPretty(self):
|
||||
try:
|
||||
from prettytable import PrettyTable
|
||||
|
||||
Reference in New Issue
Block a user