MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / appendPluginAllow

Function appendPluginAllow

agent/app/service/agents_channels.go:1276–1299  ·  view source on GitHub ↗
(conf map[string]interface{}, pluginID string)

Source from the content-addressed store, hash-verified

1274}
1275
1276func appendPluginAllow(conf map[string]interface{}, pluginID string) {
1277 plugins := ensureChildMap(conf, "plugins")
1278 allow := make([]string, 0, 4)
1279 seen := map[string]struct{}{}
1280 switch values := plugins["allow"].(type) {
1281 case []interface{}:
1282 for _, value := range values {
1283 text, ok := value.(string)
1284 if !ok || text == "" {
1285 continue
1286 }
1287 if _, ok := seen[text]; ok {
1288 continue
1289 }
1290 seen[text] = struct{}{}
1291 allow = append(allow, text)
1292 }
1293 }
1294 if _, ok := seen[pluginID]; ok {
1295 plugins["allow"] = allow
1296 return
1297 }
1298 plugins["allow"] = append(allow, pluginID)
1299}
1300
1301func installOpenclawPlugin(mgr *cmd.CommandHelper, containerName, spec, pluginID string) error {
1302 workdir := path.Join(openclawPluginPackageTmpDir, pluginID)

Callers 2

InstallPluginMethod · 0.85
UpgradePluginMethod · 0.85

Calls 1

ensureChildMapFunction · 0.85

Tested by

no test coverage detected