Xray works. fixed certs.

This commit is contained in:
AB from home.homenet
2025-08-08 06:50:04 +03:00
parent 787432cbcf
commit fe56811b33
10 changed files with 661 additions and 120 deletions

View File

@@ -2,7 +2,7 @@ import logging
from django.db import models
from django.contrib import admin
from .generic import Server
from vpn.models_xray import XrayConfiguration, Inbound, UserSubscription
from vpn.models_xray import Inbound, UserSubscription
logger = logging.getLogger(__name__)
@@ -151,17 +151,16 @@ class XrayServerV2(Server):
logger.error(f"Failed to schedule user sync for server {self.name}: {e}")
return {"status": "failed", "error": str(e)}
def sync_inbounds(self):
def sync_inbounds(self, auto_sync_users=True):
"""Deploy all required inbounds on this server based on subscription groups"""
try:
from vpn.tasks import sync_server_inbounds
task = sync_server_inbounds.delay(self.id)
task = sync_server_inbounds.delay(self.id, auto_sync_users)
logger.info(f"Scheduled inbound sync for Xray server {self.name} - task ID: {task.id}")
# Return None to match old behavior
return None
return {"task_id": str(task.id), "auto_sync_users": auto_sync_users}
except Exception as e:
logger.error(f"Failed to schedule inbound sync for server {self.name}: {e}")
return None
return {"error": str(e)}
def deploy_inbound(self, inbound, users=None):
"""Deploy a specific inbound on this server with optional users"""