hiddifypanel 10.50.5.dev0__py3-none-any.whl → 10.60.0.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. hiddifypanel/VERSION +1 -1
  2. hiddifypanel/VERSION.py +2 -2
  3. hiddifypanel/hutils/flask.py +5 -3
  4. hiddifypanel/hutils/network/net.py +22 -11
  5. hiddifypanel/hutils/proxy/singbox.py +13 -0
  6. hiddifypanel/hutils/proxy/xray.py +3 -0
  7. hiddifypanel/models/config_enum.py +114 -114
  8. hiddifypanel/panel/admin/Actions.py +1 -1
  9. hiddifypanel/panel/admin/DomainAdmin.py +2 -2
  10. hiddifypanel/panel/admin/ProxyAdmin.py +1 -1
  11. hiddifypanel/panel/admin/SettingAdmin.py +2 -2
  12. hiddifypanel/panel/admin/templates/config.html +129 -1
  13. hiddifypanel/panel/commercial/restapi/v1/__init__.py +1 -1
  14. hiddifypanel/panel/commercial/restapi/v1/tgbot.py +6 -0
  15. hiddifypanel/panel/commercial/restapi/v2/admin/user_api.py +2 -2
  16. hiddifypanel/panel/commercial/restapi/v2/user/configs_api.py +9 -1
  17. hiddifypanel/panel/commercial/telegrambot/__init__.py +1 -1
  18. hiddifypanel/panel/common.py +3 -1
  19. hiddifypanel/panel/custom_widgets.py +3 -0
  20. hiddifypanel/panel/hiddify.py +7 -4
  21. hiddifypanel/panel/init_db.py +4 -0
  22. hiddifypanel/panel/usage.py +2 -2
  23. hiddifypanel/panel/user/user.py +38 -0
  24. hiddifypanel/translations/en/LC_MESSAGES/messages.mo +0 -0
  25. hiddifypanel/translations/en/LC_MESSAGES/messages.po +9 -2
  26. hiddifypanel/translations/fa/LC_MESSAGES/messages.mo +0 -0
  27. hiddifypanel/translations/fa/LC_MESSAGES/messages.po +7 -2
  28. hiddifypanel/translations/pt/LC_MESSAGES/messages.mo +0 -0
  29. hiddifypanel/translations/pt/LC_MESSAGES/messages.po +7 -2
  30. hiddifypanel/translations/ru/LC_MESSAGES/messages.mo +0 -0
  31. hiddifypanel/translations/ru/LC_MESSAGES/messages.po +7 -2
  32. hiddifypanel/translations/zh/LC_MESSAGES/messages.mo +0 -0
  33. hiddifypanel/translations/zh/LC_MESSAGES/messages.po +7 -2
  34. hiddifypanel/translations.i18n/en.json +2 -1
  35. hiddifypanel/translations.i18n/fa.json +2 -1
  36. hiddifypanel/translations.i18n/pt.json +2 -1
  37. hiddifypanel/translations.i18n/ru.json +2 -1
  38. hiddifypanel/translations.i18n/zh.json +2 -1
  39. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/METADATA +1 -1
  40. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/RECORD +44 -44
  41. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/WHEEL +1 -1
  42. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/LICENSE.md +0 -0
  43. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/entry_points.txt +0 -0
  44. {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.60.0.dev0.dist-info}/top_level.txt +0 -0
hiddifypanel/VERSION CHANGED
@@ -1 +1 @@
1
- 10.50.5.dev0
1
+ 10.60.0.dev0
hiddifypanel/VERSION.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__='10.50.5.dev0'
1
+ __version__='10.60.0.dev0'
2
2
  from datetime import datetime
3
- __release_date__= datetime.strptime('2024-07-19','%Y-%m-%d')
3
+ __release_date__= datetime.strptime('2024-07-25','%Y-%m-%d')
@@ -4,6 +4,8 @@ from wtforms.validators import ValidationError
4
4
  from apiflask import abort as apiflask_abort
5
5
  from flask_babel import gettext as _
6
6
  from flask import url_for # type: ignore
7
+ from flask import abort as flask_abort
8
+ from markupsafe import Markup
7
9
  from urllib.parse import urlparse
8
10
  from strenum import StrEnum
