Switch Xray to VLESS+XHTTP+TLS with Cloudflare DNS ACME (v3.1.1).

Issue Let's Encrypt via Cloudflare API token so install no longer needs port 80; keep HTTP-01 as fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
orohimaru2
2026-08-09 19:01:52 +03:00
co-authored by Cursor
parent 3ea638d9c5
commit 4720d8f2bd
11 changed files with 573 additions and 153 deletions
+27 -2
View File
@@ -103,7 +103,7 @@ else:
application_path = os.path.dirname(__file__)
DATA_FILE = os.path.join(application_path, 'data.json') # legacy JSON; used only for one-shot import / export
CURRENT_VERSION = "v3.0.1"
CURRENT_VERSION = "v3.1.1"
RELEASES_REPO_URL = repo_url()
RELEASES_API_LATEST = api_latest_url()
BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin'))
@@ -2225,6 +2225,11 @@ class InstallProtocolRequest(BaseModel):
# NaiveProxy
naiveproxy_domain: Optional[str] = None
naiveproxy_email: Optional[str] = None
# Xray (VLESS + XHTTP + TLS)
xray_domain: Optional[str] = None
xray_email: Optional[str] = None
xray_acme_method: Optional[str] = 'cloudflare' # cloudflare | http
xray_cf_token: Optional[str] = None
class Socks5SettingsRequest(BaseModel):
@@ -3708,7 +3713,13 @@ async def api_install_protocol(request: Request, server_id: int, req: InstallPro
max_connections=req.max_connections if req.max_connections is not None else 0
)
elif install_base == 'xray':
result = manager.install_protocol(port=req.port)
result = manager.install_protocol(
port=req.port,
domain=req.xray_domain,
email=req.xray_email,
acme_method=req.xray_acme_method or 'cloudflare',
cloudflare_token=req.xray_cf_token,
)
elif install_base == 'wireguard':
result = manager.install_protocol(port=req.port)
elif install_base == 'socks5':
@@ -3795,6 +3806,20 @@ async def api_install_protocol(request: Request, server_id: int, req: InstallPro
proto_record['email'] = result.get('email')
if result.get('port'):
proto_record['port'] = str(result['port'])
if install_base == 'xray':
info = server.setdefault('server_info', {})
if req.xray_domain:
info['ssl_domain'] = (req.xray_domain or '').strip().lower()
if req.xray_email:
info['ssl_email'] = (req.xray_email or '').strip()
save_data(data)
proto_record['domain'] = result.get('domain')
proto_record['path'] = result.get('path')
proto_record['transport'] = 'xhttp'
proto_record['security'] = 'tls'
proto_record['acme_method'] = result.get('acme_method') or req.xray_acme_method or 'cloudflare'
if result.get('port'):
proto_record['port'] = str(result['port'])
if install_base == 'naiveproxy':
info = server.setdefault('server_info', {})
if req.naiveproxy_domain: