feat: support merging multiple subscriptions
This commit is contained in:
@ -178,11 +178,13 @@ func (m *Manager) SetSubscriptionURL(name, url string) {
|
||||
}
|
||||
}
|
||||
|
||||
// ActivateSubscription marks a subscription as active.
|
||||
// ActivateSubscription marks a subscription as active, in addition to any
|
||||
// other subscriptions already active. `config apply` merges every active
|
||||
// subscription's proxies together.
|
||||
func (m *Manager) ActivateSubscription(name string) {
|
||||
if m.Data.SetActive(name) {
|
||||
if m.Storage.SaveSubscriptions(m.Data) {
|
||||
fmt.Printf("✅ Activated subscription: %s\n", name)
|
||||
fmt.Printf("✅ Activated subscription: %s (%d active)\n", name, len(m.Data.GetActiveSubscriptions()))
|
||||
} else {
|
||||
fmt.Println("❌ Failed to activate subscription")
|
||||
}
|
||||
@ -191,6 +193,19 @@ func (m *Manager) ActivateSubscription(name string) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeactivateSubscription marks a subscription as inactive.
|
||||
func (m *Manager) DeactivateSubscription(name string) {
|
||||
if m.Data.SetInactive(name) {
|
||||
if m.Storage.SaveSubscriptions(m.Data) {
|
||||
fmt.Printf("✅ Deactivated subscription: %s\n", name)
|
||||
} else {
|
||||
fmt.Println("❌ Failed to deactivate subscription")
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("❌ Subscription '%s' not found\n", name)
|
||||
}
|
||||
}
|
||||
|
||||
// ListSubscriptions prints all subscriptions.
|
||||
func (m *Manager) ListSubscriptions() {
|
||||
if len(m.Data.Subscriptions) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user