Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion schema/app-block.manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@
"maxItems": 32,
"items": { "$ref": "#/$defs/storageMigrationOp" }
},
"keyedBy": {
"type": "string",
"description": "Shared collections with `write` \"own\" only (not kind \"log\"). The server derives each document's key from the signed-in viewer, so each viewer has at most one document (\"viewer\") or at most one per parent key the app names (\"parent+viewer\"), and no viewer can write another's. The app reads and writes it at `/:collection/@me` or `/:collection/@me/:parent`, where a parent is 1 to 96 characters of A-Z, a-z, 0-9, `.`, `_` or `-` (not only dots); a \"parent+viewer\" key is `<parent>:<digest>`, so listing with `keyPrefix=<parent>:` returns one parent's documents. Writing such a collection by key, creating in it, publishing into it and counters or marks on it are refused (it declares none). Cannot be added, removed or changed on a collection any approved version declared: declare a new collection instead.",
"enum": ["viewer", "parent+viewer"]
},
"hook": {
"description": "Optional, in a limited rollout: civitai.com accepts a new or changed hook only from authors the rollout includes, and refuses it otherwise. A permission hook: one ES module of the bundle whose default export decides, for every write to this collection, whether the write is allowed. It runs after the collection `schema` check, never instead of it. `file` is the hook's path in the submitted bundle, shipped verbatim — a committed source file, not a build output, so it must not be inside `outputDir` or `node_modules`; one self-contained module with no imports, at most 65536 bytes of UTF-8 text. `sha256` is the SHA-256 of that file's bytes as 64 lowercase hex characters: submit, the git-push path and approve each refuse a version whose file is missing or does not match it. `timeoutMs` is the most time one call may take, from 1 to 500 (omitted means 50). One file used by several collections must be pinned with the same sha256 in each.",
"$ref": "#/$defs/storageCollectionHook"
Expand Down Expand Up @@ -565,7 +570,8 @@
"showAuthor": false,
"dailyWritesPerAuthor": false,
"ownedModelVersions": false,
"registry": false
"registry": false,
"keyedBy": false
}
}
},
Expand Down Expand Up @@ -593,6 +599,24 @@
},
"then": { "properties": { "ownedModelVersions": false } }
},
{
"$comment": "A viewer-keyed collection's viewer is the author of every key they address, so it is declared only under write:\"own\" (private collections are refused above); log entries have server keys.",
"if": {
"anyOf": [
{
"required": ["write"],
"properties": { "write": { "enum": ["anyone", "owner", "none"] } }
},
{ "required": ["kind"], "properties": { "kind": { "const": "log" } } }
]
},
"then": { "properties": { "keyedBy": false } }
},
{
"$comment": "A viewer-keyed document is itself the viewer's vote or entry, so a viewer-keyed collection declares no counters or marks.",
"if": { "required": ["keyedBy"] },
"then": { "properties": { "counters": false, "marks": false } }
},
{
"$comment": "A write:\"none\" collection is written only through counters and marks, so it must declare at least one.",
"if": {
Expand Down
Loading