From bebb77b34c937f147df4a66f683760977207695d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 4 Jan 2024 12:22:58 -0800 Subject: [PATCH 1/7] Lexicons: Add labeler prefs, labeler declaration, and get labeler routes --- lexicons/app/bsky/actor/defs.json | 36 ++++++++ lexicons/app/bsky/label/defs.json | 103 +++++++++++++++++++++++ lexicons/app/bsky/label/getLabeler.json | 30 +++++++ lexicons/app/bsky/label/getLabelers.json | 36 ++++++++ lexicons/app/bsky/label/labeler.json | 43 ++++++++++ 5 files changed, 248 insertions(+) create mode 100644 lexicons/app/bsky/label/defs.json create mode 100644 lexicons/app/bsky/label/getLabeler.json create mode 100644 lexicons/app/bsky/label/getLabelers.json create mode 100644 lexicons/app/bsky/label/labeler.json diff --git a/lexicons/app/bsky/actor/defs.json b/lexicons/app/bsky/actor/defs.json index 913957f1291..9dbf4ae3de4 100644 --- a/lexicons/app/bsky/actor/defs.json +++ b/lexicons/app/bsky/actor/defs.json @@ -199,6 +199,42 @@ "description": "Show followed users at the top of all replies." } } + }, + "labelersPref": { + "type": "object", + "required": ["labelers"], + "properties": { + "labelers": { + "type": "array", + "items": { + "type": "object", + "required": ["uri", "enabled", "labelGroupSettings"], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "enabled": { + "type": "boolean" + }, + "labelGroupSettings": { + "type": "array", + "items": { + "type": "object", + "required": ["labelGroup", "visibility"], + "properties": { + "labelGroup": { "type": "string" }, + "visibility": { + "type": "string", + "knownValues": ["show", "warn", "hide"] + } + } + } + } + } + } + } + } } } } diff --git a/lexicons/app/bsky/label/defs.json b/lexicons/app/bsky/label/defs.json new file mode 100644 index 00000000000..84b5ab384cb --- /dev/null +++ b/lexicons/app/bsky/label/defs.json @@ -0,0 +1,103 @@ +{ + "lexicon": 1, + "id": "app.bsky.label.defs", + "defs": { + "labelerView": { + "type": "object", + "required": ["uri", "cid", "did", "creator", "displayName", "indexedAt"], + "properties": { + "uri": { "type": "string", "format": "at-uri" }, + "cid": { "type": "string", "format": "cid" }, + "did": { "type": "string", "format": "did" }, + "creator": { "type": "ref", "ref": "app.bsky.actor.defs#profileView" }, + "displayName": { "type": "string" }, + "description": { + "type": "string", + "maxGraphemes": 300, + "maxLength": 3000 + }, + "descriptionFacets": { + "type": "array", + "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } + }, + "avatar": { "type": "string" }, + "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, + "likeCount": { "type": "integer", "minimum": 0 }, + "viewer": { "type": "ref", "ref": "#labelerViewerState" }, + "indexedAt": { "type": "string", "format": "datetime" } + } + }, + "labelerViewerState": { + "type": "object", + "properties": { + "like": { "type": "string", "format": "at-uri" } + } + }, + "labelerPolicies": { + "type": "object", + "required": ["reportReasons", "labelValues"], + "properties": { + "description": { + "type": "string", + "maxGraphemes": 10000, + "maxLength": 100000 + }, + "descriptionFacets": { + "type": "array", + "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } + }, + "reportReasons": { + "type": "array", + "items": { + "type": "string", + "knownValues": [ + "com.atproto.moderation.defs#reasonSpam", + "com.atproto.moderation.defs#reasonViolation", + "com.atproto.moderation.defs#reasonMisleading", + "com.atproto.moderation.defs#reasonSexual", + "com.atproto.moderation.defs#reasonRude", + "com.atproto.moderation.defs#reasonOther", + "com.atproto.moderation.defs#reasonAppeal" + ] + } + }, + "labelValues": { + "type": "array", + "items": { + "type": "string", + "knownValues": [ + "!hide", + "!no-promote", + "!warn", + "!no-unauthenticated", + "dmca-violation", + "doxxing", + "porn", + "sexual", + "nudity", + "nsfl", + "corpse", + "gore", + "torture", + "self-harm", + "intolerant-race", + "intolerant-gender", + "intolerant-sexual-orientation", + "intolerant-religion", + "intolerant", + "icon-intolerant", + "threat", + "spoiler", + "spam", + "account-security", + "net-abuse", + "impersonation", + "scam", + "misleading" + ] + } + } + } + } + } +} diff --git a/lexicons/app/bsky/label/getLabeler.json b/lexicons/app/bsky/label/getLabeler.json new file mode 100644 index 00000000000..feb26f6bdef --- /dev/null +++ b/lexicons/app/bsky/label/getLabeler.json @@ -0,0 +1,30 @@ +{ + "lexicon": 1, + "id": "app.bsky.label.getLabeler", + "defs": { + "main": { + "type": "query", + "description": "Get information about a labeler.", + "parameters": { + "type": "params", + "required": ["labeler"], + "properties": { + "labeler": { "type": "string", "format": "at-uri" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["view"], + "properties": { + "view": { + "type": "ref", + "ref": "app.bsky.label.defs#labelerView" + } + } + } + } + } + } +} diff --git a/lexicons/app/bsky/label/getLabelers.json b/lexicons/app/bsky/label/getLabelers.json new file mode 100644 index 00000000000..1d69cfd7ea4 --- /dev/null +++ b/lexicons/app/bsky/label/getLabelers.json @@ -0,0 +1,36 @@ +{ + "lexicon": 1, + "id": "app.bsky.label.getLabelers", + "defs": { + "main": { + "type": "query", + "description": "Get information about a list of labelers.", + "parameters": { + "type": "params", + "required": ["labelers"], + "properties": { + "labelers": { + "type": "array", + "items": { "type": "string", "format": "at-uri" } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["labelers"], + "properties": { + "labelers": { + "type": "array", + "items": { + "type": "ref", + "ref": "app.bsky.label.defs#labelerView" + } + } + } + } + } + } + } +} diff --git a/lexicons/app/bsky/label/labeler.json b/lexicons/app/bsky/label/labeler.json new file mode 100644 index 00000000000..5c8b82143d4 --- /dev/null +++ b/lexicons/app/bsky/label/labeler.json @@ -0,0 +1,43 @@ +{ + "lexicon": 1, + "id": "app.bsky.label.laneler", + "defs": { + "main": { + "type": "record", + "description": "A declaration of the existence of labeler.", + "key": "any", + "record": { + "type": "object", + "required": ["did", "displayName", "policies", "createdAt"], + "properties": { + "did": { "type": "string", "format": "did" }, + "displayName": { + "type": "string", + "maxGraphemes": 24, + "maxLength": 240 + }, + "description": { + "type": "string", + "maxGraphemes": 300, + "maxLength": 3000 + }, + "descriptionFacets": { + "type": "array", + "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } + }, + "avatar": { + "type": "blob", + "accept": ["image/png", "image/jpeg"], + "maxSize": 1000000 + }, + "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, + "labels": { + "type": "union", + "refs": ["com.atproto.label.defs#selfLabels"] + }, + "createdAt": { "type": "string", "format": "datetime" } + } + } + } + } +} From 59d6cf743813eb91cee7fde4821c796e39de8189 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 4 Jan 2024 13:16:54 -0800 Subject: [PATCH 2/7] Add labelerViewBasic and update embed views --- lexicons/app/bsky/embed/record.json | 3 ++- lexicons/app/bsky/label/defs.json | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lexicons/app/bsky/embed/record.json b/lexicons/app/bsky/embed/record.json index 4b3d4f814a5..d649b2fef17 100644 --- a/lexicons/app/bsky/embed/record.json +++ b/lexicons/app/bsky/embed/record.json @@ -21,7 +21,8 @@ "#viewNotFound", "#viewBlocked", "app.bsky.feed.defs#generatorView", - "app.bsky.graph.defs#listView" + "app.bsky.graph.defs#listView", + "app.bsky.label.defs#labelerViewBasic" ] } } diff --git a/lexicons/app/bsky/label/defs.json b/lexicons/app/bsky/label/defs.json index 84b5ab384cb..21e489939c6 100644 --- a/lexicons/app/bsky/label/defs.json +++ b/lexicons/app/bsky/label/defs.json @@ -27,6 +27,30 @@ "indexedAt": { "type": "string", "format": "datetime" } } }, + "labelerViewBasic": { + "type": "object", + "required": ["uri", "cid", "did", "creator", "displayName", "indexedAt"], + "properties": { + "uri": { "type": "string", "format": "at-uri" }, + "cid": { "type": "string", "format": "cid" }, + "did": { "type": "string", "format": "did" }, + "creator": { "type": "ref", "ref": "app.bsky.actor.defs#profileView" }, + "displayName": { "type": "string" }, + "description": { + "type": "string", + "maxGraphemes": 300, + "maxLength": 3000 + }, + "descriptionFacets": { + "type": "array", + "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } + }, + "avatar": { "type": "string" }, + "likeCount": { "type": "integer", "minimum": 0 }, + "viewer": { "type": "ref", "ref": "#labelerViewerState" }, + "indexedAt": { "type": "string", "format": "datetime" } + } + }, "labelerViewerState": { "type": "object", "properties": { From 9b944f8038d9223c748a418dd3199eb96f55a3f9 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 4 Jan 2024 13:17:00 -0800 Subject: [PATCH 3/7] Fix typo --- lexicons/app/bsky/label/labeler.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/app/bsky/label/labeler.json b/lexicons/app/bsky/label/labeler.json index 5c8b82143d4..9c171709343 100644 --- a/lexicons/app/bsky/label/labeler.json +++ b/lexicons/app/bsky/label/labeler.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "app.bsky.label.laneler", + "id": "app.bsky.label.labeler", "defs": { "main": { "type": "record", From 03b6ef69b1c46309d7a95e54e59ab0628e7891a3 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 8 Jan 2024 14:35:04 -0800 Subject: [PATCH 4/7] Switch to labelerViewDetailed --- lexicons/app/bsky/embed/record.json | 2 +- lexicons/app/bsky/label/defs.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lexicons/app/bsky/embed/record.json b/lexicons/app/bsky/embed/record.json index d649b2fef17..e652140c842 100644 --- a/lexicons/app/bsky/embed/record.json +++ b/lexicons/app/bsky/embed/record.json @@ -22,7 +22,7 @@ "#viewBlocked", "app.bsky.feed.defs#generatorView", "app.bsky.graph.defs#listView", - "app.bsky.label.defs#labelerViewBasic" + "app.bsky.label.defs#labelerView" ] } } diff --git a/lexicons/app/bsky/label/defs.json b/lexicons/app/bsky/label/defs.json index 21e489939c6..8d515ed99bd 100644 --- a/lexicons/app/bsky/label/defs.json +++ b/lexicons/app/bsky/label/defs.json @@ -21,13 +21,12 @@ "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } }, "avatar": { "type": "string" }, - "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, "likeCount": { "type": "integer", "minimum": 0 }, "viewer": { "type": "ref", "ref": "#labelerViewerState" }, "indexedAt": { "type": "string", "format": "datetime" } } }, - "labelerViewBasic": { + "labelerViewDetailed": { "type": "object", "required": ["uri", "cid", "did", "creator", "displayName", "indexedAt"], "properties": { @@ -46,6 +45,7 @@ "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } }, "avatar": { "type": "string" }, + "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, "likeCount": { "type": "integer", "minimum": 0 }, "viewer": { "type": "ref", "ref": "#labelerViewerState" }, "indexedAt": { "type": "string", "format": "datetime" } From 354d63c7e34f64b2b599e04be4d9e8664360c5b3 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 8 Jan 2024 15:09:22 -0800 Subject: [PATCH 5/7] Move label and report values to refs --- lexicons/app/bsky/label/defs.json | 45 +++---------------------- lexicons/app/bsky/label/getLabeler.json | 2 +- lexicons/com/atproto/label/defs.json | 33 ++++++++++++++++++ 3 files changed, 38 insertions(+), 42 deletions(-) diff --git a/lexicons/app/bsky/label/defs.json b/lexicons/app/bsky/label/defs.json index 8d515ed99bd..e4ef3dec76f 100644 --- a/lexicons/app/bsky/label/defs.json +++ b/lexicons/app/bsky/label/defs.json @@ -73,52 +73,15 @@ "reportReasons": { "type": "array", "items": { - "type": "string", - "knownValues": [ - "com.atproto.moderation.defs#reasonSpam", - "com.atproto.moderation.defs#reasonViolation", - "com.atproto.moderation.defs#reasonMisleading", - "com.atproto.moderation.defs#reasonSexual", - "com.atproto.moderation.defs#reasonRude", - "com.atproto.moderation.defs#reasonOther", - "com.atproto.moderation.defs#reasonAppeal" - ] + "type": "ref", + "ref": "com.atproto.moderation.defs#reasonType" } }, "labelValues": { "type": "array", "items": { - "type": "string", - "knownValues": [ - "!hide", - "!no-promote", - "!warn", - "!no-unauthenticated", - "dmca-violation", - "doxxing", - "porn", - "sexual", - "nudity", - "nsfl", - "corpse", - "gore", - "torture", - "self-harm", - "intolerant-race", - "intolerant-gender", - "intolerant-sexual-orientation", - "intolerant-religion", - "intolerant", - "icon-intolerant", - "threat", - "spoiler", - "spam", - "account-security", - "net-abuse", - "impersonation", - "scam", - "misleading" - ] + "type": "ref", + "ref": "com.atproto.label.defs#labelValue" } } } diff --git a/lexicons/app/bsky/label/getLabeler.json b/lexicons/app/bsky/label/getLabeler.json index feb26f6bdef..8aa61bb676b 100644 --- a/lexicons/app/bsky/label/getLabeler.json +++ b/lexicons/app/bsky/label/getLabeler.json @@ -20,7 +20,7 @@ "properties": { "view": { "type": "ref", - "ref": "app.bsky.label.defs#labelerView" + "ref": "app.bsky.label.defs#labelerViewDetailed" } } } diff --git a/lexicons/com/atproto/label/defs.json b/lexicons/com/atproto/label/defs.json index 06e4e8f9cd2..bbe1096da66 100644 --- a/lexicons/com/atproto/label/defs.json +++ b/lexicons/com/atproto/label/defs.json @@ -61,6 +61,39 @@ "description": "The short string name of the value or type of this label." } } + }, + "labelValue": { + "type": "string", + "knownValues": [ + "!hide", + "!no-promote", + "!warn", + "!no-unauthenticated", + "dmca-violation", + "doxxing", + "porn", + "sexual", + "nudity", + "nsfl", + "corpse", + "gore", + "torture", + "self-harm", + "intolerant-race", + "intolerant-gender", + "intolerant-sexual-orientation", + "intolerant-religion", + "intolerant", + "icon-intolerant", + "threat", + "spoiler", + "spam", + "account-security", + "net-abuse", + "impersonation", + "scam", + "misleading" + ] } } } From d513e5dfc226c0e6bee58776d4ce25b067e47d96 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 8 Jan 2024 15:09:37 -0800 Subject: [PATCH 6/7] Add getActorLabelers --- lexicons/app/bsky/label/getActorLabelers.json | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lexicons/app/bsky/label/getActorLabelers.json diff --git a/lexicons/app/bsky/label/getActorLabelers.json b/lexicons/app/bsky/label/getActorLabelers.json new file mode 100644 index 00000000000..39b219595c0 --- /dev/null +++ b/lexicons/app/bsky/label/getActorLabelers.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "app.bsky.label.getActorLabelers", + "defs": { + "main": { + "type": "query", + "description": "Get a list of labelers created by the actor.", + "parameters": { + "type": "params", + "required": ["actor"], + "properties": { + "actor": { "type": "string", "format": "at-identifier" }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 50 + }, + "cursor": { "type": "string" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["labelers"], + "properties": { + "cursor": { "type": "string" }, + "labelers": { + "type": "array", + "items": { + "type": "ref", + "ref": "app.bsky.label.defs#labelerView" + } + } + } + } + } + } + } +} From 44634436e458b0312067e8d92ef3107b123a731c Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 8 Jan 2024 17:40:09 -0600 Subject: [PATCH 7/7] lint --- lexicons/app/bsky/label/defs.json | 5 ++++- lexicons/app/bsky/label/labeler.json | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lexicons/app/bsky/label/defs.json b/lexicons/app/bsky/label/defs.json index e4ef3dec76f..4065afd6859 100644 --- a/lexicons/app/bsky/label/defs.json +++ b/lexicons/app/bsky/label/defs.json @@ -45,7 +45,10 @@ "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } }, "avatar": { "type": "string" }, - "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, + "policies": { + "type": "ref", + "ref": "app.bsky.label.defs#labelerPolicies" + }, "likeCount": { "type": "integer", "minimum": 0 }, "viewer": { "type": "ref", "ref": "#labelerViewerState" }, "indexedAt": { "type": "string", "format": "datetime" } diff --git a/lexicons/app/bsky/label/labeler.json b/lexicons/app/bsky/label/labeler.json index 9c171709343..ec1973eed70 100644 --- a/lexicons/app/bsky/label/labeler.json +++ b/lexicons/app/bsky/label/labeler.json @@ -30,7 +30,10 @@ "accept": ["image/png", "image/jpeg"], "maxSize": 1000000 }, - "policies": {"type": "ref", "ref": "app.bsky.label.defs#labelerPolicies"}, + "policies": { + "type": "ref", + "ref": "app.bsky.label.defs#labelerPolicies" + }, "labels": { "type": "union", "refs": ["com.atproto.label.defs#selfLabels"]