mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-14 07:54:31 +01:00
Fix lint
This commit is contained in:
parent
2c56b90cd4
commit
75fd8b5b3e
@ -1,3 +1,6 @@
|
|||||||
|
//go:build js && wasm
|
||||||
|
// +build js,wasm
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
package renderplugin
|
package renderplugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/modules/json"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ type Manifest struct {
|
|||||||
// Normalize validates mandatory fields and normalizes values.
|
// Normalize validates mandatory fields and normalizes values.
|
||||||
func (m *Manifest) Normalize() error {
|
func (m *Manifest) Normalize() error {
|
||||||
if m.SchemaVersion == 0 {
|
if m.SchemaVersion == 0 {
|
||||||
return fmt.Errorf("manifest schemaVersion is required")
|
return errors.New("manifest schemaVersion is required")
|
||||||
}
|
}
|
||||||
if m.SchemaVersion != SupportedManifestVersion {
|
if m.SchemaVersion != SupportedManifestVersion {
|
||||||
return fmt.Errorf("manifest schemaVersion %d is not supported", m.SchemaVersion)
|
return fmt.Errorf("manifest schemaVersion %d is not supported", m.SchemaVersion)
|
||||||
@ -44,11 +45,11 @@ func (m *Manifest) Normalize() error {
|
|||||||
}
|
}
|
||||||
m.Name = strings.TrimSpace(m.Name)
|
m.Name = strings.TrimSpace(m.Name)
|
||||||
if m.Name == "" {
|
if m.Name == "" {
|
||||||
return fmt.Errorf("manifest name is required")
|
return errors.New("manifest name is required")
|
||||||
}
|
}
|
||||||
m.Version = strings.TrimSpace(m.Version)
|
m.Version = strings.TrimSpace(m.Version)
|
||||||
if m.Version == "" {
|
if m.Version == "" {
|
||||||
return fmt.Errorf("manifest version is required")
|
return errors.New("manifest version is required")
|
||||||
}
|
}
|
||||||
if m.Entry == "" {
|
if m.Entry == "" {
|
||||||
m.Entry = "render.js"
|
m.Entry = "render.js"
|
||||||
@ -66,7 +67,7 @@ func (m *Manifest) Normalize() error {
|
|||||||
cleanPatterns = append(cleanPatterns, pattern)
|
cleanPatterns = append(cleanPatterns, pattern)
|
||||||
}
|
}
|
||||||
if len(cleanPatterns) == 0 {
|
if len(cleanPatterns) == 0 {
|
||||||
return fmt.Errorf("manifest must declare at least one file pattern")
|
return errors.New("manifest must declare at least one file pattern")
|
||||||
}
|
}
|
||||||
sort.Strings(cleanPatterns)
|
sort.Strings(cleanPatterns)
|
||||||
m.FilePatterns = cleanPatterns
|
m.FilePatterns = cleanPatterns
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
package renderplugin
|
package renderplugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/modules/json"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/renderplugin"
|
"code.gitea.io/gitea/modules/renderplugin"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|||||||
@ -216,7 +216,7 @@ func findManifest(root string) (string, error) {
|
|||||||
}
|
}
|
||||||
if strings.EqualFold(d.Name(), "manifest.json") {
|
if strings.EqualFold(d.Name(), "manifest.json") {
|
||||||
if manifestPath != "" {
|
if manifestPath != "" {
|
||||||
return fmt.Errorf("multiple manifest.json files found")
|
return errors.New("multiple manifest.json files found")
|
||||||
}
|
}
|
||||||
manifestPath = path
|
manifestPath = path
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ func uploadPluginDir(identifier, src string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if d.Type()&os.ModeSymlink != 0 {
|
if d.Type()&os.ModeSymlink != 0 {
|
||||||
return fmt.Errorf("symlinks are not supported inside plugin archives")
|
return errors.New("symlinks are not supported inside plugin archives")
|
||||||
}
|
}
|
||||||
rel, err := filepath.Rel(src, path)
|
rel, err := filepath.Rel(src, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -38,28 +38,18 @@
|
|||||||
{{ctx.Locale.Tr "packages.title"}}
|
{{ctx.Locale.Tr "packages.title"}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
<a class="{{if .PageIsAdminRenderPlugins}}active {{end}}item" href="{{AppSubUrl}}/-/admin/render-plugins">
|
|
||||||
{{ctx.Locale.Tr "admin.render_plugins"}}
|
|
||||||
</a>
|
|
||||||
<a class="{{if .PageIsAdminRepositories}}active {{end}}item" href="{{AppSubUrl}}/-/admin/repos">
|
<a class="{{if .PageIsAdminRepositories}}active {{end}}item" href="{{AppSubUrl}}/-/admin/repos">
|
||||||
{{ctx.Locale.Tr "admin.repositories"}}
|
{{ctx.Locale.Tr "admin.repositories"}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
<!-- Webhooks and OAuth can be both disabled here, so add this if statement to display different ui -->
|
<!-- Webhooks and OAuth can be both disabled here, so add this if statement to display different ui -->
|
||||||
{{if and (not DisableWebhooks) .EnableOAuth2}}
|
<details class="item toggleable-item" {{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks .PageIsAdminApplications .PageIsAdminRenderPlugins}}open{{end}}>
|
||||||
<details class="item toggleable-item" {{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks .PageIsAdminApplications}}open{{end}}>
|
|
||||||
<summary>{{ctx.Locale.Tr "admin.integrations"}}</summary>
|
<summary>{{ctx.Locale.Tr "admin.integrations"}}</summary>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/applications">
|
<a class="{{if .PageIsAdminRenderPlugins}}active {{end}}item" href="{{AppSubUrl}}/-/admin/render-plugins">
|
||||||
{{ctx.Locale.Tr "settings.applications"}}
|
{{ctx.Locale.Tr "admin.render_plugins"}}
|
||||||
</a>
|
</a>
|
||||||
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/-/admin/hooks">
|
|
||||||
{{ctx.Locale.Tr "admin.hooks"}}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
{{else}}
|
|
||||||
{{if not DisableWebhooks}}
|
{{if not DisableWebhooks}}
|
||||||
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/-/admin/hooks">
|
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/-/admin/hooks">
|
||||||
{{ctx.Locale.Tr "admin.hooks"}}
|
{{ctx.Locale.Tr "admin.hooks"}}
|
||||||
@ -70,7 +60,8 @@
|
|||||||
{{ctx.Locale.Tr "settings.applications"}}
|
{{ctx.Locale.Tr "settings.applications"}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
</div>
|
||||||
|
</details>
|
||||||
{{if .EnableActions}}
|
{{if .EnableActions}}
|
||||||
<details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsVariables}}open{{end}}>
|
<details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsVariables}}open{{end}}>
|
||||||
<summary>{{ctx.Locale.Tr "actions.actions"}}</summary>
|
<summary>{{ctx.Locale.Tr "actions.actions"}}</summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user