Release v2.0.0-beta: add NaiveProxy (Caddy + klzgrad/forwardproxy).
Installable marketplace protocol with ACME TLS, per-client basic auth, naive+https share links; bump panel version to 2.0 Beta. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -101,7 +101,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 = "v1.7.0"
|
||||
CURRENT_VERSION = "v2.0.0-beta"
|
||||
RELEASES_REPO_URL = "https://git.evilfox.cc/test2/Amnezia-Web-Panel-main"
|
||||
RELEASES_API_LATEST = "https://git.evilfox.cc/api/v1/repos/test2/Amnezia-Web-Panel-main/releases/latest"
|
||||
BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin'))
|
||||
@@ -843,7 +843,7 @@ async def wait_for_tunnel_url(provider: str, seconds: int = 20):
|
||||
return get_tunnel_status(provider)
|
||||
|
||||
|
||||
BASE_PROTOCOLS = ['awg', 'awg2', 'awg_legacy', 'xray', 'telemt', 'hysteria', 'dns', 'wireguard', 'socks5', 'adguard', 'nginx']
|
||||
BASE_PROTOCOLS = ['awg', 'awg2', 'awg_legacy', 'xray', 'telemt', 'hysteria', 'naiveproxy', 'dns', 'wireguard', 'socks5', 'adguard', 'nginx']
|
||||
MULTI_INSTANCE_PROTOCOLS = {'awg', 'awg2', 'awg_legacy', 'xray', 'telemt', 'hysteria', 'socks5'}
|
||||
|
||||
|
||||
@@ -885,6 +885,7 @@ def protocol_display_name(protocol: str) -> str:
|
||||
'xray': 'Xray',
|
||||
'telemt': 'Telemt',
|
||||
'hysteria': 'Hysteria 2',
|
||||
'naiveproxy': 'NaiveProxy',
|
||||
'dns': 'AmneziaDNS',
|
||||
'wireguard': 'WireGuard',
|
||||
'socks5': 'SOCKS5',
|
||||
@@ -905,6 +906,7 @@ def protocol_container_name(protocol: str) -> Optional[str]:
|
||||
'xray': 'amnezia-xray',
|
||||
'telemt': 'telemt',
|
||||
'hysteria': 'amnezia-hysteria',
|
||||
'naiveproxy': 'amnezia-naiveproxy',
|
||||
'dns': 'amnezia-dns',
|
||||
'wireguard': 'amnezia-wireguard',
|
||||
'socks5': 'amnezia-socks5proxy',
|
||||
@@ -947,6 +949,9 @@ def get_protocol_manager(ssh, protocol: str):
|
||||
elif base == 'hysteria':
|
||||
from managers.hysteria_manager import HysteriaManager
|
||||
return HysteriaManager(ssh, protocol)
|
||||
elif base == 'naiveproxy':
|
||||
from managers.naiveproxy_manager import NaiveProxyManager
|
||||
return NaiveProxyManager(ssh, protocol)
|
||||
from managers.awg_manager import AWGManager
|
||||
return AWGManager(ssh)
|
||||
|
||||
@@ -1008,7 +1013,7 @@ def _manager_call(manager, method, protocol, *args, **kwargs):
|
||||
|
||||
|
||||
# Protocols that own VPN clients (can list/link connections)
|
||||
CLIENT_VPN_BASES = {'awg', 'awg2', 'awg_legacy', 'xray', 'telemt', 'wireguard', 'hysteria', 'xui'}
|
||||
CLIENT_VPN_BASES = {'awg', 'awg2', 'awg_legacy', 'xray', 'telemt', 'wireguard', 'hysteria', 'naiveproxy', 'xui'}
|
||||
|
||||
|
||||
def generate_vpn_link(config_text):
|
||||
@@ -1718,6 +1723,9 @@ class InstallProtocolRequest(BaseModel):
|
||||
# Hysteria
|
||||
hysteria_domain: Optional[str] = None
|
||||
hysteria_email: Optional[str] = None
|
||||
# NaiveProxy
|
||||
naiveproxy_domain: Optional[str] = None
|
||||
naiveproxy_email: Optional[str] = None
|
||||
|
||||
|
||||
class Socks5SettingsRequest(BaseModel):
|
||||
@@ -2852,6 +2860,12 @@ async def api_check_server(request: Request, server_id: int):
|
||||
merged[key] = db_proto[key]
|
||||
if db_proto.get('port') and not merged.get('port'):
|
||||
merged['port'] = db_proto['port']
|
||||
if protocol_base(proto) == 'naiveproxy':
|
||||
for key in ('domain', 'email'):
|
||||
if db_proto.get(key) not in (None, '') and not merged.get(key):
|
||||
merged[key] = db_proto[key]
|
||||
if db_proto.get('port') and not merged.get('port'):
|
||||
merged['port'] = db_proto['port']
|
||||
return merged
|
||||
|
||||
def should_preserve_saved_protocol(proto, result=None, err=None):
|
||||
@@ -3010,6 +3024,13 @@ async def api_install_protocol(request: Request, server_id: int, req: InstallPro
|
||||
domain=req.hysteria_domain,
|
||||
email=req.hysteria_email,
|
||||
)
|
||||
elif install_base == 'naiveproxy':
|
||||
result = manager.install_protocol(
|
||||
protocol_type=install_protocol,
|
||||
port=req.port,
|
||||
domain=req.naiveproxy_domain,
|
||||
email=req.naiveproxy_email,
|
||||
)
|
||||
else:
|
||||
result = manager.install_protocol(install_protocol, port=req.port)
|
||||
|
||||
@@ -3048,6 +3069,17 @@ 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 == 'naiveproxy':
|
||||
info = server.setdefault('server_info', {})
|
||||
if req.naiveproxy_domain:
|
||||
info['ssl_domain'] = (req.naiveproxy_domain or '').strip().lower()
|
||||
if req.naiveproxy_email:
|
||||
info['ssl_email'] = (req.naiveproxy_email or '').strip()
|
||||
save_data(data)
|
||||
proto_record['domain'] = result.get('domain')
|
||||
proto_record['email'] = result.get('email')
|
||||
if result.get('port'):
|
||||
proto_record['port'] = str(result['port'])
|
||||
proto_record['base_protocol'] = install_base
|
||||
proto_record['instance'] = protocol_instance(install_protocol)
|
||||
proto_record['display_name'] = protocol_display_name(install_protocol)
|
||||
@@ -3233,6 +3265,7 @@ CONTAINER_NAMES = {
|
||||
'xray': 'amnezia-xray',
|
||||
'telemt': 'telemt',
|
||||
'hysteria': 'amnezia-hysteria',
|
||||
'naiveproxy': 'amnezia-naiveproxy',
|
||||
'dns': 'amnezia-dns',
|
||||
'wireguard': 'amnezia-wireguard',
|
||||
'socks5': 'amnezia-socks5proxy',
|
||||
@@ -3733,6 +3766,10 @@ async def api_server_config(request: Request, server_id: int, req: ProtocolReque
|
||||
from managers.hysteria_manager import HysteriaManager
|
||||
mgr = HysteriaManager(ssh, req.protocol)
|
||||
config = mgr.get_server_config(req.protocol)
|
||||
elif protocol_base(req.protocol) == 'naiveproxy':
|
||||
from managers.naiveproxy_manager import NaiveProxyManager
|
||||
mgr = NaiveProxyManager(ssh, req.protocol)
|
||||
config = mgr.get_server_config(req.protocol)
|
||||
else:
|
||||
mgr = AWGManager(ssh)
|
||||
config = mgr._get_server_config(req.protocol)
|
||||
@@ -3781,6 +3818,10 @@ async def api_server_config_save(request: Request, server_id: int, req: ServerCo
|
||||
from managers.hysteria_manager import HysteriaManager
|
||||
mgr = HysteriaManager(ssh, req.protocol)
|
||||
mgr.save_server_config(req.protocol, req.config)
|
||||
elif protocol_base(req.protocol) == 'naiveproxy':
|
||||
from managers.naiveproxy_manager import NaiveProxyManager
|
||||
mgr = NaiveProxyManager(ssh, req.protocol)
|
||||
mgr.save_server_config(req.protocol, req.config)
|
||||
else:
|
||||
mgr = AWGManager(ssh)
|
||||
mgr.save_server_config(req.protocol, req.config)
|
||||
|
||||
Reference in New Issue
Block a user