From e0be412885b948ac10f180abd76878b0a45664b8 Mon Sep 17 00:00:00 2001 From: KlimSemikin Date: Thu, 23 Apr 2026 20:05:42 +0300 Subject: [PATCH] feat(client-template): add possibility to use vless flow and uuid in client tempalte --- app/subscription/xray.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/subscription/xray.py b/app/subscription/xray.py index 9432780e..3ec2aa30 100644 --- a/app/subscription/xray.py +++ b/app/subscription/xray.py @@ -56,8 +56,8 @@ def __init__( "wireguard": self._build_wireguard, } - def add_config(self, remarks, outbounds, template_content: str | None = None): - rendered_template = render_template_string(template_content) if template_content is not None else self.template + def add_config(self, remarks, outbounds, settings: dict, template_content: str | None = None): + rendered_template = render_template_string(template_content, context={"uuid": settings["id"], "flow": settings["flow"]}) if template_content is not None else self.template json_template = json.loads(rendered_template) json_template["remarks"] = remarks json_template["outbounds"] = outbounds + json_template["outbounds"] @@ -95,7 +95,7 @@ def add( # Shadowsocks returns just a dict all_outbounds = [result] - self.add_config(remarks=remark, outbounds=all_outbounds, template_content=template_content) + self.add_config(remarks=remark, outbounds=all_outbounds, settings=settings, template_content=template_content) # ========== Transport Handlers (Registry Methods) ==========