hiddifypanel 9.0.0.dev21__py3-none-any.whl → 9.0.0.dev22__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
- 9.0.0.dev21
1
+ 9.0.0.dev22
hiddifypanel/VERSION.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__='9.0.0.dev21'
1
+ __version__='9.0.0.dev22'
2
2
  from datetime import datetime
3
- __release_date__= datetime.strptime('2023-10-26','%Y-%m-%d')
3
+ __release_date__= datetime.strptime('2023-10-30','%Y-%m-%d')
@@ -8,6 +8,7 @@ from strenum import StrEnum
8
8
  from hiddifypanel.panel.database import db
9
9
  from .config import hconfig
10
10
  from .config_enum import ConfigEnum
11
+ from sqlalchemy.orm import backref
11
12
 
12
13
 
13
14
  class DomainType(StrEnum):
@@ -47,7 +48,7 @@ class Domain(db.Model, SerializerMixin):
47
48
  show_domains = db.relationship('Domain', secondary=ShowDomain,
48
49
  primaryjoin=id == ShowDomain.c.domain_id,
49
50
  secondaryjoin=id == ShowDomain.c.related_id,
50
- # backref=backref('show_domains', lazy='dynamic')
51
+ backref=backref('showed_by_domains', lazy='dynamic')
51
52
  )
52
53
 
53
54
  def __repr__(self):
@@ -76,7 +77,7 @@ class Domain(db.Model, SerializerMixin):
76
77
 
77
78
  @property
78
79
  def need_valid_ssl(self):
79
- return self.mode in ['direct', 'cdn', 'worker', 'relay', 'auto_cdn_ip', 'old_xtls_direct', 'sub_link_only']
80
+ return self.mode in [DomainType.direct, DomainType.cdn, DomainType.worker, DomainType.relay, DomainType.auto_cdn_ip, DomainType.old_xtls_direct, DomainType.sub_link_only]
80
81
 
81
82
  @property
82
83
  def port_index(self):
@@ -1,6 +1,6 @@
1
1
  from hiddifypanel.models import *
2
2
  import re
3
-
3
+ from hiddifypanel.panel.database import db
4
4
  from flask import Markup
5
5
  from flask import g, flash
6
6
  from flask_babelex import gettext as __
@@ -248,6 +248,9 @@ class DomainAdmin(AdminLTEModelView):
248
248
  def on_model_delete(self, model):
249
249
  if len(Domain.query.all()) <= 1:
250
250
  raise ValidationError(f"at least one domain should exist")
251
+ # ShowDomain.query.filter_by(related_id == model.id).delete()
252
+ model.showed_by_domains = []
253
+ # db.session.commit()
251
254
  hiddify.flash_config_success(restart_mode='apply', domain_changed=True)
252
255
 
253
256
  def after_model_delete(self, model):
@@ -260,7 +263,7 @@ class DomainAdmin(AdminLTEModelView):
260
263
  set_hconfig(ConfigEnum.first_setup, False)
261
264
  # if hconfig(ConfigEnum.parent_panel):
262
265
  # hiddify_api.sync_child_to_parent()
263
- if model.mode in [DomainType.direct, DomainType.cdn, DomainType.worker, DomainType.relay, DomainType.auto_cdn_ip, DomainType.old_xtls_direct, DomainType.sub_link_only]:
266
+ if model.need_valid_ssl():
264
267
  hiddify.exec_command(f"sudo /opt/hiddify-manager/acme.sh/get_cert.sh {model.domain}")
265
268
 
266
269
  def is_accessible(self):
@@ -56,22 +56,16 @@ class UserView(FlaskView):
56
56
  @route('/mtproxies')
57
57
  def mtproxies(self):
58
58
  # get domains
59
- domains = []
60
- hdomains = get_hdomains()
61
- if len(hdomains[DomainType.direct]):
62
- domains += hdomains[DomainType.direct]
63
- if len(hdomains[DomainType.relay]):
64
- domains += hdomains[DomainType.relay]
59
+ c = get_common_data(g.user_uuid, 'new')
65
60
  mtproxies = []
