release: version 3.1.2
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package extension
|
||||
|
||||
import (
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
"github.com/hiddify/hiddify-core/config"
|
||||
"github.com/hiddify/hiddify-core/extension/ui"
|
||||
pb "github.com/hiddify/hiddify-core/hiddifyrpc"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"github.com/jellydator/validation"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
pb "github.com/hiddify/hiddify-core/hiddifyrpc"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"github.com/hiddify/hiddify-core/v2/service_manager"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -26,11 +27,7 @@ func RegisterExtension(factory ExtensionFactory) error {
|
||||
return err
|
||||
}
|
||||
allExtensionsMap[factory.Id] = factory
|
||||
common.Storage.GetExtensionData("default", &generalExtensionData)
|
||||
|
||||
if val, ok := generalExtensionData.ExtensionStatusMap[factory.Id]; ok && val {
|
||||
loadExtension(factory)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,3 +40,31 @@ func loadExtension(factory ExtensionFactory) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type extensionService struct {
|
||||
// Storage *CacheFile
|
||||
}
|
||||
|
||||
func (s *extensionService) Start() error {
|
||||
common.Storage.GetExtensionData("default", &generalExtensionData)
|
||||
|
||||
for id, factory := range allExtensionsMap {
|
||||
if val, ok := generalExtensionData.ExtensionStatusMap[id]; ok && val {
|
||||
loadExtension(factory)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *extensionService) Close() error {
|
||||
for _, extension := range enabledExtensionsMap {
|
||||
if err := (*extension).Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
service_manager.Register(&extensionService{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user