Skip to content

Commit

Permalink
Merge pull request #1204 from M03ED/dev
Browse files Browse the repository at this point in the history
some fix and sync with new xray version
  • Loading branch information
SaintShit authored Aug 4, 2024
2 parents 530649d + aa664a2 commit 9a7985a
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 125 deletions.
17 changes: 8 additions & 9 deletions app/subscription/share.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import base64
import copy
import random
import secrets
import yaml
Expand Down Expand Up @@ -251,7 +252,7 @@ def process_inbounds_and_tags(
inbounds = sorted(
_inbounds, key=lambda x: index_dict.get(x[1][0], float('inf')))

all_hosts = []
#all_hosts = []

for protocol, tags in inbounds:
settings = proxies.get(protocol)
Expand All @@ -265,10 +266,8 @@ def process_inbounds_and_tags(
continue

format_variables.update({"TRANSPORT": inbound["network"]})

host_inbound = inbound.copy()
for host in xray.hosts.get(tag, []):
host_inbound = inbound.copy()

sni = ""
sni_list = host["sni"] or inbound["sni"]
if sni_list:
Expand Down Expand Up @@ -309,18 +308,18 @@ def process_inbounds_and_tags(
}
)

all_hosts.append({
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)
#if RANDOMIZE_SUBSCRIPTION_CONFIGS:
# random.shuffle(all_hosts)

for host in all_hosts:
conf.add(**host)
#for host in all_hosts:
# conf.add(**host)

return conf.render(reverse=reverse)

Expand Down
2 changes: 1 addition & 1 deletion app/subscription/singbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def ws_config(self, host='', path='', random_user_agent: bool = False,
if path:
config["path"] = path
if host:
config["headers"] = {"Host": host}
config["headers"]["Host"] = host
if random_user_agent:
config["headers"]["User-Agent"] = choice(self.user_agent_list)
if max_early_data is not None:
Expand Down
Loading

0 comments on commit 9a7985a

Please sign in to comment.