9
11
 
@@ -24,7 +26,7 @@ def flash(message: str, category: str = "message"):
24
26
 
25
27
  def flash_config_success(restart_mode: ApplyMode = ApplyMode.nothing, domain_changed=True):
26
28
  if restart_mode != ApplyMode.nothing:
27
- url = hurl_for('admin.Actions:reinstall', complete_install=restart_mode == ApplyMode.restart, domain_changed=domain_changed)
29
+ url = hurl_for('admin.Actions:reinstall', complete_install=restart_mode == ApplyMode.reinstall, domain_changed=domain_changed)
28
30
  apply_btn = f"<a href='{url}' class='btn btn-primary form_post'>" + \
29
31
  _("admin.config.apply_configs") + "</a>"
30
32
  flash((_('config.validation-success', link=apply_btn)), 'success') # type: ignore
@@ -220,9 +222,9 @@ def proxy_path_validator(proxy_path: str) -> None:
220
222
 
221
223
  if is_api_call(request.path):
222
224
  if __is_admin_api_call() and proxy_path != admin_proxy_path:
223
- return apiflask_abort(400, Markup(f"Invalid Proxy Path <a href=/{admin_proxy_path}/admin>Admin Panel</a>")) if dbg_mode else apiflask_abort(400, 'invalid request')
225
+ return flask_abort(400, Markup(f"Invalid Proxy Path <a href=/{admin_proxy_path}/admin>Admin Panel</a>")) if dbg_mode else apiflask_abort(400, 'invalid request')
224
226
  if is_user_api_call() and proxy_path != client_proxy_path:
225
- return apiflask_abort(400, Markup(f"Invalid Proxy Path <a href=/{client_proxy_path}/admin>User Panel</a>")) if dbg_mode else apiflask_abort(400, 'invalid request')
227
+ return flask_abort(400, Markup(f"Invalid Proxy Path <a href=/{client_proxy_path}/admin>User Panel</a>")) if dbg_mode else apiflask_abort(400, 'invalid request')
226
228
 
227
229
 
228
230
  def list_dir_files(dir_path: str) -> List[str]:
@@ -1,3 +1,4 @@
1
+ import glob
1
2
  from typing import List, Literal, Set, Union
2
3
  from urllib.parse import urlparse
3
4
  import urllib.request
@@ -282,14 +283,24 @@ def get_warp_info() -> str:
282
283
 
283
284
 
284
285
  def is_ssh_password_authentication_enabled() -> bool:
285
- if os.path.isfile('/etc/ssh/sshd_config'):
286
- with open('/etc/ssh/sshd_config', 'r') as f:
287
- for line in f.readlines():
288
- line = line.strip()
289
- if line.startswith('#'):
290
- continue
291
- if re.search("^PasswordAuthentication\\s+no", line, re.IGNORECASE):
292
- return False
286
+ def check_file(file_path: str) -> bool:
287
+ if os.path.isfile(file_path):
288
+ try:
289
+ with open(file_path, 'r') as f:
290
+ for line in f.readlines():
291
+ line = line.strip()
292
+ if line.startswith('#'):
293
+ continue
294
+ if re.search(r"^PasswordAuthentication\s+no", line, re.IGNORECASE):
295
+ return False
296
+ except Exception as e:
297
+ print(e)
298
+
299
+ return True
300
+
301
+ for config_file in glob.glob("/etc/ssh/sshd*") + glob.glob("/etc/ssh/sshd*/*"):
302
+ if not check_file(config_file):
303
+ return False
293
304
 
294
305
  return True
295
306
 
@@ -319,7 +330,7 @@ def add_number_to_ipv6(ip: str, number: int) -> str:
319
330
  return modified_ipv6
320
331
 
321
332
 
322
- @cache.cache(600)
333
+ @ cache.cache(600)
323
334
  def is_in_same_asn(domain_or_ip: str, domain_or_ip_target: str) -> bool:
324
335
  '''Returns True if domain is in panel ASN'''
325
336
  try:
@@ -344,7 +355,7 @@ def is_in_same_asn(domain_or_ip: str, domain_or_ip_target: str) -> bool:
344
355
  # f"<br> Server ASN={asn_ipv4.get('autonomous_system_organization','unknown')}<br>{domain}_ASN={asn_dip.get('autonomous_system_organization','unknown')}", "warning")
