From 97d1694bfacb8ea8da2c818d8467e7507b5b6d67 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Thu, 4 Sep 2025 00:47:58 +0200 Subject: [PATCH] fix numbered external links #774 --- sub/clashService.go | 6 +++++- sub/jsonService.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sub/clashService.go b/sub/clashService.go index 6dcf7b4..0dcf819 100644 --- a/sub/clashService.go +++ b/sub/clashService.go @@ -73,8 +73,12 @@ func (s *ClashService) GetClash(subId string) (*string, []string, error) { } links := s.LinkService.GetLinks(&client.Links, "external", "") + tagNumEnable := 0 + if len(links) > 1 { + tagNumEnable = 1 + } for index, link := range links { - json, tag, err := util.GetOutbound(link, index) + json, tag, err := util.GetOutbound(link, (index+1)*tagNumEnable) if err == nil && len(tag) > 0 { *outbounds = append(*outbounds, *json) *outTags = append(*outTags, tag) diff --git a/sub/jsonService.go b/sub/jsonService.go index 4da59d6..53615b8 100644 --- a/sub/jsonService.go +++ b/sub/jsonService.go @@ -61,8 +61,12 @@ func (j *JsonService) GetJson(subId string, format string) (*string, []string, e } links := j.LinkService.GetLinks(&client.Links, "external", "") + tagNumEnable := 0 + if len(links) > 1 { + tagNumEnable = 1 + } for index, link := range links { - json, tag, err := util.GetOutbound(link, index) + json, tag, err := util.GetOutbound(link, (index+1)*tagNumEnable) if err == nil && len(tag) > 0 { *outbounds = append(*outbounds, *json) *outTags = append(*outTags, tag)