@atproto/api 0.12.26-next.0 → 0.12.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/bsky-agent.d.ts +23 -1
- package/dist/bsky-agent.d.ts.map +1 -1
- package/dist/bsky-agent.js +106 -42
- package/dist/bsky-agent.js.map +1 -1
- package/dist/client/index.d.ts +24 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +46 -6
- package/dist/client/index.js.map +1 -1
- package/dist/client/lexicons.d.ts +65 -101
- package/dist/client/lexicons.d.ts.map +1 -1
- package/dist/client/lexicons.js +68 -112
- package/dist/client/lexicons.js.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts +5 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/client/types/app/bsky/embed/images.d.ts +10 -3
- package/dist/client/types/app/bsky/embed/images.d.ts.map +1 -1
- package/dist/client/types/app/bsky/embed/images.js +11 -1
- package/dist/client/types/app/bsky/embed/images.js.map +1 -1
- package/dist/client/types/app/bsky/embed/record.d.ts +1 -2
- package/dist/client/types/app/bsky/embed/record.d.ts.map +1 -1
- package/dist/client/types/app/bsky/embed/record.js.map +1 -1
- package/dist/client/types/app/bsky/embed/recordWithMedia.d.ts +2 -3
- package/dist/client/types/app/bsky/embed/recordWithMedia.d.ts.map +1 -1
- package/dist/client/types/app/bsky/embed/recordWithMedia.js.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.d.ts +1 -2
- package/dist/client/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/client/types/app/bsky/feed/detach.d.ts +15 -0
- package/dist/client/types/app/bsky/feed/detach.d.ts.map +1 -0
- package/dist/client/types/app/bsky/feed/detach.js +17 -0
- package/dist/client/types/app/bsky/feed/detach.js.map +1 -0
- package/dist/client/types/app/bsky/feed/post.d.ts +1 -2
- package/dist/client/types/app/bsky/feed/post.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/post.js.map +1 -1
- package/dist/moderation/mutewords.d.ts +2 -1
- package/dist/moderation/mutewords.d.ts.map +1 -1
- package/dist/moderation/mutewords.js +7 -1
- package/dist/moderation/mutewords.js.map +1 -1
- package/dist/moderation/subjects/post.js +13 -0
- package/dist/moderation/subjects/post.js.map +1 -1
- package/package.json +3 -3
- package/src/bsky-agent.ts +139 -45
- package/src/client/index.ts +65 -4
- package/src/client/lexicons.ts +72 -114
- package/src/client/types/app/bsky/actor/defs.ts +5 -0
- package/src/client/types/app/bsky/embed/images.ts +21 -3
- package/src/client/types/app/bsky/embed/record.ts +0 -2
- package/src/client/types/app/bsky/embed/recordWithMedia.ts +0 -3
- package/src/client/types/app/bsky/feed/defs.ts +0 -2
- package/src/client/types/app/bsky/feed/detach.ts +29 -0
- package/src/client/types/app/bsky/feed/post.ts +0 -2
- package/src/moderation/mutewords.ts +11 -0
- package/src/moderation/subjects/post.ts +15 -0
- package/tests/bsky-agent.test.ts +525 -156
- package/tests/moderation-mutewords.test.ts +308 -50
- package/dist/client/types/app/bsky/embed/defs.d.ts +0 -13
- package/dist/client/types/app/bsky/embed/defs.d.ts.map +0 -1
- package/dist/client/types/app/bsky/embed/defs.js +0 -16
- package/dist/client/types/app/bsky/embed/defs.js.map +0 -1
- package/dist/client/types/app/bsky/embed/video.d.ts +0 -33
- package/dist/client/types/app/bsky/embed/video.d.ts.map +0 -1
- package/dist/client/types/app/bsky/embed/video.js +0 -35
- package/dist/client/types/app/bsky/embed/video.js.map +0 -1
- package/src/client/types/app/bsky/embed/defs.ts +0 -26
- package/src/client/types/app/bsky/embed/video.ts +0 -67
package/src/client/lexicons.ts
CHANGED
|
@@ -4341,6 +4341,9 @@ export const schemaDict = {
|
|
|
4341
4341
|
description: 'A word that the account owner has muted.',
|
|
4342
4342
|
required: ['value', 'targets'],
|
|
4343
4343
|
properties: {
|
|
4344
|
+
id: {
|
|
4345
|
+
type: 'string',
|
|
4346
|
+
},
|
|
4344
4347
|
value: {
|
|
4345
4348
|
type: 'string',
|
|
4346
4349
|
description: 'The muted word itself.',
|
|
@@ -4355,6 +4358,19 @@ export const schemaDict = {
|
|
|
4355
4358
|
ref: 'lex:app.bsky.actor.defs#mutedWordTarget',
|
|
4356
4359
|
},
|
|
4357
4360
|
},
|
|
4361
|
+
actorTarget: {
|
|
4362
|
+
type: 'string',
|
|
4363
|
+
description:
|
|
4364
|
+
'Groups of users to apply the muted word to. If undefined, applies to all users.',
|
|
4365
|
+
knownValues: ['all', 'exclude-following'],
|
|
4366
|
+
default: 'all',
|
|
4367
|
+
},
|
|
4368
|
+
expiresAt: {
|
|
4369
|
+
type: 'string',
|
|
4370
|
+
format: 'datetime',
|
|
4371
|
+
description:
|
|
4372
|
+
'The date and time at which the muted word will expire and no longer be applied.',
|
|
4373
|
+
},
|
|
4358
4374
|
},
|
|
4359
4375
|
},
|
|
4360
4376
|
mutedWordsPref: {
|
|
@@ -4762,28 +4778,6 @@ export const schemaDict = {
|
|
|
4762
4778
|
},
|
|
4763
4779
|
},
|
|
4764
4780
|
},
|
|
4765
|
-
AppBskyEmbedDefs: {
|
|
4766
|
-
lexicon: 1,
|
|
4767
|
-
id: 'app.bsky.embed.defs',
|
|
4768
|
-
defs: {
|
|
4769
|
-
aspectRatio: {
|
|
4770
|
-
type: 'object',
|
|
4771
|
-
description:
|
|
4772
|
-
'width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.',
|
|
4773
|
-
required: ['width', 'height'],
|
|
4774
|
-
properties: {
|
|
4775
|
-
width: {
|
|
4776
|
-
type: 'integer',
|
|
4777
|
-
minimum: 1,
|
|
4778
|
-
},
|
|
4779
|
-
height: {
|
|
4780
|
-
type: 'integer',
|
|
4781
|
-
minimum: 1,
|
|
4782
|
-
},
|
|
4783
|
-
},
|
|
4784
|
-
},
|
|
4785
|
-
},
|
|
4786
|
-
},
|
|
4787
4781
|
AppBskyEmbedExternal: {
|
|
4788
4782
|
lexicon: 1,
|
|
4789
4783
|
id: 'app.bsky.embed.external',
|
|
@@ -4888,7 +4882,23 @@ export const schemaDict = {
|
|
|
4888
4882
|
},
|
|
4889
4883
|
aspectRatio: {
|
|
4890
4884
|
type: 'ref',
|
|
4891
|
-
ref: 'lex:app.bsky.embed.
|
|
4885
|
+
ref: 'lex:app.bsky.embed.images#aspectRatio',
|
|
4886
|
+
},
|
|
4887
|
+
},
|
|
4888
|
+
},
|
|
4889
|
+
aspectRatio: {
|
|
4890
|
+
type: 'object',
|
|
4891
|
+
description:
|
|
4892
|
+
'width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.',
|
|
4893
|
+
required: ['width', 'height'],
|
|
4894
|
+
properties: {
|
|
4895
|
+
width: {
|
|
4896
|
+
type: 'integer',
|
|
4897
|
+
minimum: 1,
|
|
4898
|
+
},
|
|
4899
|
+
height: {
|
|
4900
|
+
type: 'integer',
|
|
4901
|
+
minimum: 1,
|
|
4892
4902
|
},
|
|
4893
4903
|
},
|
|
4894
4904
|
},
|
|
@@ -4929,7 +4939,7 @@ export const schemaDict = {
|
|
|
4929
4939
|
},
|
|
4930
4940
|
aspectRatio: {
|
|
4931
4941
|
type: 'ref',
|
|
4932
|
-
ref: 'lex:app.bsky.embed.
|
|
4942
|
+
ref: 'lex:app.bsky.embed.images#aspectRatio',
|
|
4933
4943
|
},
|
|
4934
4944
|
},
|
|
4935
4945
|
},
|
|
@@ -5011,7 +5021,6 @@ export const schemaDict = {
|
|
|
5011
5021
|
type: 'union',
|
|
5012
5022
|
refs: [
|
|
5013
5023
|
'lex:app.bsky.embed.images#view',
|
|
5014
|
-
'lex:app.bsky.embed.video#view',
|
|
5015
5024
|
'lex:app.bsky.embed.external#view',
|
|
5016
5025
|
'lex:app.bsky.embed.record#view',
|
|
5017
5026
|
'lex:app.bsky.embed.recordWithMedia#view',
|
|
@@ -5074,11 +5083,7 @@ export const schemaDict = {
|
|
|
5074
5083
|
},
|
|
5075
5084
|
media: {
|
|
5076
5085
|
type: 'union',
|
|
5077
|
-
refs: [
|
|
5078
|
-
'lex:app.bsky.embed.images',
|
|
5079
|
-
'lex:app.bsky.embed.video',
|
|
5080
|
-
'lex:app.bsky.embed.external',
|
|
5081
|
-
],
|
|
5086
|
+
refs: ['lex:app.bsky.embed.images', 'lex:app.bsky.embed.external'],
|
|
5082
5087
|
},
|
|
5083
5088
|
},
|
|
5084
5089
|
},
|
|
@@ -5094,7 +5099,6 @@ export const schemaDict = {
|
|
|
5094
5099
|
type: 'union',
|
|
5095
5100
|
refs: [
|
|
5096
5101
|
'lex:app.bsky.embed.images#view',
|
|
5097
|
-
'lex:app.bsky.embed.video#view',
|
|
5098
5102
|
'lex:app.bsky.embed.external#view',
|
|
5099
5103
|
],
|
|
5100
5104
|
},
|
|
@@ -5102,85 +5106,6 @@ export const schemaDict = {
|
|
|
5102
5106
|
},
|
|
5103
5107
|
},
|
|
5104
5108
|
},
|
|
5105
|
-
AppBskyEmbedVideo: {
|
|
5106
|
-
lexicon: 1,
|
|
5107
|
-
id: 'app.bsky.embed.video',
|
|
5108
|
-
description: 'A video embedded in a Bluesky record (eg, a post).',
|
|
5109
|
-
defs: {
|
|
5110
|
-
main: {
|
|
5111
|
-
type: 'object',
|
|
5112
|
-
required: ['video'],
|
|
5113
|
-
properties: {
|
|
5114
|
-
video: {
|
|
5115
|
-
type: 'blob',
|
|
5116
|
-
accept: ['video/mp4'],
|
|
5117
|
-
maxSize: 50000000,
|
|
5118
|
-
},
|
|
5119
|
-
captions: {
|
|
5120
|
-
type: 'array',
|
|
5121
|
-
items: {
|
|
5122
|
-
type: 'ref',
|
|
5123
|
-
ref: 'lex:app.bsky.embed.video#caption',
|
|
5124
|
-
},
|
|
5125
|
-
maxLength: 20,
|
|
5126
|
-
},
|
|
5127
|
-
alt: {
|
|
5128
|
-
type: 'string',
|
|
5129
|
-
description:
|
|
5130
|
-
'Alt text description of the video, for accessibility.',
|
|
5131
|
-
maxGraphemes: 1000,
|
|
5132
|
-
maxLength: 10000,
|
|
5133
|
-
},
|
|
5134
|
-
aspectRatio: {
|
|
5135
|
-
type: 'ref',
|
|
5136
|
-
ref: 'lex:app.bsky.embed.defs#aspectRatio',
|
|
5137
|
-
},
|
|
5138
|
-
},
|
|
5139
|
-
},
|
|
5140
|
-
caption: {
|
|
5141
|
-
type: 'object',
|
|
5142
|
-
required: ['lang', 'file'],
|
|
5143
|
-
properties: {
|
|
5144
|
-
lang: {
|
|
5145
|
-
type: 'string',
|
|
5146
|
-
format: 'language',
|
|
5147
|
-
},
|
|
5148
|
-
file: {
|
|
5149
|
-
type: 'blob',
|
|
5150
|
-
accept: ['text/vtt'],
|
|
5151
|
-
maxSize: 20000,
|
|
5152
|
-
},
|
|
5153
|
-
},
|
|
5154
|
-
},
|
|
5155
|
-
view: {
|
|
5156
|
-
type: 'object',
|
|
5157
|
-
required: ['cid', 'playlist'],
|
|
5158
|
-
properties: {
|
|
5159
|
-
cid: {
|
|
5160
|
-
type: 'string',
|
|
5161
|
-
format: 'cid',
|
|
5162
|
-
},
|
|
5163
|
-
playlist: {
|
|
5164
|
-
type: 'string',
|
|
5165
|
-
format: 'uri',
|
|
5166
|
-
},
|
|
5167
|
-
thumbnail: {
|
|
5168
|
-
type: 'string',
|
|
5169
|
-
format: 'uri',
|
|
5170
|
-
},
|
|
5171
|
-
alt: {
|
|
5172
|
-
type: 'string',
|
|
5173
|
-
maxGraphemes: 1000,
|
|
5174
|
-
maxLength: 10000,
|
|
5175
|
-
},
|
|
5176
|
-
aspectRatio: {
|
|
5177
|
-
type: 'ref',
|
|
5178
|
-
ref: 'lex:app.bsky.embed.defs#aspectRatio',
|
|
5179
|
-
},
|
|
5180
|
-
},
|
|
5181
|
-
},
|
|
5182
|
-
},
|
|
5183
|
-
},
|
|
5184
5109
|
AppBskyFeedDefs: {
|
|
5185
5110
|
lexicon: 1,
|
|
5186
5111
|
id: 'app.bsky.feed.defs',
|
|
@@ -5208,7 +5133,6 @@ export const schemaDict = {
|
|
|
5208
5133
|
type: 'union',
|
|
5209
5134
|
refs: [
|
|
5210
5135
|
'lex:app.bsky.embed.images#view',
|
|
5211
|
-
'lex:app.bsky.embed.video#view',
|
|
5212
5136
|
'lex:app.bsky.embed.external#view',
|
|
5213
5137
|
'lex:app.bsky.embed.record#view',
|
|
5214
5138
|
'lex:app.bsky.embed.recordWithMedia#view',
|
|
@@ -5672,6 +5596,42 @@ export const schemaDict = {
|
|
|
5672
5596
|
},
|
|
5673
5597
|
},
|
|
5674
5598
|
},
|
|
5599
|
+
AppBskyFeedDetach: {
|
|
5600
|
+
lexicon: 1,
|
|
5601
|
+
id: 'app.bsky.feed.detach',
|
|
5602
|
+
defs: {
|
|
5603
|
+
main: {
|
|
5604
|
+
type: 'record',
|
|
5605
|
+
key: 'tid',
|
|
5606
|
+
description:
|
|
5607
|
+
'Record defining post URIs detached from a root post. The record key (rkey) of the detach record must match the record key of the root post in question, and that record must be in the same repository.',
|
|
5608
|
+
record: {
|
|
5609
|
+
type: 'object',
|
|
5610
|
+
required: ['post', 'targets', 'updatedAt'],
|
|
5611
|
+
properties: {
|
|
5612
|
+
post: {
|
|
5613
|
+
type: 'string',
|
|
5614
|
+
format: 'at-uri',
|
|
5615
|
+
description: 'Reference (AT-URI) to the post record.',
|
|
5616
|
+
},
|
|
5617
|
+
targets: {
|
|
5618
|
+
type: 'array',
|
|
5619
|
+
maxLength: 50,
|
|
5620
|
+
items: {
|
|
5621
|
+
type: 'string',
|
|
5622
|
+
format: 'at-uri',
|
|
5623
|
+
},
|
|
5624
|
+
description: 'List of detached post URIs.',
|
|
5625
|
+
},
|
|
5626
|
+
updatedAt: {
|
|
5627
|
+
type: 'string',
|
|
5628
|
+
format: 'datetime',
|
|
5629
|
+
},
|
|
5630
|
+
},
|
|
5631
|
+
},
|
|
5632
|
+
},
|
|
5633
|
+
},
|
|
5634
|
+
},
|
|
5675
5635
|
AppBskyFeedGenerator: {
|
|
5676
5636
|
lexicon: 1,
|
|
5677
5637
|
id: 'app.bsky.feed.generator',
|
|
@@ -6563,7 +6523,6 @@ export const schemaDict = {
|
|
|
6563
6523
|
type: 'union',
|
|
6564
6524
|
refs: [
|
|
6565
6525
|
'lex:app.bsky.embed.images',
|
|
6566
|
-
'lex:app.bsky.embed.video',
|
|
6567
6526
|
'lex:app.bsky.embed.external',
|
|
6568
6527
|
'lex:app.bsky.embed.record',
|
|
6569
6528
|
'lex:app.bsky.embed.recordWithMedia',
|
|
@@ -11833,14 +11792,13 @@ export const ids = {
|
|
|
11833
11792
|
AppBskyActorPutPreferences: 'app.bsky.actor.putPreferences',
|
|
11834
11793
|
AppBskyActorSearchActors: 'app.bsky.actor.searchActors',
|
|
11835
11794
|
AppBskyActorSearchActorsTypeahead: 'app.bsky.actor.searchActorsTypeahead',
|
|
11836
|
-
AppBskyEmbedDefs: 'app.bsky.embed.defs',
|
|
11837
11795
|
AppBskyEmbedExternal: 'app.bsky.embed.external',
|
|
11838
11796
|
AppBskyEmbedImages: 'app.bsky.embed.images',
|
|
11839
11797
|
AppBskyEmbedRecord: 'app.bsky.embed.record',
|
|
11840
11798
|
AppBskyEmbedRecordWithMedia: 'app.bsky.embed.recordWithMedia',
|
|
11841
|
-
AppBskyEmbedVideo: 'app.bsky.embed.video',
|
|
11842
11799
|
AppBskyFeedDefs: 'app.bsky.feed.defs',
|
|
11843
11800
|
AppBskyFeedDescribeFeedGenerator: 'app.bsky.feed.describeFeedGenerator',
|
|
11801
|
+
AppBskyFeedDetach: 'app.bsky.feed.detach',
|
|
11844
11802
|
AppBskyFeedGenerator: 'app.bsky.feed.generator',
|
|
11845
11803
|
AppBskyFeedGetActorFeeds: 'app.bsky.feed.getActorFeeds',
|
|
11846
11804
|
AppBskyFeedGetActorLikes: 'app.bsky.feed.getActorLikes',
|
|
@@ -370,10 +370,15 @@ export type MutedWordTarget = 'content' | 'tag' | (string & {})
|
|
|
370
370
|
|
|
371
371
|
/** A word that the account owner has muted. */
|
|
372
372
|
export interface MutedWord {
|
|
373
|
+
id?: string
|
|
373
374
|
/** The muted word itself. */
|
|
374
375
|
value: string
|
|
375
376
|
/** The intended targets of the muted word. */
|
|
376
377
|
targets: MutedWordTarget[]
|
|
378
|
+
/** Groups of users to apply the muted word to. If undefined, applies to all users. */
|
|
379
|
+
actorTarget: 'all' | 'exclude-following' | (string & {})
|
|
380
|
+
/** The date and time at which the muted word will expire and no longer be applied. */
|
|
381
|
+
expiresAt?: string
|
|
377
382
|
[k: string]: unknown
|
|
378
383
|
}
|
|
379
384
|
|
|
@@ -5,7 +5,6 @@ import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
|
5
5
|
import { isObj, hasProp } from '../../../../util'
|
|
6
6
|
import { lexicons } from '../../../../lexicons'
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
|
-
import * as AppBskyEmbedDefs from './defs'
|
|
9
8
|
|
|
10
9
|
export interface Main {
|
|
11
10
|
images: Image[]
|
|
@@ -29,7 +28,7 @@ export interface Image {
|
|
|
29
28
|
image: BlobRef
|
|
30
29
|
/** Alt text description of the image, for accessibility. */
|
|
31
30
|
alt: string
|
|
32
|
-
aspectRatio?:
|
|
31
|
+
aspectRatio?: AspectRatio
|
|
33
32
|
[k: string]: unknown
|
|
34
33
|
}
|
|
35
34
|
|
|
@@ -43,6 +42,25 @@ export function validateImage(v: unknown): ValidationResult {
|
|
|
43
42
|
return lexicons.validate('app.bsky.embed.images#image', v)
|
|
44
43
|
}
|
|
45
44
|
|
|
45
|
+
/** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */
|
|
46
|
+
export interface AspectRatio {
|
|
47
|
+
width: number
|
|
48
|
+
height: number
|
|
49
|
+
[k: string]: unknown
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function isAspectRatio(v: unknown): v is AspectRatio {
|
|
53
|
+
return (
|
|
54
|
+
isObj(v) &&
|
|
55
|
+
hasProp(v, '$type') &&
|
|
56
|
+
v.$type === 'app.bsky.embed.images#aspectRatio'
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function validateAspectRatio(v: unknown): ValidationResult {
|
|
61
|
+
return lexicons.validate('app.bsky.embed.images#aspectRatio', v)
|
|
62
|
+
}
|
|
63
|
+
|
|
46
64
|
export interface View {
|
|
47
65
|
images: ViewImage[]
|
|
48
66
|
[k: string]: unknown
|
|
@@ -65,7 +83,7 @@ export interface ViewImage {
|
|
|
65
83
|
fullsize: string
|
|
66
84
|
/** Alt text description of the image, for accessibility. */
|
|
67
85
|
alt: string
|
|
68
|
-
aspectRatio?:
|
|
86
|
+
aspectRatio?: AspectRatio
|
|
69
87
|
[k: string]: unknown
|
|
70
88
|
}
|
|
71
89
|
|
|
@@ -12,7 +12,6 @@ import * as AppBskyLabelerDefs from '../labeler/defs'
|
|
|
12
12
|
import * as AppBskyActorDefs from '../actor/defs'
|
|
13
13
|
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
|
|
14
14
|
import * as AppBskyEmbedImages from './images'
|
|
15
|
-
import * as AppBskyEmbedVideo from './video'
|
|
16
15
|
import * as AppBskyEmbedExternal from './external'
|
|
17
16
|
import * as AppBskyEmbedRecordWithMedia from './recordWithMedia'
|
|
18
17
|
|
|
@@ -69,7 +68,6 @@ export interface ViewRecord {
|
|
|
69
68
|
likeCount?: number
|
|
70
69
|
embeds?: (
|
|
71
70
|
| AppBskyEmbedImages.View
|
|
72
|
-
| AppBskyEmbedVideo.View
|
|
73
71
|
| AppBskyEmbedExternal.View
|
|
74
72
|
| View
|
|
75
73
|
| AppBskyEmbedRecordWithMedia.View
|
|
@@ -7,14 +7,12 @@ import { lexicons } from '../../../../lexicons'
|
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import * as AppBskyEmbedRecord from './record'
|
|
9
9
|
import * as AppBskyEmbedImages from './images'
|
|
10
|
-
import * as AppBskyEmbedVideo from './video'
|
|
11
10
|
import * as AppBskyEmbedExternal from './external'
|
|
12
11
|
|
|
13
12
|
export interface Main {
|
|
14
13
|
record: AppBskyEmbedRecord.Main
|
|
15
14
|
media:
|
|
16
15
|
| AppBskyEmbedImages.Main
|
|
17
|
-
| AppBskyEmbedVideo.Main
|
|
18
16
|
| AppBskyEmbedExternal.Main
|
|
19
17
|
| { $type: string; [k: string]: unknown }
|
|
20
18
|
[k: string]: unknown
|
|
@@ -37,7 +35,6 @@ export interface View {
|
|
|
37
35
|
record: AppBskyEmbedRecord.View
|
|
38
36
|
media:
|
|
39
37
|
| AppBskyEmbedImages.View
|
|
40
|
-
| AppBskyEmbedVideo.View
|
|
41
38
|
| AppBskyEmbedExternal.View
|
|
42
39
|
| { $type: string; [k: string]: unknown }
|
|
43
40
|
[k: string]: unknown
|
|
@@ -7,7 +7,6 @@ import { lexicons } from '../../../../lexicons'
|
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import * as AppBskyActorDefs from '../actor/defs'
|
|
9
9
|
import * as AppBskyEmbedImages from '../embed/images'
|
|
10
|
-
import * as AppBskyEmbedVideo from '../embed/video'
|
|
11
10
|
import * as AppBskyEmbedExternal from '../embed/external'
|
|
12
11
|
import * as AppBskyEmbedRecord from '../embed/record'
|
|
13
12
|
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
|
|
@@ -22,7 +21,6 @@ export interface PostView {
|
|
|
22
21
|
record: {}
|
|
23
22
|
embed?:
|
|
24
23
|
| AppBskyEmbedImages.View
|
|
25
|
-
| AppBskyEmbedVideo.View
|
|
26
24
|
| AppBskyEmbedExternal.View
|
|
27
25
|
| AppBskyEmbedRecord.View
|
|
28
26
|
| AppBskyEmbedRecordWithMedia.View
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
+
import { isObj, hasProp } from '../../../../util'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { CID } from 'multiformats/cid'
|
|
8
|
+
|
|
9
|
+
export interface Record {
|
|
10
|
+
/** Reference (AT-URI) to the post record. */
|
|
11
|
+
post: string
|
|
12
|
+
/** List of detached post URIs. */
|
|
13
|
+
targets: string[]
|
|
14
|
+
updatedAt: string
|
|
15
|
+
[k: string]: unknown
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isRecord(v: unknown): v is Record {
|
|
19
|
+
return (
|
|
20
|
+
isObj(v) &&
|
|
21
|
+
hasProp(v, '$type') &&
|
|
22
|
+
(v.$type === 'app.bsky.feed.detach#main' ||
|
|
23
|
+
v.$type === 'app.bsky.feed.detach')
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function validateRecord(v: unknown): ValidationResult {
|
|
28
|
+
return lexicons.validate('app.bsky.feed.detach#main', v)
|
|
29
|
+
}
|
|
@@ -7,7 +7,6 @@ import { lexicons } from '../../../../lexicons'
|
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import * as AppBskyRichtextFacet from '../richtext/facet'
|
|
9
9
|
import * as AppBskyEmbedImages from '../embed/images'
|
|
10
|
-
import * as AppBskyEmbedVideo from '../embed/video'
|
|
11
10
|
import * as AppBskyEmbedExternal from '../embed/external'
|
|
12
11
|
import * as AppBskyEmbedRecord from '../embed/record'
|
|
13
12
|
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
|
|
@@ -24,7 +23,6 @@ export interface Record {
|
|
|
24
23
|
reply?: ReplyRef
|
|
25
24
|
embed?:
|
|
26
25
|
| AppBskyEmbedImages.Main
|
|
27
|
-
| AppBskyEmbedVideo.Main
|
|
28
26
|
| AppBskyEmbedExternal.Main
|
|
29
27
|
| AppBskyEmbedRecord.Main
|
|
30
28
|
| AppBskyEmbedRecordWithMedia.Main
|
|
@@ -27,12 +27,14 @@ export function hasMutedWord({
|
|
|
27
27
|
facets,
|
|
28
28
|
outlineTags,
|
|
29
29
|
languages,
|
|
30
|
+
actor,
|
|
30
31
|
}: {
|
|
31
32
|
mutedWords: AppBskyActorDefs.MutedWord[]
|
|
32
33
|
text: string
|
|
33
34
|
facets?: AppBskyRichtextFacet.Main[]
|
|
34
35
|
outlineTags?: string[]
|
|
35
36
|
languages?: string[]
|
|
37
|
+
actor?: AppBskyActorDefs.ProfileView
|
|
36
38
|
}) {
|
|
37
39
|
const exception = LANGUAGE_EXCEPTIONS.includes(languages?.[0] || '')
|
|
38
40
|
const tags = ([] as string[])
|
|
@@ -48,6 +50,15 @@ export function hasMutedWord({
|
|
|
48
50
|
const mutedWord = mute.value.toLowerCase()
|
|
49
51
|
const postText = text.toLowerCase()
|
|
50
52
|
|
|
53
|
+
// expired, ignore
|
|
54
|
+
if (mute.expiresAt && mute.expiresAt < new Date().toISOString()) continue
|
|
55
|
+
|
|
56
|
+
if (
|
|
57
|
+
mute.actorTarget === 'exclude-following' &&
|
|
58
|
+
Boolean(actor?.viewer?.following)
|
|
59
|
+
)
|
|
60
|
+
continue
|
|
61
|
+
|
|
51
62
|
// `content` applies to tags as well
|
|
52
63
|
if (tags.includes(mutedWord)) return true
|
|
53
64
|
// rest of the checks are for `content` only
|
|
@@ -141,6 +141,8 @@ function checkMutedWords(
|
|
|
141
141
|
return false
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
const postAuthor = subject.author
|
|
145
|
+
|
|
144
146
|
if (AppBskyFeedPost.isRecord(subject.record)) {
|
|
145
147
|
// post text
|
|
146
148
|
if (
|
|
@@ -150,6 +152,7 @@ function checkMutedWords(
|
|
|
150
152
|
facets: subject.record.facets,
|
|
151
153
|
outlineTags: subject.record.tags,
|
|
152
154
|
languages: subject.record.langs,
|
|
155
|
+
actor: postAuthor,
|
|
153
156
|
})
|
|
154
157
|
) {
|
|
155
158
|
return true
|
|
@@ -166,6 +169,7 @@ function checkMutedWords(
|
|
|
166
169
|
mutedWords,
|
|
167
170
|
text: image.alt,
|
|
168
171
|
languages: subject.record.langs,
|
|
172
|
+
actor: postAuthor,
|
|
169
173
|
})
|
|
170
174
|
) {
|
|
171
175
|
return true
|
|
@@ -179,6 +183,7 @@ function checkMutedWords(
|
|
|
179
183
|
if (AppBskyEmbedRecord.isViewRecord(subject.embed.record)) {
|
|
180
184
|
if (AppBskyFeedPost.isRecord(subject.embed.record.value)) {
|
|
181
185
|
const embeddedPost = subject.embed.record.value
|
|
186
|
+
const embedAuthor = subject.embed.record.author
|
|
182
187
|
|
|
183
188
|
// quoted post text
|
|
184
189
|
if (
|
|
@@ -188,6 +193,7 @@ function checkMutedWords(
|
|
|
188
193
|
facets: embeddedPost.facets,
|
|
189
194
|
outlineTags: embeddedPost.tags,
|
|
190
195
|
languages: embeddedPost.langs,
|
|
196
|
+
actor: embedAuthor,
|
|
191
197
|
})
|
|
192
198
|
) {
|
|
193
199
|
return true
|
|
@@ -201,6 +207,7 @@ function checkMutedWords(
|
|
|
201
207
|
mutedWords,
|
|
202
208
|
text: image.alt,
|
|
203
209
|
languages: embeddedPost.langs,
|
|
210
|
+
actor: embedAuthor,
|
|
204
211
|
})
|
|
205
212
|
) {
|
|
206
213
|
return true
|
|
@@ -216,6 +223,7 @@ function checkMutedWords(
|
|
|
216
223
|
mutedWords,
|
|
217
224
|
text: external.title + ' ' + external.description,
|
|
218
225
|
languages: [],
|
|
226
|
+
actor: embedAuthor,
|
|
219
227
|
})
|
|
220
228
|
) {
|
|
221
229
|
return true
|
|
@@ -231,6 +239,7 @@ function checkMutedWords(
|
|
|
231
239
|
mutedWords,
|
|
232
240
|
text: external.title + ' ' + external.description,
|
|
233
241
|
languages: [],
|
|
242
|
+
actor: embedAuthor,
|
|
234
243
|
})
|
|
235
244
|
) {
|
|
236
245
|
return true
|
|
@@ -247,6 +256,7 @@ function checkMutedWords(
|
|
|
247
256
|
languages: AppBskyFeedPost.isRecord(embeddedPost.record)
|
|
248
257
|
? embeddedPost.langs
|
|
249
258
|
: [],
|
|
259
|
+
actor: embedAuthor,
|
|
250
260
|
})
|
|
251
261
|
) {
|
|
252
262
|
return true
|
|
@@ -264,6 +274,7 @@ function checkMutedWords(
|
|
|
264
274
|
mutedWords,
|
|
265
275
|
text: external.title + ' ' + external.description,
|
|
266
276
|
languages: [],
|
|
277
|
+
actor: postAuthor,
|
|
267
278
|
})
|
|
268
279
|
) {
|
|
269
280
|
return true
|
|
@@ -274,6 +285,8 @@ function checkMutedWords(
|
|
|
274
285
|
AppBskyEmbedRecordWithMedia.isView(subject.embed) &&
|
|
275
286
|
AppBskyEmbedRecord.isViewRecord(subject.embed.record.record)
|
|
276
287
|
) {
|
|
288
|
+
const embedAuthor = subject.embed.record.record.author
|
|
289
|
+
|
|
277
290
|
// quoted post text
|
|
278
291
|
if (AppBskyFeedPost.isRecord(subject.embed.record.record.value)) {
|
|
279
292
|
const post = subject.embed.record.record.value
|
|
@@ -284,6 +297,7 @@ function checkMutedWords(
|
|
|
284
297
|
facets: post.facets,
|
|
285
298
|
outlineTags: post.tags,
|
|
286
299
|
languages: post.langs,
|
|
300
|
+
actor: embedAuthor,
|
|
287
301
|
})
|
|
288
302
|
) {
|
|
289
303
|
return true
|
|
@@ -300,6 +314,7 @@ function checkMutedWords(
|
|
|
300
314
|
languages: AppBskyFeedPost.isRecord(subject.record)
|
|
301
315
|
? subject.record.langs
|
|
302
316
|
: [],
|
|
317
|
+
actor: embedAuthor,
|
|
303
318
|
})
|
|
304
319
|
) {
|
|
305
320
|
return true
|