Skip to content

Commit

Permalink
rename splithttp to xhttp
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Nov 17, 2024
1 parent 9f3f64e commit e240440
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 38 deletions.
4 changes: 2 additions & 2 deletions hiddifypanel/hutils/proxy/clash.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def to_clash(proxy, meta_or_normal):

if proxy['l3'] in ["kcp", ProxyL3.h3_quic]:
return {'name': name, 'msg': f"clash does not support {proxy['l3']}", 'type': 'debug'}
if proxy['transport'] in [ProxyTransport.splithttp, ProxyTransport.httpupgrade]:
if proxy['transport'] in [ProxyTransport.xhttp, ProxyTransport.httpupgrade]:
return {'name': name, 'msg': f"clash does not support {proxy['transport']}", 'type': 'debug'}
# if proxy['proto'] in [Proxy.shado]:

Expand All @@ -44,7 +44,7 @@ def to_clash(proxy, meta_or_normal):
return {'name': name, 'msg': f"clash does not support {proxy['proto']}", 'type': 'debug'}
if proxy['proto'] in ["vless", 'tuic', 'hysteria2']:
return {'name': name, 'msg': f"{proxy['proto']} not supported in clash", 'type': 'debug'}
if proxy['transport'] in ["shadowtls", "splithttp"]:
if proxy['transport'] in ["shadowtls", "xhttp"]:
return {'name': name, 'msg': f"{proxy['transport']} not supported in clash", 'type': 'debug'}
if proxy['l3'] == ProxyL3.tls_h2 and proxy['proto'] in [ProxyProto.vmess, ProxyProto.vless] and proxy['dbe'].cdn == ProxyCDN.direct:
return {'name': name, 'msg': "bug tls_h2 vmess and vless in clash meta", 'type': 'warning'}
Expand Down
12 changes: 6 additions & 6 deletions hiddifypanel/hutils/proxy/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def get_proxies(child_id: int = 0, only_enabled=False) -> list['Proxy']:
proxies = [c for c in proxies if 'trojan' not in c.proto]
if not hconfig(ConfigEnum.httpupgrade_enable, child_id):
proxies = [c for c in proxies if ProxyTransport.httpupgrade not in c.transport]
if not hconfig(ConfigEnum.splithttp_enable, child_id):
proxies = [c for c in proxies if ProxyTransport.splithttp not in c.transport]
if not hconfig(ConfigEnum.xhttp_enable, child_id):
proxies = [c for c in proxies if ProxyTransport.xhttp not in c.transport]
if not hconfig(ConfigEnum.ws_enable, child_id):
proxies = [c for c in proxies if ProxyTransport.WS not in c.transport]
# if not hconfig(ConfigEnum.xtls_enable, child_id):
Expand Down Expand Up @@ -189,7 +189,7 @@ def get_valid_proxies(domains: list[Domain]) -> list[dict]:
noDomainProxies = False
if proxy.proto in [ProxyProto.ssh, ProxyProto.wireguard]:
noDomainProxies = True
if proxy.proto in [ProxyProto.ss] and proxy.transport not in [ProxyTransport.grpc, ProxyTransport.h2, ProxyTransport.WS, ProxyTransport.httpupgrade, ProxyTransport.splithttp]:
if proxy.proto in [ProxyProto.ss] and proxy.transport not in [ProxyTransport.grpc, ProxyTransport.h2, ProxyTransport.WS, ProxyTransport.httpupgrade, ProxyTransport.xhttp]:
noDomainProxies = True
options = []
key = f'{proxy.proto}{proxy.transport}{proxy.cdn}{proxy.l3}'
Expand Down Expand Up @@ -413,9 +413,9 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
base['path'] = f'/{path[base["proto"]]}{hconfigs[ConfigEnum.path_httpupgrade]}'
base["host"] = domain
return base
if proxy.transport in [ProxyTransport.splithttp]:
base['transport'] = 'splithttp'
base['path'] = f'/{path[base["proto"]]}{hconfigs[ConfigEnum.path_splithttp]}'
if proxy.transport in [ProxyTransport.xhttp]:
base['transport'] = 'xhttp'
base['path'] = f'/{path[base["proto"]]}{hconfigs[ConfigEnum.path_xhttp]}'
# if 0 and 'h2' in base['alpn'] or 'h3' in base['alpn']:
# base['path'] += "2"
# else:
Expand Down
2 changes: 1 addition & 1 deletion hiddifypanel/hutils/proxy/singbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def configs_as_json(domains: list[Domain], **kwargs) -> str:
def is_xray_proxy(proxy: dict):
if g.user_agent.get('is_hiddify_prefere_xray'):
return True
if proxy['transport'] == ProxyTransport.splithttp:
if proxy['transport'] == ProxyTransport.xhttp:
return True
return False