66
61
  # TODO: Remove duplicated domains mapped to a same ipv4 and v6
67
- for d in domains:
68
- # create server link
69
- hexuuid = hconfig(ConfigEnum.shared_secret).replace('-', '')
70
- telegram_faketls_domain_hex = hconfig(
71
- ConfigEnum.telegram_fakedomain).encode('utf-8').hex()
72
- server_link = f'tg://proxy?server={d}&port=443&secret=ee{hexuuid}{telegram_faketls_domain_hex}'
73
- # add server to data
74
- mtproxies.append(server_link)
62
+ for d in c['domains']:
63
+ if d.mode not in [DomainType.direct, DomainType.relay]:
64
+ continue
65
+ hexuuid = hconfig(ConfigEnum.shared_secret, d.child_id).replace('-', '')
66
+ telegram_faketls_domain_hex = hconfig(ConfigEnum.telegram_fakedomain, d.child_id).encode('utf-8').hex()
67
+ server_link = f'tg://proxy?server={d.domain}&port=443&secret=ee{hexuuid}{telegram_faketls_domain_hex}'
68
+ mtproxies.append({'title': d.alias or d.domain, 'link': server_link})
75
69
 
76
70
  return jsonify(mtproxies)
77
71
 
@@ -3,8 +3,8 @@ msgid ""
3
3
  msgstr ""
4
4
  "Project-Id-Version: HiddifyPanel\n"
5
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2023-10-26 12:05+0200\n"
7
- "PO-Revision-Date: 2023-10-26 05:01-0500\n"
6
+ "POT-Creation-Date: 2023-10-30 09:11+0100\n"
7
+ "PO-Revision-Date: 2023-10-26 06:24-0500\n"
8
8
  "Last-Translator: hidden u\n"
9
9
  "Language-Team: English (USA)\n"
10
10
  "Language: en_US\n"
@@ -15,7 +15,7 @@ msgstr ""
15
15
  "Generated-By: Babel 2.12.1\n"
16
16
 
17
17
  # | msgid "This Domain does not exist in the Panel !"
18
- #: hiddifypanel/models/domain.py:158 hiddifypanel/panel/user/user.py:424
18
+ #: hiddifypanel/models/domain.py:159 hiddifypanel/panel/user/user.py:418
19
19
  msgid "This domain does not exist in the panel!"
20
20
  msgstr "This Domain does not exist in the Panel !"
21
21
 
@@ -1426,28 +1426,28 @@ msgstr "ℹ️ Domain Fronting"
1426
1426
 
1427
1427
  # | msgid ""
1428
1428
  # | "It is used to simulate another website instead of your website in SNI. "
1429
- # | "therefore, GTW Can not filter your domain"
1429
+ # | "therefore, GFW Can not filter your domain."
1430
1430
  #: hiddifypanel/panel/admin/templates/configfake.html:6
1431
1431
  #: hiddifypanel/templates/fake.html:1
1432
1432
  msgid "config.domain_fronting_domain.description"
1433
1433
  msgstr ""
1434
1434
  "It is used to simulate another website instead of your website in SNI. "
1435
- "therefore, GTW Can not filter your domain"
1435
+ "therefore, GFW Can not filter your domain."
1436
1436
 
1437
1437
  # | msgid ""
1438
1438
  # | "It is used to simulate another website instead of your website in SNI. "
1439
- # | "therefore, GTW can not filter your Domain\n"
1439
+ # | "therefore, GFW can not filter your Domain\n"
1440
1440
  # | "<a href=\"https://github.com/hiddify/hiddify-"
1441
1441
  # | "config/wiki/%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-"
1442
1442
  # | "%D8%AF%D8%A7%D9%85%DB%8C%D9%86-"
1443
1443
  # | "%D9%81%D8%B1%D8%A7%D9%86%D8%AA%DB%8C%D9%86%DA%AF\">Guide</a>. "
