(conf map[string]interface{}, pluginID string)
| 1274 | } |
| 1275 | |
| 1276 | func 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 | |
| 1301 | func installOpenclawPlugin(mgr *cmd.CommandHelper, containerName, spec, pluginID string) error { |
| 1302 | workdir := path.Join(openclawPluginPackageTmpDir, pluginID) |
no test coverage detected