Enhance CyberPanel functionality with FTP Quota and Bandwidth Management features: Added models, views, and templates for managing FTP quotas and bandwidth resets. Implemented IP blocking functionality with associated views and templates. Updated system scripts for improved repository synchronization and OS detection. Removed outdated workflow files.

This commit is contained in:
Master3395
2025-09-23 21:09:38 +02:00
parent 11991c0f80
commit 2c57ad595e
23 changed files with 2278 additions and 903 deletions

70
cli/repositorySync.py Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/local/CyberCP/bin/python
import os
import sys
import argparse
# Add CyberPanel to Python path
sys.path.append('/usr/local/CyberCP')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
import django
django.setup()
from repositorySync.repositorySyncManager import RepositorySyncManager
from plogical.upgrade import Upgrade
def main():
parser = argparse.ArgumentParser(description='CyberPanel Repository Sync Tool')
parser.add_argument('--force', action='store_true', help='Force sync even if conflicts exist')
parser.add_argument('--status', action='store_true', help='Show sync status')
parser.add_argument('--sync', action='store_true', help='Perform repository sync')
args = parser.parse_args()
if args.status:
# Show sync status
try:
status = Upgrade.getRepositorySyncStatus()
print("Repository Sync Status:")
print(f"Last Sync: {status.get('last_sync', 'Never')}")
print(f"Branches Synced: {status.get('branches_synced', [])}")
print(f"Tags Synced: {status.get('tags_synced', False)}")
if 'errors' in status:
print(f"Errors: {status['errors']}")
except Exception as e:
print(f"Error getting status: {str(e)}")
sys.exit(1)
elif args.sync:
# Perform sync
try:
print("Starting repository synchronization...")
success, message = Upgrade.syncRepositoryToGitee(force_sync=args.force)
if success:
print(f"{message}")
sys.exit(0)
else:
print(f"{message}")
sys.exit(1)
except Exception as e:
print(f"Error during sync: {str(e)}")
sys.exit(1)
else:
# Default action - perform sync
try:
print("Starting repository synchronization...")
success, message = Upgrade.syncRepositoryToGitee(force_sync=args.force)
if success:
print(f"{message}")
sys.exit(0)
else:
print(f"{message}")
sys.exit(1)
except Exception as e:
print(f"Error during sync: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()