Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Iam54r1n4 committed Feb 5, 2024
1 parent 1b93b03 commit f44e4bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions hiddifypanel/panel/commercial/restapi/v2/user/mtproxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class MTProxiesAPI(MethodView):

@app.output(MtproxySchema(many=True))
def get(self):
# check mtproxie is enable
if not hconfig(ConfigEnum.telegram_enable):
abort(status_code=404, message="Telegram mtproxy is not enable")
# get domains
c = get_common_data(g.account.uuid, 'new')

if not c['telegram_enable']:
abort(status_code=404, message="Telegram mtproxy is not enable")

dtos = []
# TODO: Remove duplicated domains mapped to a same ipv4 and v6
for d in c['domains']:
if d.mode not in [DomainType.direct, DomainType.relay]:
if d.mode not in [DomainType.direct, DomainType.relay, DomainType.old_xtls_direct]:
continue

# make mtproxy link
Expand Down
5 changes: 3 additions & 2 deletions hiddifypanel/panel/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def get_domain_information(no_domain=False, filter_domain=None, alternative=None
def get_common_data(user_uuid, mode, no_domain=False, filter_domain=None):
# uuid_secret=str(uuid.UUID(user_secret))
domains, has_auto_cdn = get_domain_information(no_domain, filter_domain, urlparse(request.base_url).hostname)
db_domain = domains[0]
db_domain = db_domain = next((d for d in domains if d.mode == DomainType.sub_link_only), next(
(d for d in domains if d.mode == DomainType.direct), domains[0]))
domain = db_domain.domain
user: User = g.account if g.account.uuid == user_uuid else User.by_uuid(f'{user_uuid}')
if user is None:
Expand All @@ -319,7 +320,7 @@ def get_common_data(user_uuid, mode, no_domain=False, filter_domain=None):
user_ip = hutils.network.auto_ip_selector.get_real_user_ip()
asn = hutils.network.auto_ip_selector.get_asn_short_name(user_ip)
profile_title = f'{db_domain.alias or db_domain.domain} {user.name}'
profile_url = next((d for d in domains if d.mode == DomainType.sub_link_only), hiddify.get_account_panel_link(user, domain))
profile_url = hiddify.get_account_panel_link(user, domain)
if has_auto_cdn and asn != 'unknown':
profile_title += f" {asn}"

Expand Down

0 comments on commit f44e4bc

Please sign in to comment.