mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-03 06:35:00 +08:00
fix(config): rename SyncRevision to AuthRevision in PluginsConfig
This commit is contained in:
@@ -182,8 +182,8 @@ type PluginsConfig struct {
|
||||
StoreSources []string `yaml:"store-sources,omitempty" json:"store-sources,omitempty"`
|
||||
// StoreAuth defines optional auth rules for plugin store registry, metadata, and artifact requests.
|
||||
StoreAuth []sdkpluginstore.AuthConfig `yaml:"store-auth,omitempty" json:"store-auth,omitempty"`
|
||||
// SyncRevision changes when Home-managed plugin credentials change.
|
||||
SyncRevision int64 `yaml:"sync-revision,omitempty" json:"sync-revision,omitempty"`
|
||||
// AuthRevision changes when Home-managed plugin credentials change.
|
||||
AuthRevision int64 `yaml:"auth-revision,omitempty" json:"auth-revision,omitempty"`
|
||||
// Configs stores per-plugin instance configuration by plugin ID.
|
||||
Configs map[string]PluginInstanceConfig `yaml:"configs" json:"configs"`
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ plugins:
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseConfigBytes_PluginSyncRevision(t *testing.T) {
|
||||
cfg, errParse := ParseConfigBytes([]byte("plugins:\n sync-revision: 42\n"))
|
||||
func TestParseConfigBytes_PluginAuthRevision(t *testing.T) {
|
||||
cfg, errParse := ParseConfigBytes([]byte("plugins:\n auth-revision: 42\n"))
|
||||
if errParse != nil {
|
||||
t.Fatalf("ParseConfigBytes() error = %v", errParse)
|
||||
}
|
||||
if cfg.Plugins.SyncRevision != 42 {
|
||||
t.Fatalf("Plugins.SyncRevision = %d, want 42", cfg.Plugins.SyncRevision)
|
||||
if cfg.Plugins.AuthRevision != 42 {
|
||||
t.Fatalf("Plugins.AuthRevision = %d, want 42", cfg.Plugins.AuthRevision)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ func homePluginSyncKey(cfg *config.Config) string {
|
||||
return ""
|
||||
}
|
||||
hash := sha256.New()
|
||||
_, _ = fmt.Fprintf(hash, "enabled=%t\ndir=%s\nsync-revision=%d\n", cfg.Plugins.Enabled, strings.TrimSpace(cfg.Plugins.Dir), cfg.Plugins.SyncRevision)
|
||||
_, _ = fmt.Fprintf(hash, "enabled=%t\ndir=%s\nauth-revision=%d\n", cfg.Plugins.Enabled, strings.TrimSpace(cfg.Plugins.Dir), cfg.Plugins.AuthRevision)
|
||||
ids := make([]string, 0, len(cfg.Plugins.Configs))
|
||||
for id := range cfg.Plugins.Configs {
|
||||
ids = append(ids, id)
|
||||
|
||||
@@ -215,7 +215,7 @@ func TestHomePluginSyncKeyIncludesCredentialRevision(t *testing.T) {
|
||||
cfg.Plugins.Enabled = true
|
||||
cfg.Plugins.Configs = map[string]config.PluginInstanceConfig{}
|
||||
first := homePluginSyncKey(cfg)
|
||||
cfg.Plugins.SyncRevision = 2
|
||||
cfg.Plugins.AuthRevision = 2
|
||||
second := homePluginSyncKey(cfg)
|
||||
if first == second {
|
||||
t.Fatalf("homePluginSyncKey() unchanged after sync revision update: %q", first)
|
||||
|
||||
Reference in New Issue
Block a user