hiddifypanel 10.50.2__py3-none-any.whl → 10.50.4__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 CHANGED
@@ -1 +1 @@
1
- 10.50.2
1
+ 10.50.4
hiddifypanel/VERSION.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__='10.50.2'
1
+ __version__='10.50.4'
2
2
  from datetime import datetime
3
- __release_date__= datetime.strptime('2024-07-14','%Y-%m-%d')
3
+ __release_date__= datetime.strptime('2024-07-17','%Y-%m-%d')
@@ -10,27 +10,35 @@ class XrayApi(DriverABS):
10
10
  return hconfig(ConfigEnum.core_type) == "xray"
11
11
 
12
12
  def get_xray_client(self):
13
- return xtlsapi.XrayClient('127.0.0.1', 10085)
13
+ if not hasattr(self, 'xray_client'):
14
+ self.xray_client = xtlsapi.XrayClient('127.0.0.1', 10085)
15
+ return self.xray_client
14
16
 
15
17
  def get_enabled_users(self):
16
18
  xray_client = self.get_xray_client()
17
19
  usages = xray_client.stats_query('user', reset=True)
18
20
  res = defaultdict(int)
21
+ tags = set(self.get_inbound_tags())
19
22
  for use in usages:
20
23
  if "user>>>" not in use.name:
21
24
  continue
22
25
  uuid = use.name.split(">>>")[1].split("@")[0]
23
- try:
24
- t = "xtls"
25
- protocol = "vless"
26
- xray_client.add_client(t, f'{uuid}', f'{uuid}@hiddify.com', protocol=protocol, flow='xtls-rprx-vision', alter_id=0, cipher='chacha20_poly1305')
27
- xray_client.remove_client(t, f'{uuid}@hiddify.com')
28
- res[uuid] = 0
29
- except xtlsapi.xtlsapi.exceptions.EmailAlreadyExists as e:
30
- res[uuid] = 1
31
- except Exception as e:
32
- print(f"error {e}")
33
- res[uuid] = 0
26
+
27
+ for t in tags.copy():
28
+ try:
29
+ self.__add_uuid_to_tag(uuid, t)
30
+ self._remove_client(uuid, [t], False)
31
+ # print(f"Success add {uuid} {t}")
32
+ res[uuid] = 0
33
+ except ValueError:
34
+ # tag invalid
35
+ tags.remove(t)
36
+ pass
37
+ except xtlsapi.xtlsapi.exceptions.EmailAlreadyExists as e:
38
+ res[uuid] = 1
39
+ except Exception as e:
40
+ print(f"error {e}")
41
+ res[uuid] = 0
34
42
 
35
43
  return res
36
44
 
@@ -63,10 +71,8 @@ class XrayApi(DriverABS):
63
71
  inbounds = {}
64
72
  return list(inbounds)
65
73
 
66
- def add_client(self, user):
67
- uuid = user.uuid
74
+ def __add_uuid_to_tag(self, uuid, t):
68
75
  xray_client = self.get_xray_client()
