mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-16 21:15:29 +00:00
When a package names a `repo` that isn't a GitHub repository URL (`https://github.com/<owner>/<repo>`, a trailing `/` or `.git` allowed, or a folder in one, `.../tree/<ref>/<path>`), Install, Update and Preview now refuse its release URLs with an error naming the package. Before, such a `repo` skipped the repository check and any GitHub release asset was downloaded. A package without a `repo` keeps any repository's release asset. The example catalog's schema now holds `repo` and release `url` to the same forms, and `scripts/validate.sh` checks that every release is an asset of the package's `repo` before it downloads anything.
55 lines
2.5 KiB
JSON
55 lines
2.5 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://raw.githubusercontent.com/storytold/effectcraft-plugins/main/schema.json",
|
|
"title": "EffectCraft Plug-in Library catalog (index.json), format 1",
|
|
"description": "Mirrors crates/engine/src/system/library.rs (parse_catalog). Unknown fields are rejected here to catch typos; the app itself ignores them.",
|
|
"type": "object",
|
|
"required": ["schema", "packages"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"schema": {"const": 1},
|
|
"packages": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/package"}}
|
|
},
|
|
"$defs": {
|
|
"version": {"type": "string", "maxLength": 32, "pattern": "^[0-9]+(\\.[0-9]+)*$"},
|
|
"release_url": {
|
|
"type": "string",
|
|
"pattern": "^(?!.*/(\\.|%2[eE]){1,2}(/|$))https://[Gg][Ii][Tt][Hh][Uu][Bb]\\.[Cc][Oo][Mm]/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+/releases/download/[^/?#\\\\\\s]+(/[^/?#\\\\\\s]+)+$"
|
|
},
|
|
"package": {
|
|
"type": "object",
|
|
"required": ["id", "name", "versions"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9._-]{1,100}$"},
|
|
"name": {"type": "string", "pattern": "\\S"},
|
|
"author": {"type": "string"},
|
|
"description": {"type": "string"},
|
|
"license": {"type": "string"},
|
|
"repo": {"type": "string", "pattern": "^(?!.*/(\\.|%2[eE]){1,2}(/|$))[Hh][Tt][Tt][Pp][Ss]://[Gg][Ii][Tt][Hh][Uu][Bb]\\.[Cc][Oo][Mm]/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+(/tree(/[^/?#\\\\\\s]+)+)?/?$"},
|
|
"tags": {"type": "array", "items": {"type": "string"}},
|
|
"preview": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {"video": {"type": "string", "pattern": "^https://[^\\s]+$"}}
|
|
},
|
|
"versions": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/release"}}
|
|
}
|
|
},
|
|
"release": {
|
|
"type": "object",
|
|
"required": ["version", "api", "url", "sha256", "effects"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"version": {"$ref": "#/$defs/version"},
|
|
"api": {"type": "integer", "minimum": 0, "maximum": 4294967295},
|
|
"minApp": {"$ref": "#/$defs/version"},
|
|
"url": {"$ref": "#/$defs/release_url"},
|
|
"sha256": {"type": "string", "pattern": "^[0-9a-fA-F]{64}$"},
|
|
"size": {"type": "integer", "minimum": 1, "maximum": 67108864},
|
|
"effects": {"type": "array", "minItems": 1, "items": {"type": "string", "pattern": "^(?!ec\\.)[A-Za-z0-9._-]+$"}}
|
|
}
|
|
}
|
|
}
|
|
}
|