mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-03 17:07:15 +00:00
feat(routing): add panel-only comment field to routing rules (#6361)
Can annotate rules with a human-readable note for easier management. The comment is stripped before sending the config to xray-core (same pattern as the existing 'enabled' flag). Backend: stripDisabledRules now removes 'comment' from generated config. Frontend: input field in RuleFormModal, column in desktop table, chip with tooltip in mobile card list. Schema and type definitions updated.
This commit is contained in:
@@ -1060,9 +1060,9 @@ func resolveXrayLogPaths(logCfg json_util.RawMessage) json_util.RawMessage {
|
||||
}
|
||||
|
||||
// stripDisabledRules removes routing rules marked `enabled: false` from the
|
||||
// generated runtime config and strips the panel-only `enabled` key from the
|
||||
// rest, since xray-core has no such field. The internal api rule is always
|
||||
// kept (see isApiRule) so traffic stats can't be toggled off. The stored
|
||||
// generated runtime config and strips panel-only keys (`enabled`, `comment`)
|
||||
// from the rest, since xray-core has no such fields. The internal api rule is
|
||||
// always kept (see isApiRule) so traffic stats can't be toggled off. The stored
|
||||
// template is untouched — only the generated config is filtered.
|
||||
func stripDisabledRules(routerCfg json_util.RawMessage) json_util.RawMessage {
|
||||
if len(routerCfg) == 0 {
|
||||
@@ -1097,6 +1097,10 @@ func stripDisabledRules(routerCfg json_util.RawMessage) json_util.RawMessage {
|
||||
delete(rule, "enabled")
|
||||
changed = true
|
||||
}
|
||||
if _, exists := rule["comment"]; exists {
|
||||
delete(rule, "comment")
|
||||
changed = true
|
||||
}
|
||||
activeRules = append(activeRules, rule)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user