1444
- # | "⚠️CloudFlare does not support Domain Fronting. "
1444
+ # | "⚠️CloudFlare does not support Domain Fronting."
1445
1445
  #: hiddifypanel/panel/admin/templates/configfake.html:6
1446
1446
  #: hiddifypanel/templates/fake.html:2
1447
1447
  msgid "config.domain_fronting.description"
1448
1448
  msgstr ""
1449
- "It is used to simulate another website instead of your website in SNI. therefore, GTW can not filter your Domain\n"
1450
- "<a href=\"https://github.com/hiddify/hiddify-config/wiki/%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-%D8%AF%D8%A7%D9%85%DB%8C%D9%86-%D9%81%D8%B1%D8%A7%D9%86%D8%AA%DB%8C%D9%86%DA%AF\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting. "
1449
+ "It is used to simulate another website instead of your website in SNI. therefore, GFW can not filter your Domain\n"
1450
+ "<a href=\"https://github.com/hiddify/hiddify-config/wiki/%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-%D8%AF%D8%A7%D9%85%DB%8C%D9%86-%D9%81%D8%B1%D8%A7%D9%86%D8%AA%DB%8C%D9%86%DA%AF\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting."
1451
1451
 
1452
1452
  # | msgid "✔️ Enable Telegram MTProto"
1453
1453
  #: hiddifypanel/panel/admin/templates/configfake.html:6
@@ -2014,14 +2014,14 @@ msgid "config.reality_fallback_domain.label"
2014
2014
  msgstr "🌍 Reality Fallback Domain"
2015
2015
 
2016
2016
  # | msgid ""
2017
- # | "When the GTW visit the Websites in Server names, it will be redirect to "
2017
+ # | "When the GFW visit the Websites in Server names, it will be redirect to "
2018
2018
  # | "this Domain."
2019
2019
  #: hiddifypanel/panel/admin/templates/configfake.html:6
2020
2020
  #: hiddifypanel/templates/fake.html:1
2021
2021
  #: hiddifypanel/templates/flaskadmin-layout.html:124
2022
2022
  msgid "config.reality_fallback_domain.description"
2023
2023
  msgstr ""
2024
- "When the GTW visit the Websites in Server names, it will be redirect to this"
2024
+ "When the GFW visit the Websites in Server names, it will be redirect to this"
2025
2025
  " Domain."
2026
2026
 
2027
2027
  # | msgid "🔑 Private Key"
@@ -4270,16 +4270,15 @@ msgstr "🔒 Enable TLS Domain Fronting"
4270
4270
 
4271
4271
  # | msgid ""
4272
4272
  # | "It is used to simulate another website instead of your website in SNI. "
4273
- # | "therefore, GTW can not filter your Domain\n"
4273
+ # | "therefore, GFW can not filter your Domain\n"
4274
4274
  # | "<a
4275
4275
  # href=\"https://github.com/hiddify/hiddify-config/wiki/Guide-for-domain-"
4276
- # | "fronting\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting. "
4276
+ # | "fronting\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting."
4277
4277
  #: hiddifypanel/templates/flaskadmin-layout.html:129
4278
- #, fuzzy
4279
4278
  msgid "domain.domain_fronting.description"
4280
4279
  msgstr ""
4281
- "It is used to simulate another website instead of your website in SNI. therefore, GTW can not filter your Domain\n"
4282
- "<a href=\"https://github.com/hiddify/hiddify-config/wiki/Guide-for-domain-fronting\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting. "
4280
+ "It is used to simulate another website instead of your website in SNI. therefore, GFW can not filter your Domain\n"
4281
+ "<a href=\"https://github.com/hiddify/hiddify-config/wiki/Guide-for-domain-fronting\">Guide</a>. ⚠️CloudFlare does not support Domain Fronting."
4283
4282
 
4284
4283
  # | msgid "Close"
4285
4284
  #: hiddifypanel/templates/macros.html:29
@@ -3,8 +3,8 @@ msgid ""
3
3
  msgstr ""
4
4
  "Project-Id-Version: HiddifyPanel\n"
