Files
OutFleet/vpn/views.py

25 lines
770 B
Python
Raw Normal View History

2024-10-20 21:57:12 +00:00
from django.shortcuts import get_object_or_404
from django.http import JsonResponse
def shadowsocks(request, link):
from .models import ACL
acl = get_object_or_404(ACL, link=link)
2024-10-21 13:22:03 +00:00
try:
server_user = acl.server.get_user(acl.user, raw=True)
2024-10-26 12:22:19 +00:00
except Exception as e:
return JsonResponse({"error": f"Couldn't get credentials from server. {e}"})
2024-10-21 13:22:03 +00:00
2024-10-20 21:57:12 +00:00
config = {
"info": "Managed by OutFleet_v2 [github.com/house-of-vanity/OutFleet/]",
"password": server_user.password,
"method": server_user.method,
"prefix": "\u0005\u00dc_\u00e0\u0001",
2024-10-26 12:38:50 +00:00
"server": acl.server.client_hostname,
2024-10-20 21:57:12 +00:00
"server_port": server_user.port,
"access_url": server_user.access_url,
}
return JsonResponse(config)