diff --git a/provider/remote/provider.go b/provider/remote/provider.go index ca034e94..b740f19b 100644 --- a/provider/remote/provider.go +++ b/provider/remote/provider.go @@ -115,9 +115,11 @@ func (s *ProviderRemote) Start() error { s.subscriptionInfo = info content, _ = boxCommon.DecodeBase64URLSafe(others) } - if err := s.updateProviderFromContent(content); err != nil { + cachedOptions, err := json.UnmarshalExtendedContext[option.Options](s.ctx, []byte(content)) + if err != nil { return E.Cause(err, "restore cached outbound provider") } + s.updateProviderFromOptions(cachedOptions.Outbounds) s.UpdateGroups() s.lastUpdated, s.lastEtag = saveSub.LastUpdated, saveSub.LastEtag } @@ -300,12 +302,16 @@ func (s *ProviderRemote) updateProviderFromContent(content string) error { if err != nil { return err } + s.updateProviderFromOptions(outboundOpts) + return nil +} + +func (s *ProviderRemote) updateProviderFromOptions(outboundOpts []option.Outbound) { outboundOpts = common.Filter(outboundOpts, func(it option.Outbound) bool { return (s.exclude == nil || !s.exclude.MatchString(it.Tag)) && (s.include == nil || s.include.MatchString(it.Tag)) }) s.UpdateOutbounds(s.lastOutOpts, outboundOpts) s.lastOutOpts = outboundOpts - return nil } func getFirstLine(content string) (string, string) {