mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-07-06 17:14:07 +00:00
Fix
This commit is contained in:
@ -21,7 +21,7 @@ from vpn.views import shadowsocks
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('ss/<str:link>', shadowsocks, name='shadowsocks'),
|
||||
path('dynamic/<str:link>', shadowsocks, name='shadowsocks'),
|
||||
path('ss/<path:link>', shadowsocks, name='shadowsocks'),
|
||||
path('dynamic/<path:link>', shadowsocks, name='shadowsocks'),
|
||||
path('', RedirectView.as_view(url='/admin/', permanent=False)),
|
||||
]
|
@ -48,8 +48,8 @@ class ACL(models.Model):
|
||||
|
||||
@receiver(post_save, sender=ACL)
|
||||
def acl_created_or_updated(sender, instance, created, **kwargs):
|
||||
sync_user.delay_on_commit(instance.user, instance.server.id)
|
||||
sync_user.delay_on_commit(instance.user.id, instance.server.id)
|
||||
|
||||
@receiver(pre_delete, sender=ACL)
|
||||
def acl_deleted(sender, instance, **kwargs):
|
||||
sync_user.delay_on_commit(instance.user, instance.server.id)
|
||||
sync_user.delay_on_commit(instance.user.id, instance.server.id)
|
@ -47,12 +47,13 @@ def sync_server(id):
|
||||
return {"status": Server.objects.get(id=id).sync()}
|
||||
|
||||
@shared_task(name="sync_user_on_server")
|
||||
def sync_user(user, server_id):
|
||||
def sync_user(user_id, server_id):
|
||||
from .models import User, ACL
|
||||
from vpn.server_plugins import Server
|
||||
|
||||
errors = {}
|
||||
result = {}
|
||||
user = User.objects.get(id=user_id)
|
||||
acls = ACL.objects.filter(user=user)
|
||||
|
||||
server = Server.objects.get(id=server_id)
|
||||
|
@ -7,8 +7,8 @@ def shadowsocks(request, link):
|
||||
acl = get_object_or_404(ACL, link=link)
|
||||
try:
|
||||
server_user = acl.server.get_user(acl.user, raw=True)
|
||||
except:
|
||||
return JsonResponse({"error": "Couldn't get credentials from server."})
|
||||
except Exception as e:
|
||||
return JsonResponse({"error": f"Couldn't get credentials from server. {e}"})
|
||||
|
||||
config = {
|
||||
"info": "Managed by OutFleet_v2 [github.com/house-of-vanity/OutFleet/]",
|
||||
|
Reference in New Issue
Block a user