Expand Down
4 changes: 2 additions & 2 deletions hiddifypanel/hutils/proxy/xray.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ def to_link(proxy: dict) -> str | dict:
baseurl += "&encryption=none"
if proxy.get('fingerprint', 'none') != 'none':
baseurl += "&fp=" + proxy['fingerprint']
if proxy.get('transport') in {ProxyTransport.splithttp}:
if proxy.get('transport') in {ProxyTransport.xhttp}:
baseurl += "&core=xray"
if proxy['l3'] != 'quic':
if proxy.get('l3') != ProxyL3.reality and (proxy.get('transport') in {ProxyTransport.tcp, ProxyTransport.httpupgrade, ProxyTransport.splithttp}) and proxy['proto'] in [ProxyProto.vless, ProxyProto.trojan]:
if proxy.get('l3') != ProxyL3.reality and (proxy.get('transport') in {ProxyTransport.tcp, ProxyTransport.httpupgrade, ProxyTransport.xhttp}) and proxy['proto'] in [ProxyProto.vless, ProxyProto.trojan]:
baseurl += '&headerType=http'
else:
baseurl += '&headerType=None'
Expand Down
8 changes: 4 additions & 4 deletions hiddifypanel/hutils/proxy/xrayjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def add_stream_settings(base: dict, proxy: dict):
if proxy['transport'] == ProxyTransport.httpupgrade:
ss['network'] = proxy['transport']
add_httpupgrade_stream(ss, proxy)
if proxy['transport'] == ProxyTransport.splithttp:
if proxy['transport'] == ProxyTransport.xhttp:
ss['network'] = proxy['transport']
add_splithttp_stream(ss, proxy)
add_xhttp_stream(ss, proxy)
if proxy['transport'] == 'ws':
ss['network'] = proxy['transport']
add_ws_stream(ss, proxy)
Expand Down Expand Up @@ -338,8 +338,8 @@ def add_httpupgrade_stream(ss: dict, proxy: dict):
}


def add_splithttp_stream(ss: dict, proxy: dict):
ss['splithttpSettings'] = {
def add_xhttp_stream(ss: dict, proxy: dict):
ss['xhttpSettings'] = {
'path': proxy['path'],
'host': proxy['host'],
"headers": {
Expand Down
4 changes: 2 additions & 2 deletions hiddifypanel/models/config_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def dbvalues(cls):
ws_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
grpc_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
httpupgrade_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
splithttp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
xhttp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)

vless_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
trojan_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
Expand All @@ -262,7 +262,7 @@ def dbvalues(cls):
path_v2ray = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True) # deprecated
path_ss = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)

path_splithttp = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
path_xhttp = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
path_httpupgrade = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
path_ws = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
path_tcp = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
Expand Down
2 changes: 1 addition & 1 deletion hiddifypanel/models/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProxyTransport(StrEnum):
tcp = auto()
ssh = auto()
httpupgrade = auto()
splithttp = auto()
xhttp = auto()
custom = auto()
shadowsocks = auto()

Expand Down
35 changes: 19 additions & 16 deletions hiddifypanel/panel/init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ def _v94(child_id):

def _v93(child_id):
set_hconfig(ConfigEnum.quic_enable, True)
set_hconfig(ConfigEnum.splithttp_enable, True)
set_hconfig(ConfigEnum.xhttp_enable, True)


def _v92(child_id):
db.session.bulk_save_objects(get_proxy_rows_v1())


