fix: get client reverse tag in the outbound

This commit is contained in:
MHSanaei
2026-05-06 00:43:47 +02:00
parent 8bea0fde2b
commit 50603fd430
5 changed files with 38 additions and 6 deletions
+18
View File
@@ -1764,6 +1764,24 @@ func (s *InboundService) GetInboundTags() (string, error) {
return string(tags), nil
}
func (s *InboundService) GetClientReverseTags() (string, error) {
db := database.GetDB()
var rawTags []string
err := db.Raw(`
SELECT DISTINCT JSON_EXTRACT(client.value, '$.reverse.tag')
FROM inbounds,
JSON_EACH(JSON_EXTRACT(inbounds.settings, '$.clients')) AS client
WHERE inbounds.protocol = 'vless'
AND JSON_EXTRACT(client.value, '$.reverse.tag') IS NOT NULL
AND JSON_EXTRACT(client.value, '$.reverse.tag') != ''
`).Scan(&rawTags).Error
if err != nil && err != gorm.ErrRecordNotFound {
return "[]", err
}
result, _ := json.Marshal(rawTags)
return string(result), nil
}
func (s *InboundService) MigrationRemoveOrphanedTraffics() {
db := database.GetDB()
db.Exec(`