hiddifypanel 10.50.5.dev0__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/hutils/flask.py +5 -3
- hiddifypanel/hutils/network/net.py +22 -11
- hiddifypanel/models/config_enum.py +114 -114
- hiddifypanel/panel/admin/Actions.py +1 -1
- hiddifypanel/panel/admin/DomainAdmin.py +2 -2
- 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 +4 -0
- hiddifypanel/panel/usage.py +2 -2
- hiddifypanel/panel/user/user.py +38 -0
- hiddifypanel/translations/en/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/en/LC_MESSAGES/messages.po +9 -2
- hiddifypanel/translations/fa/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/fa/LC_MESSAGES/messages.po +7 -2
- hiddifypanel/translations/pt/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/pt/LC_MESSAGES/messages.po +7 -2
- hiddifypanel/translations/ru/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/ru/LC_MESSAGES/messages.po +7 -2
- hiddifypanel/translations/zh/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/zh/LC_MESSAGES/messages.po +7 -2
- hiddifypanel/translations.i18n/en.json +2 -1
- hiddifypanel/translations.i18n/fa.json +2 -1
- hiddifypanel/translations.i18n/pt.json +2 -1
- hiddifypanel/translations.i18n/ru.json +2 -1
- hiddifypanel/translations.i18n/zh.json +2 -1
- {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/METADATA +1 -1
- {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/RECORD +42 -42
- {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/WHEEL +1 -1
- {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/LICENSE.md +0 -0
- {hiddifypanel-10.50.5.dev0.dist-info → hiddifypanel-10.50.6.dev0.dist-info}/entry_points.txt +0 -0
- {hiddifypanel-10.50.5.dev0.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')
|
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)
|
@@ -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,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.
|
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.
|
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.
|
240
|
-
grpc_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
241
|
-
httpupgrade_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
242
|
-
splithttp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
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.
|
245
|
-
trojan_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
246
|
-
reality_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
247
|
-
tcp_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
248
|
-
quic_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
249
|
-
xtls_enable = _BoolConfigDscr(ConfigCategory.hidden, ApplyMode.
|
250
|
-
h2_enable = _BoolConfigDscr(ConfigCategory.proxies, ApplyMode.
|
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
|
253
|
-
last_priodic_usage_check = _IntConfigDscr(ConfigCategory.hidden
|
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.
|
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.
|
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.
|
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.
|
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.
|
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":
|
@@ -26,7 +26,8 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
<div class="card">
|
29
|
-
<div class="card-header"><input id="search_settings" type="text" class="form-control" placeholder="{{_(" Search
|
29
|
+
<div class="card-header"><input id="search_settings" type="text" class="form-control" placeholder="{{_(" Search
|
30
|
+
Settings")}}">
|
30
31
|
</div>
|
31
32
|
<div class="card-body">
|
32
33
|
<div class="row">
|
@@ -81,6 +82,133 @@
|
|
81
82
|
|
82
83
|
{% block tail %}
|
83
84
|
{{super()}}
|
85
|
+
<link rel="stylesheet" href="https://cdn.ckeditor.com/ckeditor5/42.0.2/ckeditor5.css">
|
86
|
+
<style>
|
87
|
+
.ck.ck-editor {
|
88
|
+
color: black !important;
|
89
|
+
}
|
90
|
+
</style>
|
91
|
+
<script src="https://cdn.ckeditor.com/ckeditor5/42.0.2/ckeditor5.js"></script>
|
92
|
+
|
93
|
+
<script type="importmap">
|
94
|
+
{
|
95
|
+
"imports": {
|
96
|
+
"ckeditor5": "https://cdn.ckeditor.com/ckeditor5/42.0.2/ckeditor5.js",
|
97
|
+
"ckeditor5/": "https://cdn.ckeditor.com/ckeditor5/42.0.2/"
|
98
|
+
}
|
99
|
+
}
|
100
|
+
</script>
|
101
|
+
<script type="module">
|
102
|
+
import {
|
103
|
+
ClassicEditor,
|
104
|
+
AccessibilityHelp,
|
105
|
+
Autosave,
|
106
|
+
BalloonToolbar,
|
107
|
+
Bold,
|
108
|
+
Code,
|
109
|
+
Essentials,
|
110
|
+
FontBackgroundColor,
|
111
|
+
FontColor,
|
112
|
+
FontFamily,
|
113
|
+
FontSize,
|
114
|
+
FullPage,
|
115
|
+
GeneralHtmlSupport,
|
116
|
+
Highlight,
|
117
|
+
HtmlComment,
|
118
|
+
HtmlEmbed,
|
119
|
+
Italic,
|
120
|
+
Paragraph,
|
121
|
+
SelectAll,
|
122
|
+
ShowBlocks,
|
123
|
+
SourceEditing,
|
124
|
+
SpecialCharacters,
|
125
|
+
Strikethrough,
|
126
|
+
ImageBlock,
|
127
|
+
ImageInsert,
|
128
|
+
ImageInsertViaUrl,
|
129
|
+
ImageToolbar,
|
130
|
+
|
131
|
+
Underline,
|
132
|
+
Undo
|
133
|
+
} from 'ckeditor5';
|
134
|
+
|
135
|
+
const editorConfig = {
|
136
|
+
toolbar: {
|
137
|
+
items: [
|
138
|
+
'undo',
|
139
|
+
'redo',
|
140
|
+
'|',
|
141
|
+
'bold',
|
142
|
+
'italic',
|
143
|
+
'underline',
|
144
|
+
'strikethrough',
|
145
|
+
'code',
|
146
|
+
'insertImage',
|
147
|
+
'|',
|
148
|
+
'fontSize',
|
149
|
+
'fontColor',
|
150
|
+
'fontBackgroundColor',
|
151
|
+
'|',
|
152
|
+
'sourceEditing',
|
153
|
+
|
154
|
+
],
|
155
|
+
shouldNotGroupWhenFull: false
|
156
|
+
},
|
157
|
+
plugins: [
|
158
|
+
AccessibilityHelp,
|
159
|
+
Autosave,
|
160
|
+
BalloonToolbar,
|
161
|
+
Bold,
|
162
|
+
Code,
|
163
|
+
Essentials,
|
164
|
+
FontBackgroundColor,
|
165
|
+
FontColor,
|
166
|
+
FontFamily,
|
167
|
+
FontSize,
|
168
|
+
FullPage,
|
169
|
+
GeneralHtmlSupport,
|
170
|
+
Highlight,
|
171
|
+
HtmlComment,
|
172
|
+
HtmlEmbed,
|
173
|
+
Italic,
|
174
|
+
Paragraph,
|
175
|
+
SelectAll,
|
176
|
+
ShowBlocks,
|
177
|
+
SourceEditing,
|
178
|
+
ImageBlock,
|
179
|
+
ImageInsertViaUrl,
|
180
|
+
|
181
|
+
Strikethrough,
|
182
|
+
Underline,
|
183
|
+
Undo
|
184
|
+
],
|
185
|
+
balloonToolbar: ['bold', 'italic'],
|
186
|
+
fontFamily: {
|
187
|
+
supportAllValues: true
|
188
|
+
},
|
189
|
+
fontSize: {
|
190
|
+
options: [10, 12, 14, 'default', 18, 20, 22],
|
191
|
+
supportAllValues: true
|
192
|
+
},
|
193
|
+
htmlSupport: {
|
194
|
+
allow: [
|
195
|
+
{
|
196
|
+
name: /^.*$/,
|
197
|
+
styles: true,
|
198
|
+
attributes: true,
|
199
|
+
classes: true
|
200
|
+
}
|
201
|
+
]
|
202
|
+
},
|
203
|
+
|
204
|
+
placeholder: 'Type or paste your content here!'
|
205
|
+
};
|
206
|
+
|
207
|
+
ClassicEditor.create(document.querySelector('.ckeditor'), editorConfig);
|
208
|
+
|
209
|
+
|
210
|
+
</script>
|
211
|
+
|
84
212
|
<script>
|
85
213
|
// $("fieldset .form-group").hide()
|
86
214
|
|
@@ -5,7 +5,7 @@ from marshmallow import Schema, fields
|
|
5
5
|
|
6
6
|
from apiflask import APIBlueprint
|
7
7
|
from flask_restful import Api
|
8
|
-
from .tgbot import bot, register_bot, TGBotResource
|
8
|
+
from .tgbot import bot, register_bot, register_bot_cached, TGBotResource
|
9
9
|
from . import tgbot
|
10
10
|
from .tgmsg import SendMsgResource
|
11
11
|
from .resources import *
|
@@ -5,6 +5,7 @@ from flask_restful import Resource
|
|
5
5
|
|
6
6
|
from hiddifypanel.models import *
|
7
7
|
from hiddifypanel import Events
|
8
|
+
from hiddifypanel.cache import cache
|
8
9
|
logger = telebot.logger
|
9
10
|
|
10
11
|
|
@@ -17,6 +18,11 @@ bot = telebot.TeleBot("", parse_mode="HTML", threaded=False, exception_handler=E
|
|
17
18
|
bot.username = ''
|
18
19
|
|
19
20
|
|
21
|
+
@cache.cache(1000)
|
22
|
+
def register_bot_cached(set_hook=False, remove_hook=False):
|
23
|
+
return register_bot(set_hook, remove_hook)
|
24
|
+
|
25
|
+
|
20
26
|
def register_bot(set_hook=False, remove_hook=False):
|
21
27
|
try:
|
22
28
|
global bot
|