Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Dec 20, 2024
2 parents 0dfce9b + 6d308b8 commit 2ac0182
Show file tree
Hide file tree
Showing 67 changed files with 410 additions and 280 deletions.
8 changes: 0 additions & 8 deletions .changeset/thick-worms-watch.md

This file was deleted.

6 changes: 6 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @atproto/api

## 0.13.22

### Patch Changes

- [#3270](https://github.com/bluesky-social/atproto/pull/3270) [`f22383cee`](https://github.com/bluesky-social/atproto/commit/f22383cee8feb8b9f761c801ab6e07ad8dc019ed) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Add support for label def aliases, deprecation notices. This provides support for the deprecated `gore` label until a full cleanup effort can be completed.

## 0.13.21

### Patch Changes
Expand Down
1 change: 1 addition & 0 deletions packages/api/definitions/labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
},
{
"identifier": "graphic-media",
"alias": ["gore"],
"flags": ["adult"],
"configurable": true,
"defaultSetting": "warn",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atproto/api",
"version": "0.13.21",
"version": "0.13.22",
"license": "MIT",
"description": "Client library for atproto and Bluesky",
"keywords": [
Expand Down
42 changes: 33 additions & 9 deletions packages/api/scripts/code/labels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,42 @@ writeFileSync(
)

async function gen() {
const knownValues = new Set()
const flattenedLabelDefs = []

for (const { alias: aliases, ...label } of labelsDef) {
knownValues.add(label.identifier)
flattenedLabelDefs.push([label.identifier, { ...label, locales: [] }])

if (aliases) {
for (const alias of aliases) {
knownValues.add(alias)
flattenedLabelDefs.push([
alias,
{
...label,
identifier: alias,
locales: [],
comment: `@deprecated alias for \`${label.identifier}\``,
},
])
}
}
}

let labelDefsStr = `{`
for (const [key, { comment, ...value }] of flattenedLabelDefs) {
const commentStr = comment ? `\n/** ${comment} */\n` : ''
labelDefsStr += `${commentStr}'${key}': ${JSON.stringify(value, null, 2)},`
}
labelDefsStr += `}`

return prettier.format(
`/** this doc is generated by ./scripts/code/labels.mjs **/
import {InterpretedLabelValueDefinition, LabelPreference} from '../types'
export type KnownLabelValue = ${labelsDef
.map((label) => `"${label.identifier}"`)
export type KnownLabelValue = ${Array.from(knownValues)
.map((value) => `"${value}"`)
.join(' | ')}
export const DEFAULT_LABEL_SETTINGS: Record<string, LabelPreference> = ${JSON.stringify(
Expand All @@ -35,13 +65,7 @@ async function gen() {
),
)}
export const LABELS: Record<KnownLabelValue, InterpretedLabelValueDefinition> = ${JSON.stringify(
Object.fromEntries(
labelsDef.map((label) => [label.identifier, { ...label, locales: [] }]),
),
null,
2,
)}
export const LABELS: Record<KnownLabelValue, InterpretedLabelValueDefinition> = ${labelDefsStr}
`,
{ semi: false, parser: 'typescript', singleQuote: true },
)
Expand Down
24 changes: 24 additions & 0 deletions packages/api/src/moderation/const/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type KnownLabelValue =
| 'sexual'
| 'nudity'
| 'graphic-media'
| 'gore'

export const DEFAULT_LABEL_SETTINGS: Record<string, LabelPreference> = {
porn: 'hide',
Expand Down Expand Up @@ -193,4 +194,27 @@ export const LABELS: Record<KnownLabelValue, InterpretedLabelValueDefinition> =
},
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: [],
},
}
7 changes: 7 additions & 0 deletions packages/bsky/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @atproto/bsky

## 0.0.100

### Patch Changes

- Updated dependencies [[`f22383cee`](https://github.com/bluesky-social/atproto/commit/f22383cee8feb8b9f761c801ab6e07ad8dc019ed)]:
- @atproto/api@0.13.22

## 0.0.99

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atproto/bsky",
"version": "0.0.99",
"version": "0.0.100",
"license": "MIT",
"description": "Reference implementation of app.bsky App View (Bluesky API)",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2177,13 +2177,13 @@ export class ChatBskyModerationNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
32 changes: 16 additions & 16 deletions packages/bsky/tests/__snapshots__/feed-generation.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,12 @@ Array [
"$type": "app.bsky.embed.images#view",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(5)/cids(5)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(5)/cids(5)@jpeg",
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(5)/cids(6)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(5)/cids(6)@jpeg",
},
Expand Down Expand Up @@ -727,7 +727,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand All @@ -738,7 +738,7 @@ Array [
},
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down Expand Up @@ -950,12 +950,12 @@ Array [
"$type": "app.bsky.embed.images#view",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(5)/cids(5)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(5)/cids(5)@jpeg",
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(5)/cids(6)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(5)/cids(6)@jpeg",
},
Expand Down Expand Up @@ -1015,7 +1015,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand All @@ -1026,7 +1026,7 @@ Array [
},
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down Expand Up @@ -1180,12 +1180,12 @@ Array [
"$type": "app.bsky.embed.images#view",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(4)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(4)@jpeg",
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(5)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(5)@jpeg",
},
Expand Down Expand Up @@ -1236,7 +1236,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand All @@ -1247,7 +1247,7 @@ Array [
},
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down Expand Up @@ -1477,12 +1477,12 @@ Array [
"$type": "app.bsky.embed.images#view",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(4)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(4)@jpeg",
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(5)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(5)@jpeg",
},
Expand Down Expand Up @@ -1539,7 +1539,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand All @@ -1550,7 +1550,7 @@ Array [
},
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Array [
"$type": "app.bsky.embed.images#view",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(2)/cids(5)@jpeg",
"thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(2)/cids(5)@jpeg",
},
Expand Down Expand Up @@ -176,7 +176,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down Expand Up @@ -303,7 +303,7 @@ Array [
"$type": "app.bsky.embed.images",
"images": Array [
Object {
"alt": "../dev-env/src/seed/img/key-landscape-small.jpg",
"alt": "../dev-env/assets/key-landscape-small.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand All @@ -314,7 +314,7 @@ Array [
},
},
Object {
"alt": "../dev-env/src/seed/img/key-alt.jpg",
"alt": "../dev-env/assets/key-alt.jpg",
"image": Object {
"$type": "blob",
"mimeType": "image/jpeg",
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/tests/image/sharp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('sharp image processor', () => {
})

async function processFixture(fixture: string, options: Options) {
const image = createReadStream(`../dev-env/src/seed/img/${fixture}`)
const image = createReadStream(`../dev-env/assets/${fixture}`)
const resized = await resize(image, options)
return await getInfo(resized)
}
Expand Down
Loading

0 comments on commit 2ac0182

Please sign in to comment.