Allow plugins to specify a ReleaseNotesURL via manifest (#13677)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f888bd4fc
Коммит
cb49d560ab
@@ -154,6 +154,9 @@ type Manifest struct {
|
||||
// SupportURL is an optional URL where plugin issues can be reported.
|
||||
SupportURL string `json:"support_url,omitempty" yaml:"support_url,omitempty"`
|
||||
|
||||
// ReleaseNotesURL is an optional URL where a changelog for the release can be found.
|
||||
ReleaseNotesURL string `json:"release_notes_url,omitempty" yaml:"release_notes_url,omitempty"`
|
||||
|
||||
// A relative file path in the bundle that points to the plugins svg icon for use with the Plugin Marketplace.
|
||||
// This should be relative to the root of your bundle and the location of the manifest file. Bitmap image formats are not supported.
|
||||
IconPath string `json:"icon_path,omitempty" yaml:"icon_path,omitempty"`
|
||||
@@ -330,6 +333,10 @@ func (m *Manifest) IsValid() error {
|
||||
return errors.New("invalid SupportURL")
|
||||
}
|
||||
|
||||
if m.ReleaseNotesURL != "" && !IsValidHttpUrl(m.ReleaseNotesURL) {
|
||||
return errors.New("invalid SupportURL")
|
||||
}
|
||||
|
||||
_, err := semver.Parse(m.Version)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to parse Version")
|
||||
|
||||
@@ -25,7 +25,8 @@ func TestIsValid(t *testing.T) {
|
||||
}{
|
||||
{"Invalid Id", &Manifest{Id: "some id"}, true},
|
||||
{"Invalid homePageURL", &Manifest{Id: "com.company.test", HomepageURL: "some url"}, true},
|
||||
{"Invalid supportURL", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "some url"}, true},
|
||||
{"Invalid supportURL", &Manifest{Id: "com.company.test", SupportURL: "some url"}, true},
|
||||
{"Invalid ReleaseNotesURL", &Manifest{Id: "com.company.test", ReleaseNotesURL: "some url"}, true},
|
||||
{"Invalid version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "version"}, true},
|
||||
{"Invalid min version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "version"}, true},
|
||||
{"SettingSchema error", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "5.10.8", SettingsSchema: &PluginSettingsSchema{
|
||||
@@ -37,6 +38,7 @@ func TestIsValid(t *testing.T) {
|
||||
Description: "thedescription",
|
||||
HomepageURL: "http://someurl.com",
|
||||
SupportURL: "http://someotherurl.com",
|
||||
ReleaseNotesURL: "http://someotherurl.com/releases/v0.0.1",
|
||||
Version: "0.0.1",
|
||||
MinServerVersion: "5.6.0",
|
||||
Server: &ManifestServer{
|
||||
|
||||
Ссылка в новой задаче
Block a user