From 54c9d2e19dc1d9247ef3477a945bc5af64e09c74 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 30 Apr 2025 21:39:31 +0300 Subject: [PATCH] fix codegen script --- package.json | 2 +- src/moderation/const/.gitkeep | 0 src/moderation/const/labels.ts | 220 +++++++++++++++++++++++++++++++++ 3 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 src/moderation/const/.gitkeep create mode 100644 src/moderation/const/labels.ts diff --git a/package.json b/package.json index 12ab82d8f5..4f17bd6920 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "open-analyzer": "EXPO_PUBLIC_OPEN_ANALYZER=1 yarn build-web", "icons:optimize": "svgo -f ./assets/icons", "lexicons:sync": "rm -rf lexicons definitions scripts/code scripts/generate-code.mjs && degit bluesky-social/atproto/lexicons#main lexicons && degit bluesky-social/atproto/packages/api/scripts#main scripts --force && degit bluesky-social/atproto/packages/api/definitions#main definitions", - "lexicons:codegen": "node node ./scripts/generate-code.mjs && lex gen-api --yes ./src/agent ./lexicons/com/atproto/*/* ./lexicons/app/bsky/*/* ./lexicons/chat/bsky/*/* ./lexicons/tools/ozone/*/* && eslint --fix && prettier -w ./src/agent/**/*.*" + "lexicons:codegen": "node ./scripts/generate-code.mjs && lex gen-api --yes ./src/agent ./lexicons/com/atproto/*/* ./lexicons/app/bsky/*/* ./lexicons/chat/bsky/*/* ./lexicons/tools/ozone/*/* && eslint --fix && prettier -w ./src/agent/**/*.*" }, "dependencies": { "@atproto/api": "^0.15.3", diff --git a/src/moderation/const/.gitkeep b/src/moderation/const/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/moderation/const/labels.ts b/src/moderation/const/labels.ts new file mode 100644 index 0000000000..e5e16cdf2a --- /dev/null +++ b/src/moderation/const/labels.ts @@ -0,0 +1,220 @@ +/** this doc is generated by ./scripts/code/labels.mjs **/ +import {type InterpretedLabelValueDefinition, type LabelPreference} from '../types' + +export type KnownLabelValue = + | '!hide' + | '!warn' + | '!no-unauthenticated' + | 'porn' + | 'sexual' + | 'nudity' + | 'graphic-media' + | 'gore' + +export const DEFAULT_LABEL_SETTINGS: Record = { + porn: 'hide', + sexual: 'warn', + nudity: 'ignore', + 'graphic-media': 'warn', +} + +export const LABELS: Record = + { + '!hide': { + identifier: '!hide', + configurable: false, + defaultSetting: 'hide', + flags: ['no-override', 'no-self'], + severity: 'alert', + blurs: 'content', + behaviors: { + account: { + profileList: 'blur', + profileView: 'blur', + avatar: 'blur', + banner: 'blur', + displayName: 'blur', + contentList: 'blur', + contentView: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + displayName: 'blur', + }, + content: { + contentList: 'blur', + contentView: 'blur', + }, + }, + locales: [], + }, + '!warn': { + identifier: '!warn', + configurable: false, + defaultSetting: 'warn', + flags: ['no-self'], + severity: 'none', + blurs: 'content', + behaviors: { + account: { + profileList: 'blur', + profileView: 'blur', + avatar: 'blur', + banner: 'blur', + contentList: 'blur', + contentView: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + displayName: 'blur', + }, + content: { + contentList: 'blur', + contentView: 'blur', + }, + }, + locales: [], + }, + '!no-unauthenticated': { + identifier: '!no-unauthenticated', + configurable: false, + defaultSetting: 'hide', + flags: ['no-override', 'unauthed'], + severity: 'none', + blurs: 'content', + behaviors: { + account: { + profileList: 'blur', + profileView: 'blur', + avatar: 'blur', + banner: 'blur', + displayName: 'blur', + contentList: 'blur', + contentView: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + displayName: 'blur', + }, + content: { + contentList: 'blur', + contentView: 'blur', + }, + }, + locales: [], + }, + porn: { + identifier: 'porn', + configurable: true, + defaultSetting: 'hide', + flags: ['adult'], + severity: 'none', + blurs: 'media', + behaviors: { + account: { + avatar: 'blur', + banner: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + }, + content: { + contentMedia: 'blur', + }, + }, + locales: [], + }, + sexual: { + identifier: 'sexual', + configurable: true, + defaultSetting: 'warn', + flags: ['adult'], + severity: 'none', + blurs: 'media', + behaviors: { + account: { + avatar: 'blur', + banner: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + }, + content: { + contentMedia: 'blur', + }, + }, + locales: [], + }, + nudity: { + identifier: 'nudity', + configurable: true, + defaultSetting: 'ignore', + flags: [], + severity: 'none', + blurs: 'media', + behaviors: { + account: { + avatar: 'blur', + banner: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + }, + content: { + contentMedia: 'blur', + }, + }, + locales: [], + }, + 'graphic-media': { + identifier: 'graphic-media', + flags: ['adult'], + configurable: true, + defaultSetting: 'warn', + severity: 'none', + blurs: 'media', + behaviors: { + account: { + avatar: 'blur', + banner: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + }, + content: { + contentMedia: 'blur', + }, + }, + locales: [], + }, + /** @deprecated alias for `graphic-media` */ + gore: { + identifier: 'gore', + flags: ['adult'], + configurable: true, + defaultSetting: 'warn', + severity: 'none', + blurs: 'media', + behaviors: { + account: { + avatar: 'blur', + banner: 'blur', + }, + profile: { + avatar: 'blur', + banner: 'blur', + }, + content: { + contentMedia: 'blur', + }, + }, + locales: [], + }, + }