From 75033231f28eb4056de95a1d15ea12beee1c4a83 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Tue, 12 Aug 2025 23:36:22 +0330 Subject: [PATCH] feat: Integrate unlimited IP functionality into web panel --- core/scripts/webpanel/routers/api/v1/user.py | 4 ++-- core/scripts/webpanel/routers/user/viewmodel.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/scripts/webpanel/routers/api/v1/user.py b/core/scripts/webpanel/routers/api/v1/user.py index e55e595..63f262e 100644 --- a/core/scripts/webpanel/routers/api/v1/user.py +++ b/core/scripts/webpanel/routers/api/v1/user.py @@ -39,7 +39,7 @@ async def add_user_api(body: AddUserInputBody): detail=f"{str(e)}") try: - cli_api.add_user(body.username, body.traffic_limit, body.expiration_days, body.password, body.creation_date) + cli_api.add_user(body.username, body.traffic_limit, body.expiration_days, body.password, body.creation_date, body.unlimited) return DetailResponse(detail=f'User {body.username} has been added.') except cli_api.CommandExecutionError as e: if "User already exists" in str(e): @@ -98,7 +98,7 @@ async def edit_user_api(username: str, body: EditUserInputBody): cli_api.kick_user_by_name(username) cli_api.traffic_status(display_output=False) cli_api.edit_user(username, body.new_username, body.new_traffic_limit, body.new_expiration_days, - body.renew_password, body.renew_creation_date, body.blocked) + body.renew_password, body.renew_creation_date, body.blocked, body.unlimited_ip) return DetailResponse(detail=f'User {username} has been edited.') except Exception as e: raise HTTPException(status_code=400, detail=f'Error: {str(e)}') diff --git a/core/scripts/webpanel/routers/user/viewmodel.py b/core/scripts/webpanel/routers/user/viewmodel.py index f042835..121410b 100644 --- a/core/scripts/webpanel/routers/user/viewmodel.py +++ b/core/scripts/webpanel/routers/user/viewmodel.py @@ -10,6 +10,7 @@ class User(BaseModel): expiry_date: str expiry_days: str enable: bool + unlimited_ip: bool @staticmethod def from_dict(username: str, user_data: dict): @@ -58,6 +59,7 @@ class User(BaseModel): 'expiry_date': display_expiry_date, 'expiry_days': display_expiry_days, 'enable': not user_data.get('blocked', False), + 'unlimited_ip': user_data.get('unlimited_user', False) } @staticmethod