From 0335354f0bce2cc9b6a2097dc8b25e87556f2001 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sun, 7 Jun 2026 13:26:57 -0500 Subject: [PATCH] feat(manifest): add distribution metadata fields (phase 1 consolidation) Add DisplayName, Maintainer, MaintainerURL, InfoURL, TargetVersion, and PHPMinimum to RepoManifest. These fields were previously only in UpdateStreamConfig and are now in the manifest as the single source of truth. Distribution section shown conditionally for joomla/wordpress/ dolibarr platforms. Closes #582 phase 1. --- models/migrations/migrations.go | 1 + models/migrations/v1_27/v354.go | 20 +++++++++++++++ models/repo/repo_manifest.go | 8 ++++++ options/locale/locale_en-US.json | 7 ++++++ routers/api/v1/repo/manifest.go | 24 ++++++++++++++++++ routers/web/repo/setting/manifest.go | 30 +++++++++++++++++++--- services/repository/manifest_sync.go | 24 +++++++++++++++--- templates/repo/settings/manifest.tmpl | 36 +++++++++++++++++++++++++++ 8 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 models/migrations/v1_27/v354.go diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index b14678056b..b894badff8 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -430,6 +430,7 @@ func prepareMigrationTasks() []*migration { newMigration(350, "Add issue type definitions table", v1_27.AddIssueTypeDefTable), newMigration(351, "Add CDN public flag to attachments", v1_27.AddAttachmentCDNPublic), newMigration(352, "Add version prefix and element name to repo manifest", v1_27.AddManifestVersionPrefixAndElement), + newMigration(353, "Add distribution metadata fields to repo manifest", v1_27.AddManifestDistributionFields), } return preparedMigrations } diff --git a/models/migrations/v1_27/v354.go b/models/migrations/v1_27/v354.go new file mode 100644 index 0000000000..028df2de71 --- /dev/null +++ b/models/migrations/v1_27/v354.go @@ -0,0 +1,20 @@ +// Copyright 2026 Moko Consulting +// SPDX-License-Identifier: GPL-3.0-or-later + +package v1_27 + +import "xorm.io/xorm" + +// AddManifestDistributionFields adds distribution metadata fields to repo_manifest +// for update server feed generation (consolidating from UpdateStreamConfig). +func AddManifestDistributionFields(x *xorm.Engine) error { + type RepoManifest struct { + DisplayName string `xorm:"TEXT 'display_name'"` + Maintainer string `xorm:"TEXT 'maintainer'"` + MaintainerURL string `xorm:"TEXT 'maintainer_url'"` + InfoURL string `xorm:"TEXT 'info_url'"` + TargetVersion string `xorm:"TEXT 'target_version'"` + PHPMinimum string `xorm:"VARCHAR(20) 'php_minimum'"` + } + return x.Sync(new(RepoManifest)) +} diff --git a/models/repo/repo_manifest.go b/models/repo/repo_manifest.go index fe3f6e2e79..989342530c 100644 --- a/models/repo/repo_manifest.go +++ b/models/repo/repo_manifest.go @@ -38,6 +38,14 @@ type RepoManifest struct { VersionPrefix string `xorm:"TEXT 'version_prefix'"` // tag prefix stripped for version display, e.g. "v1.26.1-moko." ElementName string `xorm:"TEXT 'element_name'"` // full element name override, e.g. "pkg_mokowaas" (auto-constructed if empty) + // distribution metadata (used by update server feed generation) + DisplayName string `xorm:"TEXT 'display_name'"` // human-readable name for update feeds, e.g. "Package - MokoWaaS" + Maintainer string `xorm:"TEXT 'maintainer'"` // maintainer/author name + MaintainerURL string `xorm:"TEXT 'maintainer_url'"` // maintainer website + InfoURL string `xorm:"TEXT 'info_url'"` // extension info/product page URL + TargetVersion string `xorm:"TEXT 'target_version'"` // target platform version regex, e.g. "(5|6)\..*" + PHPMinimum string `xorm:"VARCHAR(20) 'php_minimum'"` // minimum PHP version, e.g. "8.1" + // build section Language string `xorm:"VARCHAR(50) 'language'"` // Go, PHP, TypeScript, etc. PackageType string `xorm:"VARCHAR(50) 'package_type'"` // application, library, plugin, module, component, package diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 424a899b2b..6aac6baa77 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -2756,6 +2756,13 @@ "repo.settings.manifest_build": "Build", "repo.settings.manifest_language": "Language", "repo.settings.manifest_package_type": "Package Type", + "repo.settings.manifest_distribution": "Distribution", + "repo.settings.manifest_display_name": "Display Name", + "repo.settings.manifest_maintainer": "Maintainer", + "repo.settings.manifest_maintainer_url": "Maintainer URL", + "repo.settings.manifest_info_url": "Info / Product URL", + "repo.settings.manifest_target_version": "Target Platform Version", + "repo.settings.manifest_php_minimum": "Minimum PHP Version", "repo.settings.manifest_entry_point": "Entry Point", "repo.settings.manifest_save": "Save Manifest", "repo.settings.manifest_saved": "Manifest settings saved.", diff --git a/routers/api/v1/repo/manifest.go b/routers/api/v1/repo/manifest.go index 8b3fb5a8d5..c1cf2d0fd8 100644 --- a/routers/api/v1/repo/manifest.go +++ b/routers/api/v1/repo/manifest.go @@ -24,6 +24,12 @@ type apiManifest struct { Platform string `json:"platform"` StandardsVersion string `json:"standards_version"` StandardsSource string `json:"standards_source"` + DisplayName string `json:"display_name"` + Maintainer string `json:"maintainer"` + MaintainerURL string `json:"maintainer_url"` + InfoURL string `json:"info_url"` + TargetVersion string `json:"target_version"` + PHPMinimum string `json:"php_minimum"` Language string `json:"language"` PackageType string `json:"package_type"` EntryPoint string `json:"entry_point"` @@ -67,6 +73,12 @@ func GetRepoManifest(ctx *context.APIContext) { Platform: m.Platform, StandardsVersion: m.StandardsVersion, StandardsSource: m.StandardsSource, + DisplayName: m.DisplayName, + Maintainer: m.Maintainer, + MaintainerURL: m.MaintainerURL, + InfoURL: m.InfoURL, + TargetVersion: m.TargetVersion, + PHPMinimum: m.PHPMinimum, Language: m.Language, PackageType: m.PackageType, EntryPoint: m.EntryPoint, @@ -104,6 +116,12 @@ func UpdateRepoManifest(ctx *context.APIContext) { Platform: req.Platform, StandardsVersion: req.StandardsVersion, StandardsSource: req.StandardsSource, + DisplayName: req.DisplayName, + Maintainer: req.Maintainer, + MaintainerURL: req.MaintainerURL, + InfoURL: req.InfoURL, + TargetVersion: req.TargetVersion, + PHPMinimum: req.PHPMinimum, Language: req.Language, PackageType: req.PackageType, EntryPoint: req.EntryPoint, @@ -126,6 +144,12 @@ func UpdateRepoManifest(ctx *context.APIContext) { Platform: m.Platform, StandardsVersion: m.StandardsVersion, StandardsSource: m.StandardsSource, + DisplayName: m.DisplayName, + Maintainer: m.Maintainer, + MaintainerURL: m.MaintainerURL, + InfoURL: m.InfoURL, + TargetVersion: m.TargetVersion, + PHPMinimum: m.PHPMinimum, Language: m.Language, PackageType: m.PackageType, EntryPoint: m.EntryPoint, diff --git a/routers/web/repo/setting/manifest.go b/routers/web/repo/setting/manifest.go index a58ad85e5e..808558e8f8 100644 --- a/routers/web/repo/setting/manifest.go +++ b/routers/web/repo/setting/manifest.go @@ -18,10 +18,11 @@ const tplSettingsManifest templates.TplName = "repo/settings/manifest" // manifestXML mirrors the .mokogitea/manifest.xml schema for XML parsing. type manifestXML struct { - XMLName xml.Name `xml:"mokoplatform"` - Identity manifestIdentity `xml:"identity"` - Governance manifestGovernance `xml:"governance"` - Build manifestBuild `xml:"build"` + XMLName xml.Name `xml:"mokoplatform"` + Identity manifestIdentity `xml:"identity"` + Governance manifestGovernance `xml:"governance"` + Distribution manifestDistribution `xml:"distribution"` + Build manifestBuild `xml:"build"` } type manifestIdentity struct { @@ -44,6 +45,15 @@ type manifestGovernance struct { StandardsSource string `xml:"standards-source"` } +type manifestDistribution struct { + DisplayName string `xml:"display-name"` + Maintainer string `xml:"maintainer"` + MaintainerURL string `xml:"maintainer-url"` + InfoURL string `xml:"info-url"` + TargetVersion string `xml:"target-version"` + PHPMinimum string `xml:"php-minimum"` +} + type manifestBuild struct { Language string `xml:"language"` PackageType string `xml:"package-type"` @@ -98,6 +108,12 @@ func ManifestSettingsPost(ctx *context.Context) { Platform: ctx.FormString("platform"), StandardsVersion: ctx.FormString("standards_version"), StandardsSource: ctx.FormString("standards_source"), + DisplayName: ctx.FormString("display_name"), + Maintainer: ctx.FormString("maintainer"), + MaintainerURL: ctx.FormString("maintainer_url"), + InfoURL: ctx.FormString("info_url"), + TargetVersion: ctx.FormString("target_version"), + PHPMinimum: ctx.FormString("php_minimum"), Language: ctx.FormString("language"), PackageType: ctx.FormString("package_type"), EntryPoint: ctx.FormString("entry_point"), @@ -149,6 +165,12 @@ func tryMigrateManifestXML(ctx *context.Context) *repo_model.RepoManifest { Platform: mxml.Governance.Platform, StandardsVersion: mxml.Governance.StandardsVersion, StandardsSource: mxml.Governance.StandardsSource, + DisplayName: mxml.Distribution.DisplayName, + Maintainer: mxml.Distribution.Maintainer, + MaintainerURL: mxml.Distribution.MaintainerURL, + InfoURL: mxml.Distribution.InfoURL, + TargetVersion: mxml.Distribution.TargetVersion, + PHPMinimum: mxml.Distribution.PHPMinimum, Language: mxml.Build.Language, PackageType: mxml.Build.PackageType, EntryPoint: mxml.Build.EntryPoint, diff --git a/services/repository/manifest_sync.go b/services/repository/manifest_sync.go index 6e4685b292..765df0bf37 100644 --- a/services/repository/manifest_sync.go +++ b/services/repository/manifest_sync.go @@ -14,10 +14,20 @@ import ( // manifestXML mirrors the .mokogitea/manifest.xml schema for XML parsing. type manifestXML struct { - XMLName xml.Name `xml:"mokoplatform"` - Identity manifestIdentity `xml:"identity"` - Governance manifestGovernance `xml:"governance"` - Build manifestBuild `xml:"build"` + XMLName xml.Name `xml:"mokoplatform"` + Identity manifestIdentity `xml:"identity"` + Governance manifestGovernance `xml:"governance"` + Distribution manifestDistribution `xml:"distribution"` + Build manifestBuild `xml:"build"` +} + +type manifestDistribution struct { + DisplayName string `xml:"display-name"` + Maintainer string `xml:"maintainer"` + MaintainerURL string `xml:"maintainer-url"` + InfoURL string `xml:"info-url"` + TargetVersion string `xml:"target-version"` + PHPMinimum string `xml:"php-minimum"` } type manifestIdentity struct { @@ -88,6 +98,12 @@ func SyncManifestFromCommit(ctx context.Context, repo *repo_model.Repository, co Platform: mxml.Governance.Platform, StandardsVersion: mxml.Governance.StandardsVersion, StandardsSource: mxml.Governance.StandardsSource, + DisplayName: mxml.Distribution.DisplayName, + Maintainer: mxml.Distribution.Maintainer, + MaintainerURL: mxml.Distribution.MaintainerURL, + InfoURL: mxml.Distribution.InfoURL, + TargetVersion: mxml.Distribution.TargetVersion, + PHPMinimum: mxml.Distribution.PHPMinimum, Language: mxml.Build.Language, PackageType: mxml.Build.PackageType, EntryPoint: mxml.Build.EntryPoint, diff --git a/templates/repo/settings/manifest.tmpl b/templates/repo/settings/manifest.tmpl index 191698dbbf..cb603364e5 100644 --- a/templates/repo/settings/manifest.tmpl +++ b/templates/repo/settings/manifest.tmpl @@ -66,6 +66,42 @@ + {{if or (eq .Manifest.Platform "joomla") (eq .Manifest.Platform "wordpress") (eq .Manifest.Platform "dolibarr")}} +
{{ctx.Locale.Tr "repo.settings.manifest_distribution"}}
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ {{if or (eq .Manifest.Platform "joomla") (eq .Manifest.Platform "wordpress")}} +
+
+ + +
+
+ + +
+
+ {{end}} + {{end}} +
{{ctx.Locale.Tr "repo.settings.manifest_build"}}
-- 2.52.0