345
356
 
346
357
 
347
- @cache.cache(600)
358
+ @ cache.cache(600)
348
359
  def get_ip_asn(ip: ipaddress.IPv4Address | ipaddress.IPv6Address | str) -> str:
349
360
  if not IPASN:
350
361
  return __get_ip_asn_api(ip)
@@ -364,7 +375,7 @@ def __get_ip_asn_api(ip: ipaddress.IPv4Address | ipaddress.IPv6Address | str) ->
364
375
  return str(requests.get(endpoint).content)
365
376
 
366
377
 
367
- @cache.cache(3600)
378
+ @ cache.cache(3600)
368
379
  def is_ip(input: str):
369
380
  try:
370
381
  _ = ipaddress.ip_address(input)
@@ -2,6 +2,7 @@ from flask import render_template, request, g
2
2
  import json
3
3
 
4
4
  from hiddifypanel import hutils
5
+ from hiddifypanel.hutils.proxy.xrayjson import to_xray
5
6
  from hiddifypanel.models import ProxyProto, ProxyTransport, Domain, ConfigEnum
6
7
 
7
8
 
@@ -43,6 +44,12 @@ def configs_as_json(domains: list[Domain], **kwargs) -> str:
43
44
  return res
44
45
 
45
46
 
47
+ def is_xray_proxy(proxy: dict):
48
+ if proxy['transport'] == ProxyTransport.splithttp:
49
+ return True
50
+ return False
51
+
52
+
46
53
  def to_singbox(proxy: dict) -> list[dict] | dict:
47
54
  name = proxy['name']
48
55
 
@@ -54,6 +61,12 @@ def to_singbox(proxy: dict) -> list[dict] | dict:
54
61
  all_base.append(base)
55
62
  # vmess ws
56
63
  base["tag"] = f"""{proxy['extra_info']} {proxy["name"]} § {proxy['port']} {proxy["dbdomain"].id}"""
64
+ if is_xray_proxy(proxy):
65
+ if hutils.flask.is_client_version(hutils.flask.ClientVersion.hiddify_next, 1, 9, 0):
66
+ base['type'] = "xray"
67
+ base['xray_outbound_raw'] = to_xray(proxy)
68
+ return all_base
69
+ return {'name': name, 'msg': "xray proxy does not support in this client version", 'type': 'debug'}
57
70
  base["type"] = str(proxy["proto"])
58
71
  base["server"] = proxy["server"]
59
72
  base["server_port"] = int(proxy["port"])
@@ -126,11 +126,14 @@ def to_link(proxy: dict) -> str | dict:
126
126
  baseurl += "&encryption=none"
127
127
  if proxy.get('fingerprint', 'none') != 'none':
128
128
  baseurl += "&fp=" + proxy['fingerprint']
129
+ if proxy.get('transport') in {ProxyTransport.splithttp}:
130
+ baseurl += "&core=xray"
129
131
  if proxy['l3'] != 'quic':
130
132
  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]:
131
133
  baseurl += '&headerType=http'
132
134
  else:
133
135
  baseurl += '&headerType=None'
136
+
134
137
  if proxy['mode'] == 'Fake' or proxy['allow_insecure']:
135
138
  baseurl += "&allowInsecure=true"
136
139
  if proxy.get('flow'):
@@ -64,8 +64,8 @@ class ConfigCategory(StrEnum):
64
64
 
65
65
 
66
66
  class ApplyMode(StrEnum):
67
- apply = auto()
68
- restart = auto()
67
+ apply_config = auto()
68
+ reinstall = auto()
69
69
  nothing = auto()
70
70
 
71
71
 
@@ -89,7 +89,7 @@ class ConfigEnum(metaclass=FastEnum):
89
89
  # category: ConfigCategory
90
90
  __slots__ = ('name', 'value', 'category', 'apply_mode', 'type', 'show_in_parent', 'hide_in_virtual_child')
91
91
 
92
- def __init__(self, category: ConfigCategory, apply_mode: ApplyMode = ApplyMode.apply, ctype=type, show_in_parent: bool = True, hide_in_virtual_child=False, name=auto):
92
+ def __init__(self, category: ConfigCategory, apply_mode: ApplyMode = ApplyMode.apply_config, ctype=type, show_in_parent: bool = True, hide_in_virtual_child=False, name=auto):
93
93
  self.value = name
