cyberpanel
cyberpanel copied to clipboard
[FEATURE] listChildDomainsJson
An ability to listChildDomainsJson
through CyberPanel's API much like listWebsitesJson
would be great.
ChildDomains
in websiteFunctions/models.py
already gives this information and would be easy enough to get, like how listWebsitesJson
works
This is more or less what this will be. Just need to setup a PR:
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)
@usmannasir
Would it be acceptable if I did args.function = args.function.casefold()
, so upper/lowercase doesn't matter when typing a function?