feat(plugin): add SCUM ownership migration foundation
This commit is contained in:
@@ -1397,6 +1397,12 @@ func validatePluginPages(pages []domain.GamePluginPage) []string {
|
||||
if !validPluginPagePath(page.Path) {
|
||||
violations = append(violations, prefix+".path is invalid")
|
||||
}
|
||||
if page.Bundle.Key != "" || page.Bundle.Version != "" || page.Bundle.IntegritySHA256 != "" {
|
||||
violations = appendRequired(violations, prefix+".bundle.key", page.Bundle.Key)
|
||||
violations = appendRequired(violations, prefix+".bundle.version", page.Bundle.Version)
|
||||
violations = appendRequired(violations, prefix+".bundle.integritySha256", page.Bundle.IntegritySHA256)
|
||||
if !validDistributionLogicalKey(page.Bundle.Key) || !validPluginPageBundleVersion(page.Bundle.Version) || !validPluginPageBundleIntegrity(page.Bundle.IntegritySHA256) { violations = append(violations, prefix+".bundle is invalid") }
|
||||
}
|
||||
if page.Key != "" {
|
||||
if _, exists := seenKeys[page.Key]; exists {
|
||||
violations = append(violations, prefix+".key duplicates another page")
|
||||
@@ -1414,6 +1420,18 @@ func validatePluginPages(pages []domain.GamePluginPage) []string {
|
||||
return violations
|
||||
}
|
||||
|
||||
func validPluginPageBundleVersion(value string) bool {
|
||||
if len(value) == 0 || len(value) > 80 { return false }
|
||||
for _, item := range value { if !(item >= 'a' && item <= 'z' || item >= 'A' && item <= 'Z' || item >= '0' && item <= '9' || item == '.' || item == '_' || item == '-') { return false } }
|
||||
return true
|
||||
}
|
||||
|
||||
func validPluginPageBundleIntegrity(value string) bool {
|
||||
if len(value) != len("sha256:")+64 || !strings.HasPrefix(value, "sha256:") { return false }
|
||||
for _, item := range value[len("sha256:"):] { if !(item >= 'a' && item <= 'f' || item >= '0' && item <= '9') { return false } }
|
||||
return true
|
||||
}
|
||||
|
||||
func validatePluginFileWorkspace(prefix string, workspace domain.PluginFileWorkspace) []string {
|
||||
if workspace.DefaultDirectoryKey == "" && len(workspace.Directories) == 0 && len(workspace.Files) == 0 && len(workspace.ConfigFields) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user