Skip to content

Commit

Permalink
fix: pydantic error on user.links
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Aug 4, 2024
1 parent 9a7985a commit 25c07ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
27 changes: 9 additions & 18 deletions app/subscription/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def generate_subscription(
else:
raise ValueError(f'Unsupported format "{config_format}"')


if as_base64:
config = base64.b64encode(config.encode()).decode()

Expand Down Expand Up @@ -252,8 +251,6 @@ def process_inbounds_and_tags(
inbounds = sorted(
_inbounds, key=lambda x: index_dict.get(x[1][0], float('inf')))

#all_hosts = []

for protocol, tags in inbounds:
settings = proxies.get(protocol)
if not settings:
Expand All @@ -279,13 +276,13 @@ def process_inbounds_and_tags(
if req_host_list:
salt = secrets.token_hex(8)
req_host = random.choice(req_host_list).replace("*", salt)

address = ""
address_list = host['address']
if host['address']:
salt = secrets.token_hex(8)
address = random.choice(address_list).replace('*', salt)

if host["path"] is not None:
path = host["path"].format_map(format_variables)
else:
Expand All @@ -301,25 +298,19 @@ def process_inbounds_and_tags(
"path": path,
"fp": host["fingerprint"] or inbound.get("fp", ""),
"ais": host["allowinsecure"]
or inbound.get("allowinsecure", ""),
or inbound.get("allowinsecure", ""),
"mux_enable": host["mux_enable"],
"fragment_setting": host["fragment_setting"],
"random_user_agent": host["random_user_agent"],
}
)

conf.add({
"remark": host["remark"].format_map(format_variables),
"address": address.format_map(format_variables),
"inbound": host_inbound,
"settings": settings.dict(no_obj=True)
})

#if RANDOMIZE_SUBSCRIPTION_CONFIGS:
# random.shuffle(all_hosts)

#for host in all_hosts:
# conf.add(**host)
conf.add(
remark=host["remark"].format_map(format_variables),
address=address.format_map(format_variables),
inbound=host_inbound,
settings=settings.dict(no_obj=True)
)

return conf.render(reverse=reverse)

Expand Down
2 changes: 1 addition & 1 deletion app/subscription/v2ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def httpupgrade_config(self, path=None, host=None, random_user_agent=None):
def splithttp_config(self, path=None, host=None, random_user_agent=None,
sc_max_each_post_bytes: int = 1000000,
sc_max_concurrent_posts: int = 100,
sc_min_posts_interval_ms : int = 30,
sc_min_posts_interval_ms: int = 30,
):
config = self.settings.get("splithttpSettings", {})

Expand Down

0 comments on commit 25c07ac

Please sign in to comment.