def _v89(child_id):
set_hconfig(ConfigEnum.path_splithttp,
set_hconfig(ConfigEnum.path_xhttp,
hutils.random.get_random_string(7, 15))
set_hconfig(ConfigEnum.splithttp_enable, False)
set_hconfig(ConfigEnum.xhttp_enable, False)
pass


Expand Down Expand Up @@ -218,7 +218,7 @@ def _v65():
add_config_if_not_exist(ConfigEnum.mux_min_streams, '4')
add_config_if_not_exist(ConfigEnum.mux_max_streams, '0')
add_config_if_not_exist(ConfigEnum.mux_padding_enable, False)
add_config_if_not_exist(ConfigEnum.mux_brutal_enable, True)
add_config_if_not_exist(ConfigEnum.mux_brutal_enable, False)
add_config_if_not_exist(ConfigEnum.mux_brutal_up_mbps, '100')
add_config_if_not_exist(ConfigEnum.mux_brutal_down_mbps, '100')

Expand Down Expand Up @@ -571,9 +571,9 @@ def get_proxy_rows_v1():
"httpupgrade direct vless",
# "httpupgrade direct trojan",
"httpupgrade direct vmess",
"splithttp direct vless",
"splithttp direct trojan",
"splithttp direct vmess",
"xhttp direct vless",
"xhttp direct trojan",
"xhttp direct vmess",
"tcp direct vless",
"tcp direct trojan",
"tcp direct vmess",
Expand All @@ -591,9 +591,9 @@ def get_proxy_rows_v1():
# "httpupgrade relay trojan",
"httpupgrade relay vmess",

"splithttp relay vless",
"splithttp relay trojan",
"splithttp relay vmess",
"xhttp relay vless",
"xhttp relay trojan",
"xhttp relay vmess",

"tcp relay vless",
"tcp relay trojan",
Expand All @@ -615,9 +615,9 @@ def get_proxy_rows_v1():
# "httpupgrade CDN trojan",
"httpupgrade CDN vmess",

"splithttp CDN vless",
"splithttp CDN trojan",
"splithttp CDN vmess",
"xhttp CDN vless",
"xhttp CDN trojan",
"xhttp CDN vmess",

"grpc CDN vless",
"grpc CDN trojan",
Expand Down Expand Up @@ -663,7 +663,7 @@ def make_proxy_rows(cfgs):
for l3 in [ProxyL3.h3_quic, "tls_h2", "tls", "http", "reality"]:
for c in cfgs:
transport, cdn, proto = c.split(" ")
if transport != ProxyTransport.splithttp and l3 == ProxyL3.h3_quic:
if transport != ProxyTransport.xhttp and l3 == ProxyL3.h3_quic:
continue
if l3 in ["kcp", 'reality'] and cdn != "direct":
continue
Expand Down Expand Up @@ -750,8 +750,11 @@ def add_new_enum_values():
continue

# Add the new value to the enum column in the database
enumstr = ','.join([f"'{a}'" for a in [*existing_values, *old_values]])

# enumstr = ','.join([f"'{a}'" for a in [*existing_values, *old_values]])
enumstr = ','.join([f"'{a}'" for a in [*existing_values]])
expired_enumstr = ','.join([f"'{a}'" for a in [*old_values]])
db_execute(
f"delete from {table_name} where `{column_name}` in ({expired_enumstr});", commit=True)
db_execute(
f"ALTER TABLE {table_name} MODIFY COLUMN `{column_name}` ENUM({enumstr});", commit=True)

Expand Down
4 changes: 2 additions & 2 deletions hiddifypanel/translations.i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
"description": "ça devrait être aléatoire",
"label": "ℹ️ Chemin de mise à niveau HTTP"
},
"path_splithttp": {
"path_xhttp": {
"description": "Cette option définit le chemin pour Split HTTP",
"label": "Chemin pour le HTTP fractionné"
},
Expand Down Expand Up @@ -778,7 +778,7 @@
"description": "Autorisez vos utilisateurs à effectuer des tests de vitesse. Cela les aide à identifier la qualité du lien",
"label": "🚀 Test de vitesse"
},
"splithttp_enable": {
"xhttp_enable": {
"description": "Ce protocole envoie et reçoit des informations dans des canaux individuels ",
"label": "🈁 Split HTTP"
},
Expand Down
4 changes: 2 additions & 2 deletions hiddifypanel/translations.i18n/my.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
"description": "ကျပန်းဖြစ်သင့်သည်",
"label": "ℹ️ HTTP အဆင့်မြှင့်တင်မှု လမ်းကြောင်း"
},
"path_splithttp": {
"path_xhttp": {
"description": "ဤရွေးချယ်မှုသည် Split HTTP အတွက် လမ်းကြောင်းကို သတ်မှတ်သည်။",
"label": "ℹ️ Split HTTP အတွက် လမ်းကြောင်း"
},
Expand Down Expand Up @@ -778,7 +778,7 @@
"description": "သင့်အသုံးပြုသူများကို အမြန်နှုန်းစမ်းသပ်မှု ပြုလုပ်ခွင့်ပြုရန်။ ၎င်းသည် ၎င်းတို့အား လင့်ခ်အရည်အသွေးကို ခွဲခြားသတ်မှတ်ရန် ကူညီပေးသည်။",
"label": "🚀 အမြန်နှုန်း စမ်းသပ်"
},
"splithttp_enable": {
"xhttp_enable": {
"description": "ဤပရိုတိုကောသည် ချန်နယ်တစ်ခုချင်းစီတွင် အချက်အလက်များကို ပေးပို့လက်ခံသည်",
"label": "🈁 Split HTTP"
},
Expand Down

0 comments on commit e240440

Please sign in to comment.