69
- tags = self.get_inbound_tags()
70
76
  proto_map = {
71
77
  'vless': 'vless',
72
78
  'realityin': 'vless',
@@ -88,17 +94,27 @@ class XrayApi(DriverABS):
88
94
  res = p, protocol
89
95
  break
90
96
  return res
97
+ p, protocol = proto(t)
98
+ if not p:
99
+ raise ValueError("incorrect tag")
100
+ if (protocol == "vless" and p != "xtls" and p != "realityin") or "realityingrpc" in t:
101
+ xray_client.add_client(t, f'{uuid}', f'{uuid}@hiddify.com', protocol=protocol, flow='\0',)
102
+ else:
103
+ xray_client.add_client(t, f'{uuid}', f'{uuid}@hiddify.com', protocol=protocol,
104
+ flow='xtls-rprx-vision', alter_id=0, cipher='chacha20_poly1305')
105
+
106
+ def add_client(self, user):
107
+ uuid = user.uuid
108
+ xray_client = self.get_xray_client()
109
+ tags = self.get_inbound_tags()
110
+
91
111
  for t in tags:
92
112
  try:
93
- p, protocol = proto(t)
94
- if not p:
95
- continue
96
- if (protocol == "vless" and p != "xtls" and p != "realityin") or "realityingrpc" in t:
97
- xray_client.add_client(t, f'{uuid}', f'{uuid}@hiddify.com', protocol=protocol, flow='\0',)
98
- else:
99
- xray_client.add_client(t, f'{uuid}', f'{uuid}@hiddify.com', protocol=protocol,
100
- flow='xtls-rprx-vision', alter_id=0, cipher='chacha20_poly1305')
113
+ self.__add_uuid_to_tag(uuid, t)
101
114
  # print(f"Success add {uuid} {t}")
115
+ except ValueError:
116
+ # tag invalid
117
+ pass
102
118
  except Exception as e:
103
119
  # print(f"error in add {uuid} {t} {e}")
104
120
  pass
@@ -106,16 +122,18 @@ class XrayApi(DriverABS):
106
122
  def remove_client(self, user):
107
123
  return self._remove_client(user.uuid)
108
124
 
109
- def _remove_client(self, uuid):
125
+ def _remove_client(self, uuid, tags=None, dolog=True):
110
126
  xray_client = self.get_xray_client()
111
- tags = self.get_inbound_tags()
127
+ tags = tags or self.get_inbound_tags()
112
128
 
113
129
  for t in tags:
114
130
  try:
115
131
  xray_client.remove_client(t, f'{uuid}@hiddify.com')
116
- print(f"Success remove {uuid} {t}")
132
+ if dolog:
133
+ print(f"Success remove {uuid} {t}")
117
134
  except Exception as e:
118
- print(f"error in remove {uuid} {t} {e}")
135
+ if dolog:
136
+ print(f"error in remove {uuid} {t} {e}")
119
137
  pass
120
138
 
121
139
  def get_all_usage(self, users):
@@ -298,7 +298,7 @@ class DomainAdmin(AdminLTEModelView):
298
298
  def after_model_change(self, form, model, is_created):
299
299
  if hconfig(ConfigEnum.first_setup):
300
300
  set_hconfig(ConfigEnum.first_setup, False)
301
- if model.need_valid_ssl:
301
+ if model.need_valid_ssl and "*" not in model.domain:
302
302
  commander(Command.get_cert, domain=model.domain)
303
303
  if hutils.node.is_child():
304
304
  hutils.node.run_node_op_in_bg(hutils.node.child.sync_with_parent, *[hutils.node.child.SyncFields.domains])
@@ -142,11 +142,11 @@ def _add_users_usage(users_usage_data: Dict[User, Dict], child_id, sync=False):
142
142
  if not sync and hutils.node.is_child():
143
143
  hutils.node.child.sync_users_usage_with_parent()
144
144
 
145
- return {"status": 'success', "comments": res}
145
+ return {"status": 'success', "comments": res, "date": datetime.datetime.now()}
146
146
 
147
147
 
148
148
  def send_bot_message(user):
149
- if not (hconfig(ConfigEnum.telegram_bot_token) or not hutils.node.is_parent()):
149
+ if not (hconfig(ConfigEnum.telegram_bot_token) or hutils.node.is_child()):
150
150
  return
151
151
  if not user.telegram_id:
152
152
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hiddifypanel
3
- Version: 10.50.2
3
+ Version: 10.50.4
4
4
  Summary: hiddifypanel multi proxy panel
5
5
  Home-page: https://github.com/hiddify/hiddify-manager/
6
6
  Author: hiddify
@@ -1,6 +1,6 @@
1
1
  hiddifypanel/Events.py,sha256=AlnRdjVul0jP-NCT4-zoaQgowoOo-JhdQB4ytetAFKA,723
2
- hiddifypanel/VERSION,sha256=DUQBdAOuAKfJ37rMnpDFMV7J2msDNY7x1Dv50pMNn0g,8
3
- hiddifypanel/VERSION.py,sha256=iZZ7yX2w_Q3Kd4KmcGadd8ZNYUoS7wvI3OEVwDkrVTk,113
2
+ hiddifypanel/VERSION,sha256=c8o1H6F8_MJrq8OoHtctcdt1Tlav-7m4mOsjT_52d0k,8
3
+ hiddifypanel/VERSION.py,sha256=AwGQ8abu2uzm8LWxg399AxCsnBzepfeKDLV060mI_XM,113
4
4
  hiddifypanel/__init__.py,sha256=aLukp3ORszdcH4G9J-MlxhjHN6yFlOuOE6mm-L3aG_g,266
5
5
  hiddifypanel/__main__.py,sha256=IVchnXpK6bm8T3N--mN17HBQNLMeLAjyP7iwzULexB4,218
6
6
  hiddifypanel/auth.py,sha256=Xq0UwiFTRFmQpxnOehQGwPDlJqoelwGhPQbYZ0Xn5c0,7850
@@ -12,7 +12,7 @@ hiddifypanel/drivers/singbox_api.py,sha256=gdP_RM8b7qvDpN9RzUyJJ9i_MtMOpATx0LVDL
12
12
  hiddifypanel/drivers/ssh_liberty_bridge_api.py,sha256=m74JOYu7Pkt1bNvKlAAroea1QyxSfhf1bBMbtyf3VJA,2220
13
13
  hiddifypanel/drivers/user_driver.py,sha256=3xm5xGJXULo6Mb8KCMqUb4BxUTYSGCctn8k7gSbVM8w,2036
14
14
  hiddifypanel/drivers/wireguard_api.py,sha256=zBC7tlVRgQQC2BJzmwfFKIcNXcfBenpVgD5OGzh7AI4,3640
15
- hiddifypanel/drivers/xray_api.py,sha256=2Dd9UUi0y_dOiZ-8oQ_uHn-9Wk5H468er0i5TWBxDMU,5393
15
+ hiddifypanel/drivers/xray_api.py,sha256=b6f8q2oYZaWqsjaR7t_OAzE7gIjsSdpd4Z1a3i_0BcI,5869
16
16
  hiddifypanel/hutils/__init__.py,sha256=eHFBeXrTwiW3sb0ojTJNG_J26uiwyBoZ9O-W2lQKmeo,296
17
17
  hiddifypanel/hutils/auth.py,sha256=Ci3_lBfLXx1yi2M6HvYX3ceHYtOf-cfX092evcs8528,3030
18
18
  hiddifypanel/hutils/convert.py,sha256=mPEDzR64hKeQ4B_tZRk2Ci8-Ybod0bjX0BbxLHOmLZA,2075
@@ -65,13 +65,13 @@ hiddifypanel/panel/custom_widgets.py,sha256=9qI_fNX8NKqB1r8ljgcaisGZaDM89_PM_rOB
65
65
  hiddifypanel/panel/hiddify.py,sha256=Tj2WSjNrlRJ3yahFINCTQSn36ygBgFB3SQRr9MegLuE,15572
66
66
  hiddifypanel/panel/init_db.py,sha256=wewSjqu9LwvD9UiTtrAe4Y6BVl6EjzxwZ7ONUxwaWes,33397
67
67
  hiddifypanel/panel/run_commander.py,sha256=D9y-My0xSe2adHWXKV5UPYGl-9WwKURzniq55MRu6tE,3259
68
- hiddifypanel/panel/usage.py,sha256=LBmM5pKPbCxBxFozPjrXIypNVMlBn4ZyO46t5VBCNKg,6137
68
+ hiddifypanel/panel/usage.py,sha256=XwwgUTP63yI9dxzJqQomwhB8GvYuN3eqvsMXUkk3qGE,6165
69
69
  hiddifypanel/panel/admin/Actions.py,sha256=yRMKuCZ7J8F8KLlIfFUTYhdL19zVC_tujzZUWmTmCOA,8573
70
70
  hiddifypanel/panel/admin/AdminstratorAdmin.py,sha256=eUUe5b8bGPj2nZstKkwK3lhqBhMixyAbzEMvZAp0I2k,10231
71
71
  hiddifypanel/panel/admin/Backup.py,sha256=BKSoAZgw1j16P1Jh9vMqGj7ZfB2m-WafDK0C5vil5FY,3634
72
72
  hiddifypanel/panel/admin/ConfigAdmin.py,sha256=0hnLY-8BxrpVnrAcQaedWjHnRUq1X_Styi_ZCZ2ivds,2876
73
73
  hiddifypanel/panel/admin/Dashboard.py,sha256=JOqZLHxPOYKQYQVJ7AtHAkilH-anJZQyK1rQrgCJUeA,3798
74
- hiddifypanel/panel/admin/DomainAdmin.py,sha256=hORvsng-7m-r4bPS866g1AxI2eU1lmisrK5QD2p5py0,15790
74
+ hiddifypanel/panel/admin/DomainAdmin.py,sha256=5_2kENoloSPqNNy1FC9pqHqcLOMaef56HZWSBHY_PEc,15818
75
75
  hiddifypanel/panel/admin/NodeAdmin.py,sha256=QAHQjF7e7F4KqsWNWpMt7SoLANlFEborVtWQV9OXJ2E,3102
76
76
  hiddifypanel/panel/admin/ProxyAdmin.py,sha256=jiay6e9Eyi_-VgWORBLgCAyzxLRYCAyJnlG7DtFaQIc,5243
77
77
  hiddifypanel/panel/admin/QuickSetup.py,sha256=EDa_ombxF3vWDsj7JEmDnw8Kf0bKwdXU-IdISDi2hj0,11448
@@ -822,24 +822,24 @@ hiddifypanel/templates/redirect.html,sha256=K9x_O4P96vEkqBhOXIhoGrWw1KIqd2bL0BjI
822
822
  hiddifypanel/templates/static.html,sha256=jp6q4wtx-k2A_cjqJoNiMS7Ee30arE45qI3ev4d5ky4,165
823
823
  hiddifypanel/templates/hiddify-flask-admin/actions.html,sha256=2NeITe2e-lPKCk_o511tCIqVtrPu8LYHE1wTCtrFUrI,1331
824
824
  hiddifypanel/templates/hiddify-flask-admin/list.html,sha256=MBGrTqZpzNLe4sZy0RozvXNr8seFUQc2C6v88BJtNWc,11095
825
- hiddifypanel/translations/en/LC_MESSAGES/messages.mo,sha256=xKjzGhSJO71URpFNxD0DBW0BPXJLUPl-BYa7zrIjrmI,75756
825
+ hiddifypanel/translations/en/LC_MESSAGES/messages.mo,sha256=e9AeCdZiPyTQda9JMtIiduUN6TgpZegk00z68TViM7M,75756
826
826
  hiddifypanel/translations/en/LC_MESSAGES/messages.po,sha256=96O8XWX3UEb8OCw0WL9cGTOkzyU51UupXSKt4dBMs14,78920
827
- hiddifypanel/translations/fa/LC_MESSAGES/messages.mo,sha256=oA9Ptn17rDCOuGi24lY3_MIUVr2fYYhHOYkMkcWbr2I,96092
827
+ hiddifypanel/translations/fa/LC_MESSAGES/messages.mo,sha256=vXqVel33I-fbHfqMVNYUpGuQqAfvYcOveiD-pxhWgEg,96092
828
828
  hiddifypanel/translations/fa/LC_MESSAGES/messages.po,sha256=JdZQhrLwzFDngs0Wu3qDJaCxSoh7UJn09zwPTMKupyg,101469
829
- hiddifypanel/translations/pt/LC_MESSAGES/messages.mo,sha256=4qHrNodkt-6_zgGyRV3kuTeUc8FDwQmQCF9myyJdNoM,58649
829
+ hiddifypanel/translations/pt/LC_MESSAGES/messages.mo,sha256=9lwP8lZn_1Z2sAH6hLIisVo1nEMPhVKStnaGChs33Sg,58649
830
830
  hiddifypanel/translations/pt/LC_MESSAGES/messages.po,sha256=tEWo_g0gJAm1wlmRWfV7rKjt1w87GglPwv504K7hPyI,69401
831
- hiddifypanel/translations/ru/LC_MESSAGES/messages.mo,sha256=49qGdceJuJmi4yKqXIdyfeogPP46YDF6kkj8r6sue1Y,97620
831
+ hiddifypanel/translations/ru/LC_MESSAGES/messages.mo,sha256=3oNnqBSpFxgabcQ0KDf13IH_Z37OdoQ9Dp3bc04lFuM,97620
832
832
  hiddifypanel/translations/ru/LC_MESSAGES/messages.po,sha256=7gdyumMtKwmL2KtbdE6aVSZ31N5VM51GuyHhS__41ds,104624
833
- hiddifypanel/translations/zh/LC_MESSAGES/messages.mo,sha256=JJrIIN5TceGYRpwEVXI1uB-cFWUGm4Ni28SCm2QDzWU,58966
833
+ hiddifypanel/translations/zh/LC_MESSAGES/messages.mo,sha256=U-A6kyh-rjI0aF4Wy4suskc4bdsIYmUvWXtMhoPgW9Q,58966
834
834
  hiddifypanel/translations/zh/LC_MESSAGES/messages.po,sha256=8aP7TqaDZjDEHwiL0t8_eu5yP5PH8OrgouOND9ExH88,68629
835
835
  hiddifypanel/translations.i18n/en.json,sha256=IukyU5kkY_FRkFx_xT1APP7A5PASazjFOzMzDg5aZy0,68563
836
836
  hiddifypanel/translations.i18n/fa.json,sha256=ebTs9S5L4F_rFYfQxuJ8pMr6fz2PG8i8fkl4Soyxhzc,91103
837
837
  hiddifypanel/translations.i18n/pt.json,sha256=YQseQvgHDlCy3HHVJo-yAvepMl_y-zCU0qPLARybDmA,59407
838
838
  hiddifypanel/translations.i18n/ru.json,sha256=dCp5BI_15WoiMpV2u9_6M6feS_yL_lf22gXeyMqJDB4,94231
839
839
  hiddifypanel/translations.i18n/zh.json,sha256=8iFoOhmXeoPJHWop7Fa8FMs1Ix-5jvn09gq8N9w1iUs,58875
840
- hiddifypanel-10.50.2.dist-info/LICENSE.md,sha256=oDrt-cUsyiDGnRPjEJh-3dH2ddAuK_bIVBD8ntkOtZw,19807
841
- hiddifypanel-10.50.2.dist-info/METADATA,sha256=PjgN7NVbTyxamXLihAR41ABhBBQxahWSY5pY8Q7h6pk,4039
842
- hiddifypanel-10.50.2.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
843
- hiddifypanel-10.50.2.dist-info/entry_points.txt,sha256=Xzpqlh3nwBtZhoV9AANJykano056VJvYzaujxPztJaM,60
844
- hiddifypanel-10.50.2.dist-info/top_level.txt,sha256=rv-b3qFWUZQTBy0kyBfsr7L6tPpeO7AaQlLHXn-HI5M,13
845
- hiddifypanel-10.50.2.dist-info/RECORD,,
840
+ hiddifypanel-10.50.4.dist-info/LICENSE.md,sha256=oDrt-cUsyiDGnRPjEJh-3dH2ddAuK_bIVBD8ntkOtZw,19807
841
+ hiddifypanel-10.50.4.dist-info/METADATA,sha256=XYt1i87iZnTYfGMtYFAgRN52SGYx0xWPJnD1t4seg1I,4039
842
+ hiddifypanel-10.50.4.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
843
+ hiddifypanel-10.50.4.dist-info/entry_points.txt,sha256=Xzpqlh3nwBtZhoV9AANJykano056VJvYzaujxPztJaM,60
844
+ hiddifypanel-10.50.4.dist-info/top_level.txt,sha256=rv-b3qFWUZQTBy0kyBfsr7L6tPpeO7AaQlLHXn-HI5M,13
845
+ hiddifypanel-10.50.4.dist-info/RECORD,,