94
94
  self.name = name
95
95
  self.category = category
@@ -101,41 +101,41 @@ class ConfigEnum(metaclass=FastEnum):
101
101
  @classmethod
102
102
  def dbvalues(cls):
103
103
  return {c.name: c for c in ConfigEnum}
104
- create_easysetup_link = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
105
- wireguard_enable = _BoolConfigDscr(ConfigCategory.wireguard, ApplyMode.apply, hide_in_virtual_child=True)
106
- wireguard_port = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.apply, hide_in_virtual_child=True)
107
- wireguard_ipv6 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
108
- wireguard_ipv4 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
109
- wireguard_private_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
110
- wireguard_public_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
111
- wireguard_noise_trick = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.apply)
104
+ create_easysetup_link = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.nothing, hide_in_virtual_child=True)
105
+ wireguard_enable = _BoolConfigDscr(ConfigCategory.wireguard, ApplyMode.reinstall, hide_in_virtual_child=True)
106
+ wireguard_port = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.apply_config, hide_in_virtual_child=True)
107
+ wireguard_ipv6 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
108
+ wireguard_ipv4 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
109
+ wireguard_private_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
110
+ wireguard_public_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
111
+ wireguard_noise_trick = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.apply_config)
112
112
 
113
113
  ssh_server_redis_url = _StrConfigDscr(ConfigCategory.hidden, hide_in_virtual_child=True)
114
- ssh_server_port = _StrConfigDscr(ConfigCategory.ssh, ApplyMode.apply, hide_in_virtual_child=True)
115
- ssh_server_enable = _BoolConfigDscr(ConfigCategory.ssh, ApplyMode.apply)
114
+ ssh_server_port = _StrConfigDscr(ConfigCategory.ssh, ApplyMode.apply_config, hide_in_virtual_child=True)
115
+ ssh_server_enable = _BoolConfigDscr(ConfigCategory.ssh, ApplyMode.reinstall)
116
116
  first_setup = _BoolConfigDscr(ConfigCategory.hidden)
117
- core_type = _StrConfigDscr(ConfigCategory.advanced, ApplyMode.apply, hide_in_virtual_child=True)
118
- warp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.restart, hide_in_virtual_child=True)
119
- warp_mode = _StrConfigDscr(ConfigCategory.warp, ApplyMode.restart, hide_in_virtual_child=True)
120
- warp_plus_code = _StrConfigDscr(ConfigCategory.warp, ApplyMode.apply, hide_in_virtual_child=True)
121
- warp_sites = _StrConfigDscr(ConfigCategory.warp, ApplyMode.apply, hide_in_virtual_child=True)
122
- dns_server = _StrConfigDscr(ConfigCategory.general, ApplyMode.apply, hide_in_virtual_child=True)
123
- reality_fallback_domain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply) # removed
124
- reality_server_names = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply) # removed
125
- reality_short_ids = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply, hide_in_virtual_child=True)
126
- reality_private_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply, hide_in_virtual_child=True)
127
- reality_public_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply, hide_in_virtual_child=True)
128
- reality_port = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply, hide_in_virtual_child=True)
117
+ core_type = _StrConfigDscr(ConfigCategory.advanced, ApplyMode.reinstall, hide_in_virtual_child=True)
118
+ warp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.reinstall, hide_in_virtual_child=True)
119
+ warp_mode = _StrConfigDscr(ConfigCategory.warp, ApplyMode.apply_config, hide_in_virtual_child=True)
120
+ warp_plus_code = _StrConfigDscr(ConfigCategory.warp, ApplyMode.apply_config, hide_in_virtual_child=True)
121
+ warp_sites = _StrConfigDscr(ConfigCategory.warp, ApplyMode.apply_config, hide_in_virtual_child=True)
122
+ dns_server = _StrConfigDscr(ConfigCategory.general, ApplyMode.apply_config, hide_in_virtual_child=True)
123
+ reality_fallback_domain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config) # removed
124
+ reality_server_names = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config) # removed
125
+ reality_short_ids = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply_config, hide_in_virtual_child=True)
126
+ reality_private_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply_config, hide_in_virtual_child=True)
127
+ reality_public_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply_config, hide_in_virtual_child=True)
128
+ reality_port = _StrConfigDscr(ConfigCategory.reality, ApplyMode.apply_config, hide_in_virtual_child=True)
129
129
 
