mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-07-07 01:24:06 +00:00
Added keys count on outline page.
This commit is contained in:
@ -17,11 +17,12 @@ Including another URLconf
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
from vpn.views import shadowsocks
|
from vpn.views import shadowsocks, print_headers
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('ss/<path:link>', shadowsocks, name='shadowsocks'),
|
path('ss/<path:link>', shadowsocks, name='shadowsocks'),
|
||||||
path('dynamic/<path:link>', shadowsocks, name='shadowsocks'),
|
path('dynamic/<path:link>', shadowsocks, name='shadowsocks'),
|
||||||
|
path('headers/', print_headers, name='print_headers'),
|
||||||
path('', RedirectView.as_view(url='/admin/', permanent=False)),
|
path('', RedirectView.as_view(url='/admin/', permanent=False)),
|
||||||
]
|
]
|
@ -33,7 +33,6 @@ class ServerAdmin(PolymorphicParentModelAdmin):
|
|||||||
status = obj.get_server_status()
|
status = obj.get_server_status()
|
||||||
if 'error' in status:
|
if 'error' in status:
|
||||||
return mark_safe(f"<span style='color: red;'>Error: {status['error']}</span>")
|
return mark_safe(f"<span style='color: red;'>Error: {status['error']}</span>")
|
||||||
# Преобразуем JSON в красивый формат
|
|
||||||
import json
|
import json
|
||||||
pretty_status = ", ".join(f"{key}: {value}" for key, value in status.items())
|
pretty_status = ", ".join(f"{key}: {value}" for key, value in status.items())
|
||||||
return mark_safe(f"<pre>{pretty_status}</pre>")
|
return mark_safe(f"<pre>{pretty_status}</pre>")
|
||||||
|
@ -73,7 +73,9 @@ class OutlineServer(Server):
|
|||||||
if raw:
|
if raw:
|
||||||
status = info
|
status = info
|
||||||
else:
|
else:
|
||||||
|
keys = self.client.get_keys()
|
||||||
status.update(info)
|
status.update(info)
|
||||||
|
status.update({"keys": len(keys)})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
status.update({f"error": e})
|
status.update({f"error": e})
|
||||||
return status
|
return status
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
def print_headers(request):
|
||||||
|
headers = {key: value for key, value in request.META.items() if key.startswith('HTTP_')}
|
||||||
|
|
||||||
|
for key, value in headers.items():
|
||||||
|
print(f'{key}: {value}')
|
||||||
|
|
||||||
|
return HttpResponse(f"Headers: {headers}")
|
||||||
|
|
||||||
def shadowsocks(request, link):
|
def shadowsocks(request, link):
|
||||||
from .models import ACL
|
from .models import ACL
|
||||||
|
Reference in New Issue
Block a user