5
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2023-10-26 12:05+0200\n"
7
- "PO-Revision-Date: 2023-10-26 05:01-0500\n"
6
+ "POT-Creation-Date: 2023-10-30 09:11+0100\n"
7
+ "PO-Revision-Date: 2023-10-26 06:24-0500\n"
8
8
  "Last-Translator: hidden u\n"
9
9
  "Language: fa\n"
10
10
  "Language-Team: Persian\n"
@@ -15,7 +15,7 @@ msgstr ""
15
15
  "Generated-By: Babel 2.12.1\n"
16
16
 
17
17
  # | msgid "This Domain does not exist in the Panel !"
18
- #: hiddifypanel/models/domain.py:158 hiddifypanel/panel/user/user.py:424
18
+ #: hiddifypanel/models/domain.py:159 hiddifypanel/panel/user/user.py:418
19
19
  msgid "This domain does not exist in the panel!"
20
20
  msgstr "این دامنه در پنل وجود ندارد!"
21
21
 
@@ -1460,7 +1460,7 @@ msgstr "ℹ️ دامین فرانتینگ"
1460
1460
 
1461
1461
  # | msgid ""
1462
1462
  # | "It is used to simulate another website instead of your website in SNI. "
1463
- # | "therefore, GTW Can not filter your domain"
1463
+ # | "therefore, GFW Can not filter your domain."
1464
1464
  #: hiddifypanel/panel/admin/templates/configfake.html:6
1465
1465
  #: hiddifypanel/templates/fake.html:1
1466
1466
  msgid "config.domain_fronting_domain.description"
@@ -1470,10 +1470,10 @@ msgstr ""
1470
1470
 
1471
1471
  # | msgid ""
1472
1472
  # | "It is used to simulate another website instead of your website in SNI.
1473
- # therefore, GTW can not filter your Domain\n"
1473
+ # therefore, GFW can not filter your Domain\n"
1474
1474
  # | "<a
1475
1475
  # href=\"https://github.com/hiddify/hiddify-config/wiki/%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-%D8%AF%D8%A7%D9%85%DB%8C%D9%86-%D9%81%D8%B1%D8%A7%D9%86%D8%AA%DB%8C%D9%86%DA%AF\">Guide</a>.
1476
- # ⚠️CloudFlare does not support Domain Fronting. "
1476
+ # ⚠️CloudFlare does not support Domain Fronting."
1477
1477
  #: hiddifypanel/panel/admin/templates/configfake.html:6
1478
1478
  #: hiddifypanel/templates/fake.html:2
1479
1479
  msgid "config.domain_fronting.description"
@@ -2071,7 +2071,7 @@ msgid "config.reality_fallback_domain.label"
2071
2071
  msgstr "🌍 دامنه بازگشتی ریالیتی"
2072
2072
 
2073
2073
  # | msgid ""
2074
- # | "When the GTW visit the Websites in Server names, it will be redirect to
2074
+ # | "When the GFW visit the Websites in Server names, it will be redirect to
2075
2075
  # this"
2076
2076
  # | " Domain."
2077
2077
  #: hiddifypanel/panel/admin/templates/configfake.html:6
@@ -4450,10 +4450,10 @@ msgstr "🔒 فعال کردن دامین فرانتینگ در اتصال TLS"
4450
4450
 
4451
4451
  # | msgid ""
4452
4452
  # | "It is used to simulate another website instead of your website in SNI.
4453
- # therefore, GTW can not filter your Domain\n"
4453
+ # therefore, GFW can not filter your Domain\n"
4454
4454
  # | "<a
4455
4455
  # href=\"https://github.com/hiddify/hiddify-config/wiki/Guide-for-domain-fronting\">Guide</a>.
4456
- # ⚠️CloudFlare does not support Domain Fronting. "
4456
+ # ⚠️CloudFlare does not support Domain Fronting."
4457
4457
  #: hiddifypanel/templates/flaskadmin-layout.html:129
4458
4458
  msgid "domain.domain_fronting.description"
4459
4459
  msgstr ""