130
130
  restls1_2_domain = _StrConfigDscr(ConfigCategory.hidden)
131
131
  restls1_3_domain = _StrConfigDscr(ConfigCategory.hidden)
132
132
  show_usage_in_sublink = _BoolConfigDscr(ConfigCategory.general)
133
- cloudflare = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply)
133
+ cloudflare = _StrConfigDscr(ConfigCategory.too_advanced)
134
134
  license = _StrConfigDscr(ConfigCategory.hidden)
135
- country = _StrConfigDscr(ConfigCategory.general, ApplyMode.restart, hide_in_virtual_child=True)
135
+ country = _StrConfigDscr(ConfigCategory.general, ApplyMode.reinstall, hide_in_virtual_child=True)
136
136
  package_mode = _StrConfigDscr(ConfigCategory.advanced, hide_in_virtual_child=True)
137
137
  utls = _StrConfigDscr(ConfigCategory.advanced)
138
- telegram_bot_token = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.apply, hide_in_virtual_child=True)
138
+ telegram_bot_token = _StrConfigDscr(ConfigCategory.telegram, hide_in_virtual_child=True)
139
139
 
140
140
  # region child-parent
141
141
  # deprecated
@@ -147,10 +147,10 @@ class ConfigEnum(metaclass=FastEnum):
147
147
 
148
148
  # the panel mode could be one of these: "parent", "child", "standalone"
149
149
  # this config value would be 'standalone' by default. and would be set by panel itself
150
- panel_mode = _TypedConfigDscr(PanelMode, ConfigCategory.hidden, ApplyMode.nothing, hide_in_virtual_child=True)
150
+ panel_mode = _TypedConfigDscr(PanelMode, ConfigCategory.hidden, hide_in_virtual_child=True)
151
151
  # endregion
152
152
 
153
- log_level = _TypedConfigDscr(LogLevel, ConfigCategory.hidden, ApplyMode.restart, hide_in_virtual_child=True)
153
+ log_level = _TypedConfigDscr(LogLevel, ConfigCategory.hidden, ApplyMode.reinstall, hide_in_virtual_child=True)
154
154
 
155
155
  unique_id = _StrConfigDscr(ConfigCategory.hidden)
156
156
  last_hash = _StrConfigDscr(ConfigCategory.hidden)
@@ -160,113 +160,113 @@ class ConfigEnum(metaclass=FastEnum):
160
160
  admin_secret = _StrConfigDscr(ConfigCategory.hidden) # removed
161
161
 
162
162
  # tls
163
- tls_ports = _StrConfigDscr(ConfigCategory.tls, ApplyMode.apply)
163
+ tls_ports = _StrConfigDscr(ConfigCategory.tls, ApplyMode.apply_config)
164
164
 
165
- tls_fragment_enable = _BoolConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
166
- tls_fragment_size = _StrConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
167
- tls_fragment_sleep = _StrConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
168
- tls_mixed_case = _BoolConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
169
- tls_padding_enable = _BoolConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
170
- tls_padding_length = _StrConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply)
165
+ tls_fragment_enable = _BoolConfigDscr(ConfigCategory.tls_trick)
166
+ tls_fragment_size = _StrConfigDscr(ConfigCategory.tls_trick)
167
+ tls_fragment_sleep = _StrConfigDscr(ConfigCategory.tls_trick)
168
+ tls_mixed_case = _BoolConfigDscr(ConfigCategory.tls_trick)
169
+ tls_padding_enable = _BoolConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply_config)
170
+ tls_padding_length = _StrConfigDscr(ConfigCategory.tls_trick, ApplyMode.apply_config)
171
171
 
172
172
  # mux
