From 227ebdfab60b005e818d5f725eef0a7ad0c3ea45 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Mon, 28 Sep 2026 23:52:25 +0200 Subject: [PATCH 1/2] plugins: Parse repo.json only, not every json file According to the documentation, micro reads plugin info from the `repo.json` file in the plugin's directory. In reality, micro reads plugin info from each and every `*.json` file in the plugin's directory, not only from `repo.json` (so if there are multiple json files, each next one overrides info read from the previous one). Fix this absurdity. --- internal/config/rtfiles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/config/rtfiles.go b/internal/config/rtfiles.go index 70ce4f04c6..e114419395 100644 --- a/internal/config/rtfiles.go +++ b/internal/config/rtfiles.go @@ -207,7 +207,7 @@ func InitPlugins() { for _, f := range srcs { if strings.HasSuffix(f.Name(), ".lua") { p.Srcs = append(p.Srcs, realFile(filepath.Join(plugdir, d.Name(), f.Name()))) - } else if strings.HasSuffix(f.Name(), ".json") { + } else if f.Name() == "repo.json" { data, err := os.ReadFile(filepath.Join(plugdir, d.Name(), f.Name())) if err != nil { continue @@ -247,7 +247,7 @@ func InitPlugins() { for _, f := range srcs { if strings.HasSuffix(f, ".lua") { p.Srcs = append(p.Srcs, assetFile(filepath.Join(plugdir, d, f))) - } else if strings.HasSuffix(f, ".json") { + } else if f == "repo.json" { data, err := rt.Asset(filepath.Join(plugdir, d, f)) if err != nil { continue From 290d8071beba86a7cc07463afe4a5910bf476ab2 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Tue, 29 Sep 2026 00:07:34 +0200 Subject: [PATCH 2/2] plugins: Don't parse repo.json for built-in plugins Built-in plugins don't have repo.json and never will, there is no point in checking if they have one, this only results in code duplication and dead code. --- internal/config/rtfiles.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/internal/config/rtfiles.go b/internal/config/rtfiles.go index e114419395..2cd331acf5 100644 --- a/internal/config/rtfiles.go +++ b/internal/config/rtfiles.go @@ -247,16 +247,6 @@ func InitPlugins() { for _, f := range srcs { if strings.HasSuffix(f, ".lua") { p.Srcs = append(p.Srcs, assetFile(filepath.Join(plugdir, d, f))) - } else if f == "repo.json" { - data, err := rt.Asset(filepath.Join(plugdir, d, f)) - if err != nil { - continue - } - p.Info, err = NewPluginInfo(data) - if err != nil { - continue - } - p.Name = p.Info.Name } } if !isID(p.Name) || len(p.Srcs) <= 0 {