fix idendation issue

This commit is contained in:
usmannasir
2025-04-04 14:39:38 +05:00
parent 4018534fbb
commit 2a7b39c264
3 changed files with 140 additions and 2875 deletions

View File

@@ -2692,11 +2692,10 @@ app.controller('listWebsites', function ($scope, $http, $window) {
$scope.selectedWebsite = $scope.WebSitesList[index];
console.log('Selected website:', $scope.selectedWebsite);
// Always fetch fresh data
var url = '/websites/FetchWPdata';
// Call the new GetWPSitesByDomain endpoint
var url = '/websites/GetWPSitesByDomain';
var data = {
domain: $scope.selectedWebsite.domain,
websiteName: $scope.selectedWebsite.domain
domain: $scope.selectedWebsite.domain
};
$http({
@@ -2708,48 +2707,48 @@ app.controller('listWebsites', function ($scope, $http, $window) {
'X-CSRFToken': getCookie('csrftoken')
}
}).then(function(response) {
console.log('WP Details Response:', response);
// Check if response is HTML (login page)
if (typeof response.data === 'string' && response.data.includes('<!DOCTYPE html>')) {
console.log('Received HTML response, redirecting to login');
window.location.href = '/login';
return;
}
console.log('WP Sites Response:', response);
if (response.data && response.data.status === 1) {
try {
// If single site, wrap in array
var sites = Array.isArray(response.data.data) ? response.data.data : [response.data.data];
// Display the data in an alert
var wpSites = response.data.data;
var alertMessage = 'WordPress Sites for ' + $scope.selectedWebsite.domain + ':\n\n';
$scope.selectedWebsite.wp_sites = sites.map(function(site) {
return {
id: site.id || $scope.selectedWebsite.domain,
title: site.title || site.domain || $scope.selectedWebsite.domain,
url: site.url || 'http://' + $scope.selectedWebsite.domain,
version: site.version || 'Unknown',
phpVersion: site.php_version || 'Unknown',
theme: site.theme || 'Unknown',
activePlugins: site.active_plugins || 0,
searchIndex: site.search_index === 'enabled',
debugging: site.debugging === 'enabled',
passwordProtection: site.password_protection === 'enabled',
maintenanceMode: site.maintenance_mode === 'enabled'
};
wpSites.forEach(function(site, index) {
alertMessage += 'Site ' + (index + 1) + ':\n';
alertMessage += 'Title: ' + site.title + '\n';
alertMessage += 'URL: ' + site.url + '\n';
alertMessage += 'Version: ' + site.version + '\n';
alertMessage += 'PHP Version: ' + site.phpVersion + '\n';
alertMessage += 'Active Plugins: ' + site.activePlugins + '\n';
alertMessage += 'Theme: ' + site.theme + '\n';
alertMessage += 'Debugging: ' + (site.debugging ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Search Index: ' + (site.searchIndex ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Maintenance Mode: ' + (site.maintenanceMode ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Password Protection: ' + (site.passwordProtection ? 'Enabled' : 'Disabled') + '\n\n';
});
alert(alertMessage);
// Update the UI with the data
$scope.selectedWebsite.wp_sites = wpSites;
$scope.selectedWebsite.showWPSites = true;
} catch (e) {
console.error('Error processing WordPress data:', e);
alert('Error processing WordPress data: ' + e.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
} else {
console.error('Error fetching WordPress sites:', response.data.error_message);
alert('Error fetching WordPress sites: ' + response.data.error_message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
}, function(error) {
console.error('Error fetching WordPress sites:', error);
alert('Error fetching WordPress sites: ' + error.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
});
@@ -8247,11 +8246,10 @@ app.controller('listWebsites', function ($scope, $http, $window) {
$scope.selectedWebsite = $scope.WebSitesList[index];
console.log('Selected website:', $scope.selectedWebsite);
// Always fetch fresh data
var url = '/websites/FetchWPdata';
// Call the new GetWPSitesByDomain endpoint
var url = '/websites/GetWPSitesByDomain';
var data = {
domain: $scope.selectedWebsite.domain,
websiteName: $scope.selectedWebsite.domain
domain: $scope.selectedWebsite.domain
};
$http({
@@ -8263,48 +8261,48 @@ app.controller('listWebsites', function ($scope, $http, $window) {
'X-CSRFToken': getCookie('csrftoken')
}
}).then(function(response) {
console.log('WP Details Response:', response);
// Check if response is HTML (login page)
if (typeof response.data === 'string' && response.data.includes('<!DOCTYPE html>')) {
console.log('Received HTML response, redirecting to login');
window.location.href = '/login';
return;
}
console.log('WP Sites Response:', response);
if (response.data && response.data.status === 1) {
try {
// If single site, wrap in array
var sites = Array.isArray(response.data.data) ? response.data.data : [response.data.data];
// Display the data in an alert
var wpSites = response.data.data;
var alertMessage = 'WordPress Sites for ' + $scope.selectedWebsite.domain + ':\n\n';
$scope.selectedWebsite.wp_sites = sites.map(function(site) {
return {
id: site.id || $scope.selectedWebsite.domain,
title: site.title || site.domain || $scope.selectedWebsite.domain,
url: site.url || 'http://' + $scope.selectedWebsite.domain,
version: site.version || 'Unknown',
phpVersion: site.php_version || 'Unknown',
theme: site.theme || 'Unknown',
activePlugins: site.active_plugins || 0,
searchIndex: site.search_index === 'enabled',
debugging: site.debugging === 'enabled',
passwordProtection: site.password_protection === 'enabled',
maintenanceMode: site.maintenance_mode === 'enabled'
};
wpSites.forEach(function(site, index) {
alertMessage += 'Site ' + (index + 1) + ':\n';
alertMessage += 'Title: ' + site.title + '\n';
alertMessage += 'URL: ' + site.url + '\n';
alertMessage += 'Version: ' + site.version + '\n';
alertMessage += 'PHP Version: ' + site.phpVersion + '\n';
alertMessage += 'Active Plugins: ' + site.activePlugins + '\n';
alertMessage += 'Theme: ' + site.theme + '\n';
alertMessage += 'Debugging: ' + (site.debugging ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Search Index: ' + (site.searchIndex ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Maintenance Mode: ' + (site.maintenanceMode ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Password Protection: ' + (site.passwordProtection ? 'Enabled' : 'Disabled') + '\n\n';
});
alert(alertMessage);
// Update the UI with the data
$scope.selectedWebsite.wp_sites = wpSites;
$scope.selectedWebsite.showWPSites = true;
} catch (e) {
console.error('Error processing WordPress data:', e);
alert('Error processing WordPress data: ' + e.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
} else {
console.error('Error fetching WordPress sites:', response.data.error_message);
alert('Error fetching WordPress sites: ' + response.data.error_message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
}, function(error) {
console.error('Error fetching WordPress sites:', error);
alert('Error fetching WordPress sites: ' + error.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
});
@@ -12184,11 +12182,10 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind
$scope.selectedWebsite = $scope.WebSitesList[index];
console.log('Selected website:', $scope.selectedWebsite);
// Always fetch fresh data
var url = '/websites/FetchWPdata';
// Call the new GetWPSitesByDomain endpoint
var url = '/websites/GetWPSitesByDomain';
var data = {
domain: $scope.selectedWebsite.domain,
websiteName: $scope.selectedWebsite.domain
domain: $scope.selectedWebsite.domain
};
$http({
@@ -12200,48 +12197,48 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind
'X-CSRFToken': getCookie('csrftoken')
}
}).then(function(response) {
console.log('WP Details Response:', response);
// Check if response is HTML (login page)
if (typeof response.data === 'string' && response.data.includes('<!DOCTYPE html>')) {
console.log('Received HTML response, redirecting to login');
window.location.href = '/login';
return;
}
console.log('WP Sites Response:', response);
if (response.data && response.data.status === 1) {
try {
// If single site, wrap in array
var sites = Array.isArray(response.data.data) ? response.data.data : [response.data.data];
// Display the data in an alert
var wpSites = response.data.data;
var alertMessage = 'WordPress Sites for ' + $scope.selectedWebsite.domain + ':\n\n';
$scope.selectedWebsite.wp_sites = sites.map(function(site) {
return {
id: site.id || $scope.selectedWebsite.domain,
title: site.title || site.domain || $scope.selectedWebsite.domain,
url: site.url || 'http://' + $scope.selectedWebsite.domain,
version: site.version || 'Unknown',
phpVersion: site.php_version || 'Unknown',
theme: site.theme || 'Unknown',
activePlugins: site.active_plugins || 0,
searchIndex: site.search_index === 'enabled',
debugging: site.debugging === 'enabled',
passwordProtection: site.password_protection === 'enabled',
maintenanceMode: site.maintenance_mode === 'enabled'
};
wpSites.forEach(function(site, index) {
alertMessage += 'Site ' + (index + 1) + ':\n';
alertMessage += 'Title: ' + site.title + '\n';
alertMessage += 'URL: ' + site.url + '\n';
alertMessage += 'Version: ' + site.version + '\n';
alertMessage += 'PHP Version: ' + site.phpVersion + '\n';
alertMessage += 'Active Plugins: ' + site.activePlugins + '\n';
alertMessage += 'Theme: ' + site.theme + '\n';
alertMessage += 'Debugging: ' + (site.debugging ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Search Index: ' + (site.searchIndex ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Maintenance Mode: ' + (site.maintenanceMode ? 'Enabled' : 'Disabled') + '\n';
alertMessage += 'Password Protection: ' + (site.passwordProtection ? 'Enabled' : 'Disabled') + '\n\n';
});
alert(alertMessage);
// Update the UI with the data
$scope.selectedWebsite.wp_sites = wpSites;
$scope.selectedWebsite.showWPSites = true;
} catch (e) {
console.error('Error processing WordPress data:', e);
alert('Error processing WordPress data: ' + e.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
} else {
console.error('Error fetching WordPress sites:', response.data.error_message);
alert('Error fetching WordPress sites: ' + response.data.error_message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
}
}, function(error) {
console.error('Error fetching WordPress sites:', error);
alert('Error fetching WordPress sites: ' + error.message);
$scope.selectedWebsite.showWPSites = false;
$scope.selectedWebsite.wp_sites = [];
});

View File

@@ -111,44 +111,41 @@
<!-- WordPress Sites Section -->
<div class="col-md-12" ng-if="web.showWPSites && web.wp_sites && web.wp_sites.length > 0">
<div ng-repeat="wp in web.wp_sites" style="margin: 15px 0; padding: 20px; background: white; border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
<div ng-repeat="wp in web.wp_sites" style="margin: 15px 0; padding: 20px; background: white; border: 1px solid #ddd; border-radius: 4px;">
<div class="row">
<div class="col-md-6">
<h3 style="margin-top: 0; font-size: 18px; color: #333;" ng-bind="wp.title"></h3>
<span style="font-size: 16px;" ng-bind="wp.title"></span>
</div>
<div class="col-md-6 text-right">
<button class="btn btn-default" style="margin-right: 5px;" ng-click="visitSite(wp.url)">
<i class="fa fa-external-link"></i> Visit Site
</button>
<button class="btn btn-info" style="margin-right: 5px;" ng-click="wpLogin(wp.id)">
<i class="fa fa-wordpress"></i> WP Login
</button>
<button class="btn btn-default btn-sm" style="margin-right: 5px;" ng-click="visitSite(wp.url)">Visit Site</button>
<button class="btn btn-default btn-sm" style="margin-right: 5px;" ng-click="wpLogin(wp.id)">WP Login</button>
<button class="btn btn-primary btn-sm" ng-click="manageWP(wp.id)">MANAGE</button>
</div>
</div>
<div class="row" style="margin-top: 20px;">
<div class="row" style="margin-top: 30px;">
<div class="col-md-3">
<div style="border-top: 1px solid #eee; padding-top: 15px;">
<div style="border-top: 1px solid #ddd; padding-top: 15px;">
<div style="color: #666; font-size: 12px; margin-bottom: 5px;">WordPress</div>
<div style="font-size: 16px; color: #333;" ng-bind="wp.version"></div>
<div ng-bind="wp.version || 'Unknown'"></div>
</div>
</div>
<div class="col-md-3">
<div style="border-top: 1px solid #eee; padding-top: 15px;">
<div style="border-top: 1px solid #ddd; padding-top: 15px;">
<div style="color: #666; font-size: 12px; margin-bottom: 5px;">PHP Version</div>
<div style="font-size: 16px; color: #333;">PHP {$ wp.phpVersion $}</div>
<div ng-bind="wp.phpVersion || 'Unknown'"></div>
</div>
</div>
<div class="col-md-3">
<div style="border-top: 1px solid #eee; padding-top: 15px;">
<div style="border-top: 1px solid #ddd; padding-top: 15px;">
<div style="color: #666; font-size: 12px; margin-bottom: 5px;">Theme</div>
<div style="font-size: 16px; color: #333;" ng-bind="wp.theme"></div>
<div ng-bind="wp.theme || 'Unknown'"></div>
</div>
</div>
<div class="col-md-3">
<div style="border-top: 1px solid #eee; padding-top: 15px;">
<div style="border-top: 1px solid #ddd; padding-top: 15px;">
<div style="color: #666; font-size: 12px; margin-bottom: 5px;">Plugins</div>
<div style="font-size: 16px; color: #333;">{$ wp.activePlugins $} active</div>
<div>{$ wp.activePlugins || '0' $} active</div>
</div>
</div>
</div>
@@ -156,21 +153,21 @@
<div class="row" style="margin-top: 20px;">
<div class="col-md-6">
<div style="margin-bottom: 10px;">
<input type="checkbox" ng-model="wp.searchIndex" ng-change="updateSetting(wp.id, 'search-indexing', wp.searchIndex)" style="margin-right: 5px;">
<input type="checkbox" ng-model="wp.searchIndex" ng-change="updateSetting(wp, 'search-indexing')" style="margin-right: 5px;">
<span style="color: #666;">Search engine indexing</span>
</div>
<div>
<input type="checkbox" ng-model="wp.debugging" ng-change="updateSetting(wp.id, 'debugging', wp.debugging)" style="margin-right: 5px;">
<input type="checkbox" ng-model="wp.debugging" ng-change="updateSetting(wp, 'debugging')" style="margin-right: 5px;">
<span style="color: #666;">Debugging</span>
</div>
</div>
<div class="col-md-6">
<div style="margin-bottom: 10px;">
<input type="checkbox" ng-model="wp.passwordProtection" ng-change="updateSetting(wp.id, 'password-protection', wp.passwordProtection)" style="margin-right: 5px;">
<input type="checkbox" ng-model="wp.passwordProtection" ng-change="updateSetting(wp, 'password-protection')" style="margin-right: 5px;">
<span style="color: #666;">Password protection</span>
</div>
<div>
<input type="checkbox" ng-model="wp.maintenanceMode" ng-change="updateSetting(wp.id, 'maintenance-mode', wp.maintenanceMode)" style="margin-right: 5px;">
<input type="checkbox" ng-model="wp.maintenanceMode" ng-change="updateSetting(wp, 'maintenance-mode')" style="margin-right: 5px;">
<span style="color: #666;">Maintenance mode</span>
</div>
</div>

File diff suppressed because it is too large Load Diff