173
- mux_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply)
174
- mux_protocol = _StrConfigDscr(ConfigCategory.mux, ApplyMode.apply)
175
- mux_max_connections = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply)
176
- mux_min_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply)
177
- mux_max_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply)
178
- mux_padding_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply)
179
- mux_brutal_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply)
180
- mux_brutal_up_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply)
181
- mux_brutal_down_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply)
182
-
183
- http_ports = _StrConfigDscr(ConfigCategory.http, ApplyMode.apply)
184
- kcp_ports = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
185
- kcp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
186
- decoy_domain = _StrConfigDscr(ConfigCategory.general, ApplyMode.apply, hide_in_virtual_child=True)
173
+ mux_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
174
+ mux_protocol = _StrConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
175
+ mux_max_connections = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
176
+ mux_min_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
177
+ mux_max_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
178
+ mux_padding_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
179
+ mux_brutal_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
180
+ mux_brutal_up_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
181
+ mux_brutal_down_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.apply_config)
182
+
183
+ http_ports = _StrConfigDscr(ConfigCategory.http, ApplyMode.apply_config)
184
+ kcp_ports = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
185
+ kcp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
186
+ decoy_domain = _StrConfigDscr(ConfigCategory.general, ApplyMode.apply_config, hide_in_virtual_child=True)
187
187
  # will be deprecated
188
- proxy_path = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
189
- proxy_path_admin = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply, hide_in_virtual_child=True)
190
- proxy_path_client = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply, hide_in_virtual_child=True)
191
- firewall = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply, hide_in_virtual_child=True)
192
- netdata = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply) # removed
188
+ proxy_path = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
189
+ proxy_path_admin = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
190
+ proxy_path_client = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
191
+ firewall = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply_config, hide_in_virtual_child=True)
192
+ netdata = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.reinstall) # removed
193
193
  http_proxy_enable = _BoolConfigDscr(ConfigCategory.http)
194
- block_iran_sites = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply, hide_in_virtual_child=True)
195
- allow_invalid_sni = _BoolConfigDscr(ConfigCategory.tls, ApplyMode.apply, hide_in_virtual_child=True)
196
- auto_update = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply, True, hide_in_virtual_child=True)
197
- speed_test = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply, hide_in_virtual_child=True)
198
- only_ipv4 = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply, hide_in_virtual_child=True)
194
+ block_iran_sites = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config, hide_in_virtual_child=True)
195
+ allow_invalid_sni = _BoolConfigDscr(ConfigCategory.tls, ApplyMode.apply_config, hide_in_virtual_child=True)
196
+ auto_update = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply_config, True, hide_in_virtual_child=True)
197
+ speed_test = _BoolConfigDscr(ConfigCategory.general, ApplyMode.reinstall, hide_in_virtual_child=True)
198
+ only_ipv4 = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply_config, hide_in_virtual_child=True)
199
199
 
200
- shared_secret = _StrConfigDscr(ConfigCategory.proxies, ApplyMode.apply, hide_in_virtual_child=True)
200
+ shared_secret = _StrConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config, hide_in_virtual_child=True)
201
201
 
202
- telegram_enable = _BoolConfigDscr(ConfigCategory.telegram, ApplyMode.restart)
202
+ telegram_enable = _BoolConfigDscr(ConfigCategory.telegram, ApplyMode.reinstall)
203
203
  # telegram_secret=auto()
204
- telegram_adtag = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.restart, hide_in_virtual_child=True)
205
- telegram_lib = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.restart, hide_in_virtual_child=True)
206
- telegram_fakedomain = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.restart, hide_in_virtual_child=True)
204
+ telegram_adtag = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.reinstall, hide_in_virtual_child=True)
205
+ telegram_lib = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.reinstall, hide_in_virtual_child=True)
206
+ telegram_fakedomain = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.reinstall, hide_in_virtual_child=True)
207
207
 
208
- v2ray_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
209
- torrent_block = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply)
208
+ v2ray_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.reinstall)
209
+ torrent_block = _BoolConfigDscr(ConfigCategory.general, ApplyMode.apply_config)
210
210
 
211
- tuic_enable = _BoolConfigDscr(ConfigCategory.tuic, ApplyMode.apply)
212
- tuic_port = _StrConfigDscr(ConfigCategory.tuic, ApplyMode.apply, hide_in_virtual_child=True)
211
+ tuic_enable = _BoolConfigDscr(ConfigCategory.tuic, ApplyMode.apply_config)
212
+ tuic_port = _StrConfigDscr(ConfigCategory.tuic, ApplyMode.apply_config, hide_in_virtual_child=True)
213
213
 
214
214
  # the hysteria is refereing to hysteria2
215
- hysteria_enable = _BoolConfigDscr(ConfigCategory.hysteria, ApplyMode.apply)
216
- hysteria_port = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply, hide_in_virtual_child=True)
215
+ hysteria_enable = _BoolConfigDscr(ConfigCategory.hysteria, ApplyMode.apply_config)
216
+ hysteria_port = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
217
217
  # if be enable hysteria2 will be use salamander as obfs
218
- hysteria_obfs_enable = _BoolConfigDscr(ConfigCategory.hysteria, ApplyMode.apply)
219
- hysteria_up_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.apply)
220
- hysteria_down_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.apply)
221
-
222
- shadowsocks2022_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply)
223
- shadowsocks2022_method = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
224
- shadowsocks2022_port = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply)
225
- ssfaketls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.restart)
226
- ssfaketls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply, hide_in_virtual_child=True)
227
- shadowtls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply)
228
- shadowtls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply, hide_in_virtual_child=True)
229
-
230
- ssr_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
218
+ hysteria_obfs_enable = _BoolConfigDscr(ConfigCategory.hysteria, ApplyMode.apply_config)
219
+ hysteria_up_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.apply_config)
220
+ hysteria_down_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.apply_config)
221
+
222
+ shadowsocks2022_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply_config)
223
+ shadowsocks2022_method = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
224
+ shadowsocks2022_port = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply_config)
225
+ ssfaketls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.reinstall)
226
+ ssfaketls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply_config, hide_in_virtual_child=True)
227
+ shadowtls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply_config)
228
+ shadowtls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.apply_config, hide_in_virtual_child=True)
229
+
230
+ ssr_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
231
231
  # ssr_secret="ssr_secret"
232
- ssr_fakedomain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
232
+ ssr_fakedomain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
233
233
 
234
- vmess_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
234
+ vmess_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
235
235
  domain_fronting_domain = _StrConfigDscr(ConfigCategory.hidden) # removed
236
- domain_fronting_http_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply) # removed
237
- domain_fronting_tls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply) # removed
236
+ domain_fronting_http_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config) # removed
237
+ domain_fronting_tls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config) # removed
238
238
 
239
- ws_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
240
- grpc_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
241
- httpupgrade_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
242
- splithttp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
239
+ ws_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
240
+ grpc_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
241
+ httpupgrade_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
242
+ splithttp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
243
243
 
244
- vless_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
245
- trojan_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
246
- reality_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
247
- tcp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
248
- quic_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
249
- xtls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
250
- h2_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply)
244
+ vless_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
245
+ trojan_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
246
+ reality_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
247
+ tcp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
248
+ quic_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
249
+ xtls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
250
+ h2_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config)
251
251
 
252
- db_version = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
253
- last_priodic_usage_check = _IntConfigDscr(ConfigCategory.hidden, ApplyMode.apply)
252
+ db_version = _StrConfigDscr(ConfigCategory.hidden)
253
+ last_priodic_usage_check = _IntConfigDscr(ConfigCategory.hidden)
254
254
 
255
255
  branding_title = _StrConfigDscr(ConfigCategory.branding)
256
256
  branding_site = _StrConfigDscr(ConfigCategory.branding)
257
257
  branding_freetext = _StrConfigDscr(ConfigCategory.branding)
258
258
  not_found = _StrConfigDscr(ConfigCategory.hidden)
259
- path_vmess = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
260
- path_vless = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
261
- path_trojan = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
262
- path_v2ray = _StrConfigDscr(ConfigCategory.hidden, hide_in_virtual_child=True) # deprecated
263
- path_ss = _StrConfigDscr(ConfigCategory.hidden, hide_in_virtual_child=True)
264
-
265
- path_splithttp = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
266
- path_httpupgrade = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
267
- path_ws = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
268
- path_tcp = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
269
- path_grpc = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
259
+ path_vmess = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
260
+ path_vless = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
261
+ path_trojan = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
262
+ path_v2ray = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True) # deprecated
263
+ path_ss = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config, hide_in_virtual_child=True)
264
+
265
+ path_splithttp = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
266
+ path_httpupgrade = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
267
+ path_ws = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
268
+ path_tcp = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
269
+ path_grpc = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.apply_config, hide_in_virtual_child=True)
270
270
 
271
271
  # subs
272
272
  sub_full_singbox_enable = _BoolConfigDscr(ConfigCategory.hidden)
@@ -277,7 +277,7 @@ class ConfigEnum(metaclass=FastEnum):
277
277
  sub_full_clash_enable = _BoolConfigDscr(ConfigCategory.hidden)
278
278
  sub_full_clash_meta_enable = _BoolConfigDscr(ConfigCategory.hidden)
279
279
 
280
- hiddifycli_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.restart)
280
+ hiddifycli_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.reinstall)
281
281
 
282
282
  @classmethod
283
283
  def __missing__(cls, value):
@@ -108,7 +108,7 @@ class Actions(FlaskView):
108
108
  key = hutils.crypto.generate_x25519_keys()
109
109
  set_hconfig(ConfigEnum.reality_private_key, key['private_key'])
110
110
  set_hconfig(ConfigEnum.reality_public_key, key['public_key'])
111
- hutils.flask.flash_config_success(restart_mode=ApplyMode.restart, domain_changed=False)
111
+ hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=False)
112
112
  return redirect(hurl_for('admin.SettingAdmin:index'))
113
113
 
114
114
  @ login_required(roles={Role.super_admin})
@@ -276,7 +276,7 @@ class DomainAdmin(AdminLTEModelView):
276
276
  old_db_domain = Domain.by_domain(model.domain)
277
277
  if is_created or not old_db_domain or old_db_domain.mode != model.mode:
278
278
  # return hiddify.reinstall_action(complete_install=False, domain_changed=True)
279
- hutils.flask.flash_config_success(restart_mode=ApplyMode.apply, domain_changed=True)
279
+ hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=True)
280
280
 
281
281
  # def after_model_change(self,form, model, is_created):
282
282
  # if model.show_domains.count==0:
@@ -290,7 +290,7 @@ class DomainAdmin(AdminLTEModelView):
290
290
  hutils.flask.flash(_('cf-delete.failed'), 'warning') # type: ignore
291
291
  model.showed_by_domains = []
292
292
  # db.session.commit()
293
- hutils.flask.flash_config_success(restart_mode=ApplyMode.apply, domain_changed=True)
293
+ hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=True)
294
294
 
295
295
  def after_model_delete(self, model):
296
296
  if hutils.node.is_child():
@@ -60,7 +60,7 @@ class ProxyAdmin(FlaskView):
60
60
  hutils.proxy.get_proxies.invalidate_all()
61
61
  if hutils.node.is_child():
62
62
  hutils.node.run_node_op_in_bg(hutils.node.child.sync_with_parent, *[hutils.node.child.SyncFields.proxies])
63
- hutils.flask.flash_config_success(restart_mode=ApplyMode.apply, domain_changed=False)
63
+ hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=False)
64
64
  global_config_form = get_global_config_form(True)
65
65
  else:
66
66
  hutils.flask.flash((_('config.validation-error')), 'danger')
@@ -214,8 +214,8 @@ def get_config_form():
214
214
  description=_(f"config.{c.key}.description"),
215
215
  default=hconfig(c.key))
216
216
  elif c.key == ConfigEnum.country:
217
- field = wtf.SelectField(_(f"config.{c.key}.label"), choices=[("ir", _("Iran")), ("zh", _(
218
- "China")), ("other", _("Others"))], description=_(f"config.{c.key}.description"), default=hconfig(c.key))
217
+ field = wtf.SelectField(_(f"config.{c.key}.label"), choices=[
218
+ ("ir", _("Iran")), ("zh", _("China")), ("ru", _("Russia")), ("other", _("Others"))], description=_(f"config.{c.key}.description"), default=hconfig(c.key))
219
219
  elif c.key == ConfigEnum.package_mode:
220
220
  package_modes = [("release", _("Release")), ("beta", _("Beta"))]
221
221
  if hconfig(c.key) == "develop":