mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
fix (about): incorrect plugin list
This commit is contained in:
parent
9895842d90
commit
aa3f76ebb0
1 changed files with 11 additions and 24 deletions
|
|
@ -343,12 +343,9 @@ func AboutHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||||
<tr>
|
<tr>
|
||||||
<td> Plugins </td>
|
<td> Plugins </td>
|
||||||
<td>
|
<td>
|
||||||
{{ $oss := (index .Plugins 0) }}
|
|
||||||
{{ $enterprise := (index .Plugins 1) }}
|
|
||||||
{{ $custom := (index .Plugins 2) }}
|
|
||||||
STANDARD[<span class="small">{{ renderPlugin (index .Plugins 0) .CommitHash }}</span>]
|
STANDARD[<span class="small">{{ renderPlugin (index .Plugins 0) .CommitHash }}</span>]
|
||||||
<br/>
|
<br/>
|
||||||
EXTENDED[<span class="small">{{ renderPlugin (index .Plugins 1) "" }}</span>]
|
ENTERPRISE[<span class="small">{{ renderPlugin (index .Plugins 1) "" }}</span>]
|
||||||
<br/>
|
<br/>
|
||||||
CUSTOM[<span class="small">{{ renderPlugin (index .Plugins 2) "" }}</span>]
|
CUSTOM[<span class="small">{{ renderPlugin (index .Plugins 2) "" }}</span>]
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -556,32 +553,22 @@ func ServeIndex(indexPath string) func(*App, http.ResponseWriter, *http.Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitPluginList(code []byte) {
|
func InitPluginList(code []byte) {
|
||||||
listOfPackages := regexp.MustCompile(`github.com/mickael-kerjean/([^\"]+)`).FindAllString(string(code), -1)
|
listOfPackages := regexp.MustCompile(`\t_?\s*\"(github.com/[^\"]+)`).FindAllStringSubmatch(string(code), -1)
|
||||||
for _, packageName := range listOfPackages {
|
for _, packageNameMatch := range listOfPackages {
|
||||||
if packageName == "github.com/mickael-kerjean/filestash/server/common" {
|
if len(packageNameMatch) != 2 {
|
||||||
continue
|
Log.Error("ctrl::static error=assertion_failed msg=invalid_match_size arg=%d", len(packageNameMatch))
|
||||||
}
|
}
|
||||||
|
packageName := packageNameMatch[1]
|
||||||
|
packageShortName := filepath.Base(packageName)
|
||||||
|
|
||||||
if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/server/plugin/") {
|
if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/server/plugin/") {
|
||||||
listOfPlugins["oss"] = append(
|
listOfPlugins["oss"] = append(listOfPlugins["oss"], packageShortName)
|
||||||
listOfPlugins["oss"],
|
|
||||||
strings.TrimPrefix(packageName, "github.com/mickael-kerjean/filestash/server/plugin/"),
|
|
||||||
)
|
|
||||||
} else if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/plugins/") {
|
} else if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/plugins/") {
|
||||||
listOfPlugins["enterprise"] = append(
|
listOfPlugins["enterprise"] = append(listOfPlugins["enterprise"], packageShortName)
|
||||||
listOfPlugins["enterprise"],
|
|
||||||
strings.TrimPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/plugins/"),
|
|
||||||
)
|
|
||||||
} else if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/customers/") {
|
} else if strings.HasPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/customers/") {
|
||||||
listOfPlugins["custom"] = append(
|
listOfPlugins["custom"] = append(listOfPlugins["custom"], packageShortName)
|
||||||
listOfPlugins["custom"],
|
|
||||||
strings.TrimPrefix(packageName, "github.com/mickael-kerjean/filestash/filestash-enterprise/customers/"),
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
listOfPlugins["custom"] = append(
|
listOfPlugins["custom"] = append(listOfPlugins["custom"], packageShortName)
|
||||||
listOfPlugins["custom"],
|
|
||||||
packageName,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue