hiddifypanel 10.50.4__py3-none-any.whl → 10.50.6.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.
- hiddifypanel/VERSION +1 -1
- hiddifypanel/VERSION.py +2 -2
- hiddifypanel/drivers/user_driver.py +11 -7
- hiddifypanel/hutils/flask.py +5 -3
- hiddifypanel/hutils/network/net.py +22 -11
- hiddifypanel/hutils/proxy/shared.py +10 -3
- hiddifypanel/hutils/proxy/xray.py +1 -1
- hiddifypanel/hutils/proxy/xrayjson.py +11 -0
- hiddifypanel/models/config_enum.py +117 -114
- hiddifypanel/models/proxy.py +1 -0
- hiddifypanel/panel/admin/Actions.py +1 -1
- hiddifypanel/panel/admin/DomainAdmin.py +4 -3
- hiddifypanel/panel/admin/ProxyAdmin.py +1 -1
- hiddifypanel/panel/admin/SettingAdmin.py +2 -2
- hiddifypanel/panel/admin/templates/config.html +129 -1
- hiddifypanel/panel/commercial/restapi/v1/__init__.py +1 -1
- hiddifypanel/panel/commercial/restapi/v1/tgbot.py +6 -0
- hiddifypanel/panel/commercial/restapi/v2/admin/user_api.py +2 -2
- hiddifypanel/panel/commercial/restapi/v2/user/configs_api.py +9 -1
- hiddifypanel/panel/commercial/telegrambot/__init__.py +1 -1
- hiddifypanel/panel/common.py +3 -1
- hiddifypanel/panel/custom_widgets.py +3 -0
- hiddifypanel/panel/hiddify.py +7 -4
- hiddifypanel/panel/init_db.py +58 -2
- hiddifypanel/panel/usage.py +30 -16
- hiddifypanel/panel/user/user.py +38 -0
- hiddifypanel/templates/fake.html +4 -0
- hiddifypanel/translations/en/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/en/LC_MESSAGES/messages.po +21 -2
- hiddifypanel/translations/fa/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/fa/LC_MESSAGES/messages.po +19 -2
- hiddifypanel/translations/pt/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/pt/LC_MESSAGES/messages.po +19 -2
- hiddifypanel/translations/ru/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/ru/LC_MESSAGES/messages.po +19 -2
- hiddifypanel/translations/zh/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/zh/LC_MESSAGES/messages.po +19 -2
- hiddifypanel/translations.i18n/en.json +10 -1
- hiddifypanel/translations.i18n/fa.json +10 -1
- hiddifypanel/translations.i18n/pt.json +10 -1
- hiddifypanel/translations.i18n/ru.json +10 -1
- hiddifypanel/translations.i18n/zh.json +10 -1
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/METADATA +1 -1
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/RECORD +48 -48
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/WHEEL +1 -1
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/LICENSE.md +0 -0
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/entry_points.txt +0 -0
- {hiddifypanel-10.50.4.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/top_level.txt +0 -0
hiddifypanel/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.50.
|
1
|
+
10.50.6.dev0
|
hiddifypanel/VERSION.py
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
__version__='10.50.
|
1
|
+
__version__='10.50.6.dev0'
|
2
2
|
from datetime import datetime
|
3
|
-
__release_date__= datetime.strptime('2024-07-
|
3
|
+
__release_date__= datetime.strptime('2024-07-25','%Y-%m-%d')
|
@@ -18,11 +18,15 @@ def get_users_usage(reset=True):
|
|
18
18
|
users = list(User.query.all())
|
19
19
|
res = defaultdict(lambda: {'usage': 0, 'devices': ''})
|
20
20
|
for driver in enabled_drivers():
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
try:
|
22
|
+
all_usage = driver.get_all_usage(users)
|
23
|
+
for user, usage in all_usage.items():
|
24
|
+
if usage:
|
25
|
+
res[user]['usage'] += usage
|
26
|
+
# res[user]['devices'] +=usage
|
27
|
+
except Exception as e:
|
28
|
+
print(driver)
|
29
|
+
hiddify.error(f'ERROR! {driver.__class__.__name__} has error in update usage {e}')
|
26
30
|
return res
|
27
31
|
|
28
32
|
|
@@ -40,7 +44,7 @@ def get_enabled_users():
|
|
40
44
|
total += 1
|
41
45
|
except Exception as e:
|
42
46
|
print(driver)
|
43
|
-
hiddify.error(f'ERROR! {driver.__class__.__name__} has error in get_enabled users')
|
47
|
+
hiddify.error(f'ERROR! {driver.__class__.__name__} has error in get_enabled users {e}')
|
44
48
|
# print(d, total)
|
45
49
|
res = defaultdict(bool)
|
46
50
|
for u, v in d.items():
|
@@ -54,7 +58,7 @@ def add_client(user: User):
|
|
54
58
|
try:
|
55
59
|
driver.add_client(user)
|
56
60
|
except Exception as e:
|
57
|
-
hiddify.error(f'ERROR! {driver.__class__.__name__} has error {e} in add client for user={user.uuid}')
|
61
|
+
hiddify.error(f'ERROR! {driver.__class__.__name__} has error {e} in add client for user={user.uuid} {e}')
|
58
62
|
|
59
63
|
|
60
64
|
def remove_client(user: User):
|
hiddifypanel/hutils/flask.py
CHANGED
@@ -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.
|
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
|
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
|
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
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
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)
|
@@ -137,10 +137,12 @@ def get_proxies(child_id: int = 0, only_enabled=False) -> list['Proxy']:
|
|
137
137
|
proxies = [c for c in proxies if 'trojan' not in c.proto]
|
138
138
|
if not hconfig(ConfigEnum.httpupgrade_enable, child_id):
|
139
139
|
proxies = [c for c in proxies if ProxyTransport.httpupgrade not in c.transport]
|
140
|
+
if not hconfig(ConfigEnum.splithttp_enable, child_id):
|
141
|
+
proxies = [c for c in proxies if ProxyTransport.splithttp not in c.transport]
|
140
142
|
if not hconfig(ConfigEnum.ws_enable, child_id):
|
141
143
|
proxies = [c for c in proxies if ProxyTransport.WS not in c.transport]
|
142
|
-
if not hconfig(ConfigEnum.xtls_enable, child_id):
|
143
|
-
proxies = [c for c in proxies if ProxyTransport.XTLS not in c.transport]
|
144
|
+
# if not hconfig(ConfigEnum.xtls_enable, child_id):
|
145
|
+
# proxies = [c for c in proxies if ProxyTransport.XTLS not in c.transport]
|
144
146
|
if not hconfig(ConfigEnum.grpc_enable, child_id):
|
145
147
|
proxies = [c for c in proxies if ProxyTransport.grpc not in c.transport]
|
146
148
|
if not hconfig(ConfigEnum.tcp_enable, child_id):
|
@@ -190,7 +192,7 @@ def get_valid_proxies(domains: list[Domain]) -> list[dict]:
|
|
190
192
|
noDomainProxies = False
|
191
193
|
if proxy.proto in [ProxyProto.ssh, ProxyProto.wireguard]:
|
192
194
|
noDomainProxies = True
|
193
|
-
if proxy.proto in [ProxyProto.ss] and proxy.transport not in [ProxyTransport.grpc, ProxyTransport.h2, ProxyTransport.WS, ProxyTransport.httpupgrade]:
|
195
|
+
if proxy.proto in [ProxyProto.ss] and proxy.transport not in [ProxyTransport.grpc, ProxyTransport.h2, ProxyTransport.WS, ProxyTransport.httpupgrade, ProxyTransport.splithttp]:
|
194
196
|
noDomainProxies = True
|
195
197
|
options = []
|
196
198
|
key = f'{proxy.proto}{proxy.transport}{proxy.cdn}{proxy.l3}'
|
@@ -411,6 +413,11 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
|
|
411
413
|
base['path'] = f'/{path[base["proto"]]}{hconfigs[ConfigEnum.path_httpupgrade]}'
|
412
414
|
base["host"] = domain
|
413
415
|
return base
|
416
|
+
if proxy.transport in [ProxyTransport.splithttp]:
|
417
|
+
base['transport'] = 'splithttp'
|
418
|
+
base['path'] = f'/{path[base["proto"]]}{hconfigs[ConfigEnum.path_splithttp]}'
|
419
|
+
base["host"] = domain
|
420
|
+
return base
|
414
421
|
|
415
422
|
if proxy.transport == "grpc":
|
416
423
|
base['transport'] = 'grpc'
|
@@ -127,7 +127,7 @@ def to_link(proxy: dict) -> str | dict:
|
|
127
127
|
if proxy.get('fingerprint', 'none') != 'none':
|
128
128
|
baseurl += "&fp=" + proxy['fingerprint']
|
129
129
|
if proxy['l3'] != 'quic':
|
130
|
-
if proxy.get('l3') != ProxyL3.reality and (proxy.get('transport')
|
130
|
+
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
131
|
baseurl += '&headerType=http'
|
132
132
|
else:
|
133
133
|
baseurl += '&headerType=None'
|
@@ -261,6 +261,9 @@ def add_stream_settings(base: dict, proxy: dict):
|
|
261
261
|
if proxy['transport'] == ProxyTransport.httpupgrade:
|
262
262
|
ss['network'] = proxy['transport']
|
263
263
|
add_httpupgrade_stream(ss, proxy)
|
264
|
+
if proxy['transport'] == ProxyTransport.splithttp:
|
265
|
+
ss['network'] = proxy['transport']
|
266
|
+
add_splithttp_stream(ss, proxy)
|
264
267
|
if proxy['transport'] == 'ws':
|
265
268
|
ss['network'] = proxy['transport']
|
266
269
|
add_ws_stream(ss, proxy)
|
@@ -334,6 +337,14 @@ def add_httpupgrade_stream(ss: dict, proxy: dict):
|
|
334
337
|
}
|
335
338
|
|
336
339
|
|
340
|
+
def add_splithttp_stream(ss: dict, proxy: dict):
|
341
|
+
ss['splithttpSettings'] = {
|
342
|
+
'path': proxy['path'],
|
343
|
+
'host': proxy['host'],
|
344
|
+
# 'acceptProxyProtocol': '', for inbounds only
|
345
|
+
}
|
346
|
+
|
347
|
+
|
337
348
|
def add_kcp_stream(ss: dict, proxy: dict):
|
338
349
|
# TODO: fix server side configs first
|
339
350
|
ss['kcpSettings'] = {}
|
@@ -64,8 +64,8 @@ class ConfigCategory(StrEnum):
|
|
64
64
|
|
65
65
|
|
66
66
|
class ApplyMode(StrEnum):
|
67
|
-
|
68
|
-
|
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.
|
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.
|
105
|
-
wireguard_enable = _BoolConfigDscr(ConfigCategory.wireguard, ApplyMode.
|
106
|
-
wireguard_port = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.
|
107
|
-
wireguard_ipv6 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
108
|
-
wireguard_ipv4 = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
109
|
-
wireguard_private_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
110
|
-
wireguard_public_key = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
111
|
-
wireguard_noise_trick = _StrConfigDscr(ConfigCategory.wireguard, ApplyMode.
|
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.
|
115
|
-
ssh_server_enable = _BoolConfigDscr(ConfigCategory.ssh, ApplyMode.
|
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.
|
118
|
-
warp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
119
|
-
warp_mode = _StrConfigDscr(ConfigCategory.warp, ApplyMode.
|
120
|
-
warp_plus_code = _StrConfigDscr(ConfigCategory.warp, ApplyMode.
|
121
|
-
warp_sites = _StrConfigDscr(ConfigCategory.warp, ApplyMode.
|
122
|
-
dns_server = _StrConfigDscr(ConfigCategory.general, ApplyMode.
|
123
|
-
reality_fallback_domain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
124
|
-
reality_server_names = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
125
|
-
reality_short_ids = _StrConfigDscr(ConfigCategory.reality, ApplyMode.
|
126
|
-
reality_private_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.
|
127
|
-
reality_public_key = _StrConfigDscr(ConfigCategory.reality, ApplyMode.
|
128
|
-
reality_port = _StrConfigDscr(ConfigCategory.reality, ApplyMode.
|
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
|
133
|
+
cloudflare = _StrConfigDscr(ConfigCategory.too_advanced)
|
134
134
|
license = _StrConfigDscr(ConfigCategory.hidden)
|
135
|
-
country = _StrConfigDscr(ConfigCategory.general, ApplyMode.
|
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,
|
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,
|
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.
|
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,110 +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.
|
163
|
+
tls_ports = _StrConfigDscr(ConfigCategory.tls, ApplyMode.apply_config)
|
164
164
|
|
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.
|
170
|
-
tls_padding_length = _StrConfigDscr(ConfigCategory.tls_trick, ApplyMode.
|
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.
|
174
|
-
mux_protocol = _StrConfigDscr(ConfigCategory.mux, ApplyMode.
|
175
|
-
mux_max_connections = _IntConfigDscr(ConfigCategory.mux, ApplyMode.
|
176
|
-
mux_min_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.
|
177
|
-
mux_max_streams = _IntConfigDscr(ConfigCategory.mux, ApplyMode.
|
178
|
-
mux_padding_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.
|
179
|
-
mux_brutal_enable = _BoolConfigDscr(ConfigCategory.mux, ApplyMode.
|
180
|
-
mux_brutal_up_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.
|
181
|
-
mux_brutal_down_mbps = _IntConfigDscr(ConfigCategory.mux, ApplyMode.
|
182
|
-
|
183
|
-
http_ports = _StrConfigDscr(ConfigCategory.http, ApplyMode.
|
184
|
-
kcp_ports = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
185
|
-
kcp_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
186
|
-
decoy_domain = _StrConfigDscr(ConfigCategory.general, ApplyMode.
|
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.
|
189
|
-
proxy_path_admin = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.
|
190
|
-
proxy_path_client = _StrConfigDscr(ConfigCategory.too_advanced, ApplyMode.
|
191
|
-
firewall = _BoolConfigDscr(ConfigCategory.general, ApplyMode.
|
192
|
-
netdata = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
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.
|
195
|
-
allow_invalid_sni = _BoolConfigDscr(ConfigCategory.tls, ApplyMode.
|
196
|
-
auto_update = _BoolConfigDscr(ConfigCategory.general, ApplyMode.
|
197
|
-
speed_test = _BoolConfigDscr(ConfigCategory.general, ApplyMode.
|
198
|
-
only_ipv4 = _BoolConfigDscr(ConfigCategory.general, ApplyMode.
|
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.
|
200
|
+
shared_secret = _StrConfigDscr(ConfigCategory.proxies, ApplyMode.apply_config, hide_in_virtual_child=True)
|
201
201
|
|
202
|
-
telegram_enable = _BoolConfigDscr(ConfigCategory.telegram, ApplyMode.
|
202
|
+
telegram_enable = _BoolConfigDscr(ConfigCategory.telegram, ApplyMode.reinstall)
|
203
203
|
# telegram_secret=auto()
|
204
|
-
telegram_adtag = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.
|
205
|
-
telegram_lib = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.
|
206
|
-
telegram_fakedomain = _StrConfigDscr(ConfigCategory.telegram, ApplyMode.
|
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.
|
209
|
-
torrent_block = _BoolConfigDscr(ConfigCategory.general, ApplyMode.
|
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.
|
212
|
-
tuic_port = _StrConfigDscr(ConfigCategory.tuic, ApplyMode.
|
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.
|
216
|
-
hysteria_port = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
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.
|
219
|
-
hysteria_up_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.
|
220
|
-
hysteria_down_mbps = _StrConfigDscr(ConfigCategory.hysteria, ApplyMode.
|
221
|
-
|
222
|
-
shadowsocks2022_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
223
|
-
shadowsocks2022_method = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.
|
224
|
-
shadowsocks2022_port = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
225
|
-
ssfaketls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
226
|
-
ssfaketls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
227
|
-
shadowtls_enable = _BoolConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
228
|
-
shadowtls_fakedomain = _StrConfigDscr(ConfigCategory.shadowsocks, ApplyMode.
|
229
|
-
|
230
|
-
ssr_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
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.
|
232
|
+
ssr_fakedomain = _StrConfigDscr(ConfigCategory.hidden, ApplyMode.apply_config)
|
233
233
|
|
234
|
-
vmess_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
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.
|
237
|
-
domain_fronting_tls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
238
|
-
|
239
|
-
ws_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
240
|
-
grpc_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
241
|
-
httpupgrade_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
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
|
+
|
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
|
+
|
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
|
+
|
252
|
+
db_version = _StrConfigDscr(ConfigCategory.hidden)
|
253
|
+
last_priodic_usage_check = _IntConfigDscr(ConfigCategory.hidden)
|
252
254
|
|
253
255
|
branding_title = _StrConfigDscr(ConfigCategory.branding)
|
254
256
|
branding_site = _StrConfigDscr(ConfigCategory.branding)
|
255
257
|
branding_freetext = _StrConfigDscr(ConfigCategory.branding)
|
256
258
|
not_found = _StrConfigDscr(ConfigCategory.hidden)
|
257
|
-
path_vmess = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
|
258
|
-
path_vless = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
|
259
|
-
path_trojan = _StrConfigDscr(ConfigCategory.too_advanced, hide_in_virtual_child=True)
|
260
|
-
path_v2ray = _StrConfigDscr(ConfigCategory.hidden, hide_in_virtual_child=True) # deprecated
|
261
|
-
path_ss = _StrConfigDscr(ConfigCategory.hidden, hide_in_virtual_child=True)
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
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)
|
267
270
|
|
268
271
|
# subs
|
269
272
|
sub_full_singbox_enable = _BoolConfigDscr(ConfigCategory.hidden)
|
@@ -274,7 +277,7 @@ class ConfigEnum(metaclass=FastEnum):
|
|
274
277
|
sub_full_clash_enable = _BoolConfigDscr(ConfigCategory.hidden)
|
275
278
|
sub_full_clash_meta_enable = _BoolConfigDscr(ConfigCategory.hidden)
|
276
279
|
|
277
|
-
hiddifycli_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
280
|
+
hiddifycli_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.reinstall)
|
278
281
|
|
279
282
|
@classmethod
|
280
283
|
def __missing__(cls, value):
|
hiddifypanel/models/proxy.py
CHANGED
@@ -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.
|
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})
|
@@ -195,6 +195,7 @@ class DomainAdmin(AdminLTEModelView):
|
|
195
195
|
# raise ValidationError(_("You have to add your cloudflare api key to use this feature: "))
|
196
196
|
|
197
197
|
dips = hutils.network.get_domain_ips(model.domain)
|
198
|
+
server_ips = [*ipv4_list, *ipv6_list]
|
198
199
|
if model.sub_link_only:
|
199
200
|
if not dips:
|
200
201
|
raise ValidationError(_("Domain can not be resolved! there is a problem in your domain")) # type: ignore
|
@@ -203,7 +204,7 @@ class DomainAdmin(AdminLTEModelView):
|
|
203
204
|
raise ValidationError(_("Domain can not be resolved! there is a problem in your domain")) # type: ignore
|
204
205
|
|
205
206
|
domain_ip_is_same_as_panel = False
|
206
|
-
|
207
|
+
|
207
208
|
for mip in server_ips:
|
208
209
|
domain_ip_is_same_as_panel |= mip in dips
|
209
210
|
server_ips_str = ', '.join(list(map(str, server_ips)))
|
@@ -275,7 +276,7 @@ class DomainAdmin(AdminLTEModelView):
|
|
275
276
|
old_db_domain = Domain.by_domain(model.domain)
|
276
277
|
if is_created or not old_db_domain or old_db_domain.mode != model.mode:
|
277
278
|
# return hiddify.reinstall_action(complete_install=False, domain_changed=True)
|
278
|
-
hutils.flask.flash_config_success(restart_mode=ApplyMode.
|
279
|
+
hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=True)
|
279
280
|
|
280
281
|
# def after_model_change(self,form, model, is_created):
|
281
282
|
# if model.show_domains.count==0:
|
@@ -289,7 +290,7 @@ class DomainAdmin(AdminLTEModelView):
|
|
289
290
|
hutils.flask.flash(_('cf-delete.failed'), 'warning') # type: ignore
|
290
291
|
model.showed_by_domains = []
|
291
292
|
# db.session.commit()
|
292
|
-
hutils.flask.flash_config_success(restart_mode=ApplyMode.
|
293
|
+
hutils.flask.flash_config_success(restart_mode=ApplyMode.apply_config, domain_changed=True)
|
293
294
|
|
294
295
|
def after_model_delete(self, model):
|
295
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.
|
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=[
|
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":
|