fix fetchWPSitesForDomain

This commit is contained in:
usmannasir
2025-04-04 17:32:10 +05:00
parent bf30efa638
commit 6240437d87
2 changed files with 29 additions and 3 deletions

View File

@@ -2689,7 +2689,19 @@ app.controller('listWebsites', function ($scope, $http, $window) {
'X-CSRFToken': getCookie('csrftoken')
}
}).then(function(response) {
alert(JSON.stringify(response.data, null, 2));
if (response.data.status === 1) {
var sites = response.data.sites;
var message = 'WordPress Sites for ' + domain + ':\n\n';
sites.forEach(function(site) {
message += 'Title: ' + site.title + '\n';
message += 'URL: ' + site.url + '\n';
message += 'Version: ' + site.version + '\n';
message += 'Status: ' + site.status + '\n\n';
});
alert(message);
} else {
alert('Error: ' + response.data.error_message);
}
}).catch(function(error) {
alert('Error fetching WordPress sites: ' + JSON.stringify(error));
});
@@ -6577,7 +6589,19 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind
'X-CSRFToken': getCookie('csrftoken')
}
}).then(function(response) {
alert(JSON.stringify(response.data, null, 2));
if (response.data.status === 1) {
var sites = response.data.sites;
var message = 'WordPress Sites for ' + domain + ':\n\n';
sites.forEach(function(site) {
message += 'Title: ' + site.title + '\n';
message += 'URL: ' + site.url + '\n';
message += 'Version: ' + site.version + '\n';
message += 'Status: ' + site.status + '\n\n';
});
alert(message);
} else {
alert('Error: ' + response.data.error_message);
}
}).catch(function(error) {
alert('Error fetching WordPress sites: ' + JSON.stringify(error));
});

View File

@@ -1846,7 +1846,9 @@ def Dockersitehome(request, dockerapp):
def fetchWPDetails(request):
try:
userID = request.session['userID']
data = json.loads(request.body)
data = {
'domain': request.POST.get('domain')
}
wm = WebsiteManager()
return wm.fetchWPSitesForDomain(userID, data)
except KeyError: