Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API bug: expiry date in POST /api/user/ #1675

Open
optcond opened this issue Feb 21, 2025 · 3 comments
Open

API bug: expiry date in POST /api/user/ #1675

optcond opened this issue Feb 21, 2025 · 3 comments

Comments

@optcond
Copy link

optcond commented Feb 21, 2025

Describe the bug
If a user is created with "expiry" bad UTC timestamp (in my case it was milliseconds instead of seconds), fetching the users becomes impossible. Even CLI crashes.

To Reproduce

{
   "status": "active",
   "username": "test",
   "note": "",
   "proxies": {
     "vless": {
       "flow": "xtls-rprx-vision"
     }
   },
   "data_limit": 0,
   "expire": 17474292000, <- correct format; "1747429200000" incorrect format with milliseconds
   "data_limit_reset_strategy": "no_reset",
   "inbounds": {
     "vless": [
       "vless-tcp"
     ]
   }
 }

Error from command line:

│ /code/cli/user.py:49 in list_users
│
│   46 │   │   │   │   │   readable_size(user.used_traffic),
│   47 │   │   │   │   │   readable_size(user.data_limit) if user.data_limit else "Unlimited", 
│   48 │   │   │   │   │   user.data_limit_reset_strategy.value,
│ ❱ 49 │   │   │   │   │   utils.readable_datetime(user.expire, include_time=False),
│   50 │   │   │   │   │   user.admin.username if user.admin else ''
│   51 │   │   │   │   ) 
│   52 │   │   │   │   for user in users `
│ /code/cli/utils.py:85 in readable_datetime 
│
│   82 │   │   return dt_format
│   83 │
│   84 │   if isinstance(date_time, int):
│ ❱ 85 │   │   date_time = datetime.fromtimestamp(date_time)  
│   86 │
│   87 │   return date_time.strftime(get_datetime_format()) if date_time else "-"  
│   88      
@M03ED
Copy link
Collaborator

M03ED commented Feb 21, 2025

this problem gonna be solved with v1 as we replaced timestamp with datetime

@janahnovin
Copy link

this problem gonna be solved with v1 as we replaced timestamp with datetime

I have the same problem, exactly in which version the problem is solved? Do you mean to go back to version 8.1?

@optcond
Copy link
Author

optcond commented Feb 23, 2025

@janahnovin

gonna be solved

as per the developer reply an upgrade is upcoming.

In case you need a temporary swift solution, just comment\fix the marzban cli python code in the original message and remove\recreate the problematic users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants