Skip to content

Commit

Permalink
fix: allow user.inbounds to be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Dec 20, 2023
1 parent dcce254 commit 3834a2f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ def validate_inbounds(cls, inbounds, values, **kwargs):
for proxy_type in proxies:
tags = inbounds.get(proxy_type)

if isinstance(tags, list) and not tags:
raise ValueError(f"{proxy_type} inbounds cannot be empty")

elif tags:
if tags:
for tag in tags:
if tag not in xray.config.inbounds_by_tag:
raise ValueError(f"Inbound {tag} doesn't exist")

# elif isinstance(tags, list) and not tags:
# raise ValueError(f"{proxy_type} inbounds cannot be empty")

else:
inbounds[proxy_type] = [
i["tag"]
Expand Down Expand Up @@ -222,8 +222,9 @@ def validate_inbounds(cls, inbounds, values, **kwargs):
# so inbounds particularly can be modified
if inbounds:
for proxy_type, tags in inbounds.items():
if not tags:
raise ValueError(f"{proxy_type} inbounds cannot be empty")

# if not tags:
# raise ValueError(f"{proxy_type} inbounds cannot be empty")

for tag in tags:
if tag not in xray.config.inbounds_by_tag:
Expand Down

0 comments on commit 3834a2f

Please sign in to comment.