@atproto/ozone 0.1.73 → 0.1.75
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 +35 -0
- package/bin/migration-create.ts +2 -2
- package/dist/api/chat/getActorMetadata.d.ts +1 -1
- package/dist/api/chat/getActorMetadata.d.ts.map +1 -1
- package/dist/api/chat/getActorMetadata.js.map +1 -1
- package/dist/api/chat/getMessageContext.d.ts +1 -1
- package/dist/api/chat/getMessageContext.d.ts.map +1 -1
- package/dist/api/chat/getMessageContext.js.map +1 -1
- package/dist/api/chat/index.d.ts +1 -1
- package/dist/api/chat/index.d.ts.map +1 -1
- package/dist/api/communication/createTemplate.d.ts +1 -1
- package/dist/api/communication/createTemplate.d.ts.map +1 -1
- package/dist/api/communication/createTemplate.js.map +1 -1
- package/dist/api/communication/deleteTemplate.d.ts +1 -1
- package/dist/api/communication/deleteTemplate.d.ts.map +1 -1
- package/dist/api/communication/listTemplates.d.ts +1 -1
- package/dist/api/communication/listTemplates.d.ts.map +1 -1
- package/dist/api/communication/updateTemplate.d.ts +1 -1
- package/dist/api/communication/updateTemplate.d.ts.map +1 -1
- package/dist/api/communication/updateTemplate.js.map +1 -1
- package/dist/api/health.d.ts +3 -3
- package/dist/api/health.d.ts.map +1 -1
- package/dist/api/health.js +2 -5
- package/dist/api/health.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +20 -20
- package/dist/api/index.js.map +1 -1
- package/dist/api/label/fetchLabels.d.ts +1 -1
- package/dist/api/label/fetchLabels.d.ts.map +1 -1
- package/dist/api/label/queryLabels.d.ts +1 -1
- package/dist/api/label/queryLabels.d.ts.map +1 -1
- package/dist/api/label/queryLabels.js +1 -1
- package/dist/api/label/queryLabels.js.map +1 -1
- package/dist/api/label/subscribeLabels.d.ts +1 -1
- package/dist/api/label/subscribeLabels.d.ts.map +1 -1
- package/dist/api/label/subscribeLabels.js +2 -5
- package/dist/api/label/subscribeLabels.js.map +1 -1
- package/dist/api/moderation/emitEvent.d.ts +1 -1
- package/dist/api/moderation/emitEvent.d.ts.map +1 -1
- package/dist/api/moderation/emitEvent.js +6 -6
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/api/moderation/getEvent.d.ts +1 -1
- package/dist/api/moderation/getEvent.d.ts.map +1 -1
- package/dist/api/moderation/getRecord.d.ts +1 -1
- package/dist/api/moderation/getRecord.d.ts.map +1 -1
- package/dist/api/moderation/getRecord.js +1 -1
- package/dist/api/moderation/getRecord.js.map +1 -1
- package/dist/api/moderation/getRecords.d.ts +1 -1
- package/dist/api/moderation/getRecords.d.ts.map +1 -1
- package/dist/api/moderation/getRecords.js +1 -1
- package/dist/api/moderation/getRecords.js.map +1 -1
- package/dist/api/moderation/getRepo.d.ts +1 -1
- package/dist/api/moderation/getRepo.d.ts.map +1 -1
- package/dist/api/moderation/getRepos.d.ts +1 -1
- package/dist/api/moderation/getRepos.d.ts.map +1 -1
- package/dist/api/moderation/queryEvents.d.ts +1 -1
- package/dist/api/moderation/queryEvents.d.ts.map +1 -1
- package/dist/api/moderation/queryStatuses.d.ts +1 -1
- package/dist/api/moderation/queryStatuses.d.ts.map +1 -1
- package/dist/api/moderation/searchRepos.d.ts +1 -1
- package/dist/api/moderation/searchRepos.d.ts.map +1 -1
- package/dist/api/moderation/searchRepos.js.map +1 -1
- package/dist/api/proxied.d.ts +1 -1
- package/dist/api/proxied.d.ts.map +1 -1
- package/dist/api/report/createReport.d.ts +1 -1
- package/dist/api/report/createReport.d.ts.map +1 -1
- package/dist/api/report/createReport.js +6 -6
- package/dist/api/report/createReport.js.map +1 -1
- package/dist/api/server/getConfig.d.ts +1 -1
- package/dist/api/server/getConfig.d.ts.map +1 -1
- package/dist/api/server/getConfig.js.map +1 -1
- package/dist/api/set/addValues.d.ts +1 -1
- package/dist/api/set/addValues.d.ts.map +1 -1
- package/dist/api/set/deleteSet.d.ts +1 -1
- package/dist/api/set/deleteSet.d.ts.map +1 -1
- package/dist/api/set/deleteValues.d.ts +1 -1
- package/dist/api/set/deleteValues.d.ts.map +1 -1
- package/dist/api/set/getValues.d.ts +1 -1
- package/dist/api/set/getValues.d.ts.map +1 -1
- package/dist/api/set/querySets.d.ts +1 -1
- package/dist/api/set/querySets.d.ts.map +1 -1
- package/dist/api/set/upsertSet.d.ts +1 -1
- package/dist/api/set/upsertSet.d.ts.map +1 -1
- package/dist/api/setting/listOptions.d.ts +1 -1
- package/dist/api/setting/listOptions.d.ts.map +1 -1
- package/dist/api/setting/removeOptions.d.ts +1 -1
- package/dist/api/setting/removeOptions.d.ts.map +1 -1
- package/dist/api/setting/upsertOption.d.ts +1 -1
- package/dist/api/setting/upsertOption.d.ts.map +1 -1
- package/dist/api/setting/upsertOption.js +2 -2
- package/dist/api/setting/upsertOption.js.map +1 -1
- package/dist/api/team/addMember.d.ts +1 -1
- package/dist/api/team/addMember.d.ts.map +1 -1
- package/dist/api/team/deleteMember.d.ts +1 -1
- package/dist/api/team/deleteMember.d.ts.map +1 -1
- package/dist/api/team/listMembers.d.ts +1 -1
- package/dist/api/team/listMembers.d.ts.map +1 -1
- package/dist/api/team/updateMember.d.ts +1 -1
- package/dist/api/team/updateMember.d.ts.map +1 -1
- package/dist/api/util.d.ts +4 -4
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +4 -1
- package/dist/api/util.js.map +1 -1
- package/dist/api/well-known.d.ts +3 -3
- package/dist/api/well-known.d.ts.map +1 -1
- package/dist/api/well-known.js +2 -5
- package/dist/api/well-known.js.map +1 -1
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +0 -2
- package/dist/background.js.map +1 -1
- package/dist/communication-service/template.d.ts +1 -1
- package/dist/communication-service/template.d.ts.map +1 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.js +3 -3
- package/dist/config/secrets.js.map +1 -1
- package/dist/context.d.ts +9 -10
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +11 -12
- package/dist/context.js.map +1 -1
- package/dist/daemon/blob-diverter.d.ts +2 -2
- package/dist/daemon/blob-diverter.d.ts.map +1 -1
- package/dist/daemon/blob-diverter.js +3 -3
- package/dist/daemon/blob-diverter.js.map +1 -1
- package/dist/daemon/context.d.ts +1 -2
- package/dist/daemon/context.d.ts.map +1 -1
- package/dist/daemon/context.js +6 -7
- package/dist/daemon/context.js.map +1 -1
- package/dist/daemon/event-pusher.d.ts +3 -3
- package/dist/daemon/event-pusher.d.ts.map +1 -1
- package/dist/daemon/event-pusher.js +2 -2
- package/dist/daemon/event-pusher.js.map +1 -1
- package/dist/daemon/event-reverser.d.ts +1 -1
- package/dist/daemon/event-reverser.d.ts.map +1 -1
- package/dist/daemon/event-reverser.js.map +1 -1
- package/dist/daemon/index.d.ts +1 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +2 -5
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/materialized-view-refresher.js +1 -1
- package/dist/daemon/materialized-view-refresher.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +5 -5
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations/20241220T144630860Z-stats-materialized-views.d.ts.map +1 -1
- package/dist/db/migrations/20241220T144630860Z-stats-materialized-views.js.map +1 -1
- package/dist/db/schema/index.d.ts +11 -11
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/moderation_subject_status.d.ts +1 -1
- package/dist/db/schema/moderation_subject_status.d.ts.map +1 -1
- package/dist/db/types.d.ts +1 -1
- package/dist/db/types.d.ts.map +1 -1
- package/dist/db/types.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +64 -2
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +36 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +19 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +10 -0
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/postgate.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/postgate.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/postgate.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/threadgate.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/threadgate.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/threadgate.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +2 -0
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/logger.js +2 -25
- package/dist/logger.js.map +1 -1
- package/dist/mod-service/index.d.ts +32 -32
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +19 -15
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/status.d.ts +24 -24
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/mod-service/status.js +2 -0
- package/dist/mod-service/status.js.map +1 -1
- package/dist/mod-service/subject.d.ts +3 -3
- package/dist/mod-service/subject.d.ts.map +1 -1
- package/dist/mod-service/subject.js.map +1 -1
- package/dist/mod-service/types.d.ts +2 -2
- package/dist/mod-service/types.d.ts.map +1 -1
- package/dist/mod-service/views.d.ts +6 -6
- package/dist/mod-service/views.d.ts.map +1 -1
- package/dist/mod-service/views.js +8 -8
- package/dist/mod-service/views.js.map +1 -1
- package/dist/sequencer/outbox.d.ts +1 -2
- package/dist/sequencer/outbox.d.ts.map +1 -1
- package/dist/sequencer/outbox.js +0 -1
- package/dist/sequencer/outbox.js.map +1 -1
- package/dist/sequencer/sequencer.d.ts +3 -4
- package/dist/sequencer/sequencer.d.ts.map +1 -1
- package/dist/sequencer/sequencer.js +3 -4
- package/dist/sequencer/sequencer.js.map +1 -1
- package/dist/set/service.d.ts +2 -2
- package/dist/set/service.d.ts.map +1 -1
- package/dist/set/service.js.map +1 -1
- package/dist/setting/service.d.ts +3 -3
- package/dist/setting/service.d.ts.map +1 -1
- package/dist/setting/service.js.map +1 -1
- package/dist/setting/validators.d.ts.map +1 -1
- package/dist/setting/validators.js +1 -1
- package/dist/setting/validators.js.map +1 -1
- package/dist/tag-service/embed-tagger.d.ts.map +1 -1
- package/dist/tag-service/embed-tagger.js +1 -1
- package/dist/tag-service/embed-tagger.js.map +1 -1
- package/dist/tag-service/index.d.ts.map +1 -1
- package/dist/tag-service/index.js +1 -1
- package/dist/tag-service/index.js.map +1 -1
- package/dist/tag-service/language-tagger.d.ts.map +1 -1
- package/dist/tag-service/language-tagger.js +1 -1
- package/dist/tag-service/language-tagger.js.map +1 -1
- package/dist/team/index.d.ts +3 -3
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +2 -2
- package/dist/team/index.js.map +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/package.json +14 -11
- package/src/api/chat/getActorMetadata.ts +2 -2
- package/src/api/chat/getMessageContext.ts +2 -2
- package/src/api/chat/index.ts +1 -1
- package/src/api/communication/createTemplate.ts +2 -2
- package/src/api/communication/deleteTemplate.ts +1 -1
- package/src/api/communication/listTemplates.ts +1 -1
- package/src/api/communication/updateTemplate.ts +2 -2
- package/src/api/health.ts +4 -4
- package/src/api/index.ts +21 -21
- package/src/api/label/fetchLabels.ts +1 -1
- package/src/api/label/queryLabels.ts +3 -3
- package/src/api/label/subscribeLabels.ts +3 -3
- package/src/api/moderation/emitEvent.ts +7 -6
- package/src/api/moderation/getEvent.ts +1 -1
- package/src/api/moderation/getRecord.ts +2 -2
- package/src/api/moderation/getRecords.ts +2 -2
- package/src/api/moderation/getRepo.ts +1 -1
- package/src/api/moderation/getRepos.ts +1 -1
- package/src/api/moderation/queryEvents.ts +1 -1
- package/src/api/moderation/queryStatuses.ts +1 -1
- package/src/api/moderation/searchRepos.ts +2 -2
- package/src/api/proxied.ts +1 -1
- package/src/api/report/createReport.ts +5 -5
- package/src/api/server/getConfig.ts +1 -1
- package/src/api/set/addValues.ts +1 -1
- package/src/api/set/deleteSet.ts +1 -1
- package/src/api/set/deleteValues.ts +1 -1
- package/src/api/set/getValues.ts +1 -1
- package/src/api/set/querySets.ts +1 -1
- package/src/api/set/upsertSet.ts +1 -1
- package/src/api/setting/listOptions.ts +1 -1
- package/src/api/setting/removeOptions.ts +2 -2
- package/src/api/setting/upsertOption.ts +5 -5
- package/src/api/team/addMember.ts +1 -1
- package/src/api/team/deleteMember.ts +1 -1
- package/src/api/team/listMembers.ts +1 -1
- package/src/api/team/updateMember.ts +1 -1
- package/src/api/util.ts +14 -11
- package/src/api/well-known.ts +4 -4
- package/src/background.ts +0 -2
- package/src/communication-service/template.ts +1 -1
- package/src/config/config.ts +1 -1
- package/src/config/secrets.ts +1 -1
- package/src/context.ts +13 -14
- package/src/daemon/blob-diverter.ts +7 -8
- package/src/daemon/context.ts +6 -8
- package/src/daemon/event-pusher.ts +6 -6
- package/src/daemon/event-reverser.ts +1 -1
- package/src/daemon/index.ts +1 -1
- package/src/daemon/materialized-view-refresher.ts +1 -1
- package/src/db/index.ts +8 -8
- package/src/db/migrations/20241220T144630860Z-stats-materialized-views.ts +1 -3
- package/src/db/pagination.ts +1 -1
- package/src/db/schema/index.ts +11 -12
- package/src/db/schema/moderation_subject_status.ts +1 -1
- package/src/db/types.ts +1 -1
- package/src/error.ts +1 -1
- package/src/index.ts +11 -11
- package/src/lexicon/lexicons.ts +42 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +36 -0
- package/src/lexicon/types/app/bsky/feed/postgate.ts +1 -0
- package/src/lexicon/types/app/bsky/feed/threadgate.ts +1 -0
- package/src/lexicon/types/tools/ozone/moderation/defs.ts +2 -0
- package/src/logger.ts +1 -1
- package/src/mod-service/index.ts +39 -33
- package/src/mod-service/status.ts +3 -1
- package/src/mod-service/subject.ts +4 -4
- package/src/mod-service/types.ts +2 -2
- package/src/mod-service/views.ts +18 -18
- package/src/sequencer/outbox.ts +1 -3
- package/src/sequencer/sequencer.ts +5 -7
- package/src/set/service.ts +2 -2
- package/src/setting/service.ts +5 -5
- package/src/setting/validators.ts +1 -1
- package/src/tag-service/embed-tagger.ts +3 -3
- package/src/tag-service/index.ts +3 -3
- package/src/tag-service/language-tagger.ts +1 -2
- package/src/team/index.ts +6 -6
- package/src/util.ts +2 -2
- package/tests/3p-labeler.test.ts +5 -5
- package/tests/__snapshots__/get-record.test.ts.snap +2 -2
- package/tests/__snapshots__/get-records.test.ts.snap +1 -1
- package/tests/__snapshots__/get-repo.test.ts.snap +1 -1
- package/tests/__snapshots__/get-repos.test.ts.snap +1 -1
- package/tests/__snapshots__/moderation-events.test.ts.snap +1 -1
- package/tests/__snapshots__/moderation-statuses.test.ts.snap +6 -6
- package/tests/_util.ts +4 -4
- package/tests/ack-all-subjects-of-account.test.ts +4 -4
- package/tests/blob-divert.test.ts +1 -1
- package/tests/communication-templates.test.ts +1 -1
- package/tests/content-tagger.test.ts +1 -1
- package/tests/get-config.test.ts +1 -1
- package/tests/get-lists.test.ts +4 -4
- package/tests/get-profiles.test.ts +2 -3
- package/tests/get-record.test.ts +4 -4
- package/tests/get-records.test.ts +4 -4
- package/tests/get-repo.test.ts +3 -3
- package/tests/get-repos.test.ts +3 -3
- package/tests/get-starter-pack.test.ts +5 -5
- package/tests/moderation-appeals.test.ts +6 -6
- package/tests/moderation-events.test.ts +4 -4
- package/tests/moderation-status-tags.test.ts +2 -2
- package/tests/moderation-statuses.test.ts +8 -8
- package/tests/moderation.test.ts +39 -13
- package/tests/protected-tags.test.ts +3 -3
- package/tests/query-labels.test.ts +3 -3
- package/tests/record-and-account-events.test.ts +8 -7
- package/tests/repo-search.test.ts +2 -2
- package/tests/report-muting.test.ts +6 -6
- package/tests/sequencer.test.ts +3 -3
- package/tests/server.test.ts +1 -1
- package/tests/sets.test.ts +2 -2
- package/tests/settings.test.ts +2 -2
- package/tests/takedown.test.ts +3 -12
- package/tests/team.test.ts +1 -1
package/src/context.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import assert from 'node:assert'
|
|
2
2
|
import * as plc from '@did-plc/lib'
|
|
3
|
-
import
|
|
3
|
+
import express from 'express'
|
|
4
4
|
import { AtpAgent } from '@atproto/api'
|
|
5
5
|
import { Keypair, Secp256k1Keypair } from '@atproto/crypto'
|
|
6
|
+
import { DidCache, IdResolver, MemoryCache } from '@atproto/identity'
|
|
6
7
|
import { createServiceAuthHeaders } from '@atproto/xrpc-server'
|
|
7
|
-
import {
|
|
8
|
-
import { OzoneConfig, OzoneSecrets } from './config'
|
|
9
|
-
import { ModerationService, ModerationServiceCreator } from './mod-service'
|
|
8
|
+
import { AuthVerifier } from './auth-verifier'
|
|
10
9
|
import { BackgroundQueue } from './background'
|
|
11
|
-
import assert from 'assert'
|
|
12
|
-
import { EventPusher } from './daemon'
|
|
13
|
-
import Sequencer from './sequencer/sequencer'
|
|
14
10
|
import {
|
|
15
11
|
CommunicationTemplateService,
|
|
16
12
|
CommunicationTemplateServiceCreator,
|
|
17
13
|
} from './communication-service/template'
|
|
14
|
+
import { OzoneConfig, OzoneSecrets } from './config'
|
|
15
|
+
import { EventPusher } from './daemon'
|
|
18
16
|
import { BlobDiverter } from './daemon/blob-diverter'
|
|
19
|
-
import {
|
|
17
|
+
import { Database } from './db'
|
|
20
18
|
import { ImageInvalidator } from './image-invalidator'
|
|
19
|
+
import { ModerationService, ModerationServiceCreator } from './mod-service'
|
|
20
|
+
import { Sequencer } from './sequencer/sequencer'
|
|
21
|
+
import { SetService, SetServiceCreator } from './set/service'
|
|
22
|
+
import { SettingService, SettingServiceCreator } from './setting/service'
|
|
21
23
|
import { TeamService, TeamServiceCreator } from './team'
|
|
22
24
|
import {
|
|
23
|
-
defaultLabelerHeader,
|
|
24
|
-
getSigningKeyId,
|
|
25
25
|
LABELER_HEADER_NAME,
|
|
26
26
|
ParsedLabelers,
|
|
27
|
+
defaultLabelerHeader,
|
|
28
|
+
getSigningKeyId,
|
|
27
29
|
parseLabelerHeader,
|
|
28
30
|
} from './util'
|
|
29
|
-
import { SetService, SetServiceCreator } from './set/service'
|
|
30
|
-
import { SettingService, SettingServiceCreator } from './setting/service'
|
|
31
31
|
|
|
32
32
|
export type AppContextOptions = {
|
|
33
33
|
db: Database
|
|
@@ -289,4 +289,3 @@ export class AppContext {
|
|
|
289
289
|
return parsed
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
export default AppContext
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import { Readable } from 'node:stream'
|
|
2
|
+
import { finished, pipeline } from 'node:stream/promises'
|
|
3
|
+
import { CID } from 'multiformats/cid'
|
|
4
|
+
import * as undici from 'undici'
|
|
1
5
|
import {
|
|
2
|
-
createDecoders,
|
|
3
|
-
getPdsEndpoint,
|
|
4
6
|
VerifyCidTransform,
|
|
5
7
|
allFulfilled,
|
|
8
|
+
createDecoders,
|
|
9
|
+
getPdsEndpoint,
|
|
6
10
|
} from '@atproto/common'
|
|
7
11
|
import { IdResolver } from '@atproto/identity'
|
|
8
12
|
import { ResponseType, XRPCError } from '@atproto/xrpc'
|
|
9
|
-
import { CID } from 'multiformats/cid'
|
|
10
|
-
import { Readable } from 'node:stream'
|
|
11
|
-
import { finished, pipeline } from 'node:stream/promises'
|
|
12
|
-
import * as undici from 'undici'
|
|
13
|
-
|
|
14
13
|
import { BlobDivertConfig } from '../config'
|
|
15
|
-
import Database from '../db'
|
|
14
|
+
import { Database } from '../db'
|
|
16
15
|
import { retryHttp } from '../util'
|
|
17
16
|
|
|
18
17
|
export class BlobDiverter {
|
package/src/daemon/context.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { AtpAgent } from '@atproto/api'
|
|
2
|
+
import { allFulfilled } from '@atproto/common'
|
|
1
3
|
import { Keypair, Secp256k1Keypair } from '@atproto/crypto'
|
|
2
|
-
import { createServiceAuthHeaders } from '@atproto/xrpc-server'
|
|
3
4
|
import { IdResolver } from '@atproto/identity'
|
|
4
|
-
import {
|
|
5
|
+
import { createServiceAuthHeaders } from '@atproto/xrpc-server'
|
|
6
|
+
import { BackgroundQueue } from '../background'
|
|
5
7
|
import { OzoneConfig, OzoneSecrets } from '../config'
|
|
6
8
|
import { Database } from '../db'
|
|
7
|
-
import { EventPusher } from './event-pusher'
|
|
8
|
-
import { EventReverser } from './event-reverser'
|
|
9
9
|
import { ModerationService } from '../mod-service'
|
|
10
|
-
import { BackgroundQueue } from '../background'
|
|
11
10
|
import { getSigningKeyId } from '../util'
|
|
11
|
+
import { EventPusher } from './event-pusher'
|
|
12
|
+
import { EventReverser } from './event-reverser'
|
|
12
13
|
import { MaterializedViewRefresher } from './materialized-view-refresher'
|
|
13
|
-
import { allFulfilled } from '@atproto/common'
|
|
14
14
|
|
|
15
15
|
export type DaemonContextOptions = {
|
|
16
16
|
db: Database
|
|
@@ -136,5 +136,3 @@ export class DaemonContext {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
export default DaemonContext
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
|
+
import { Insertable, Selectable } from 'kysely'
|
|
2
3
|
import { AtpAgent } from '@atproto/api'
|
|
3
4
|
import { SECOND } from '@atproto/common'
|
|
4
|
-
import Database from '../db'
|
|
5
|
-
import { RepoPushEventType } from '../db/schema/repo_push_event'
|
|
6
|
-
import { retryHttp } from '../util'
|
|
7
|
-
import { dbLogger } from '../logger'
|
|
8
|
-
import { InputSchema } from '../lexicon/types/com/atproto/admin/updateSubjectStatus'
|
|
5
|
+
import { Database } from '../db'
|
|
9
6
|
import { BlobPushEvent } from '../db/schema/blob_push_event'
|
|
10
|
-
import {
|
|
7
|
+
import { RepoPushEventType } from '../db/schema/repo_push_event'
|
|
11
8
|
import { ids } from '../lexicon/lexicons'
|
|
9
|
+
import { InputSchema } from '../lexicon/types/com/atproto/admin/updateSubjectStatus'
|
|
10
|
+
import { dbLogger } from '../logger'
|
|
11
|
+
import { retryHttp } from '../util'
|
|
12
12
|
|
|
13
13
|
type EventSubject = InputSchema['subject']
|
|
14
14
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MINUTE } from '@atproto/common'
|
|
2
|
+
import { Database } from '../db'
|
|
2
3
|
import { dbLogger } from '../logger'
|
|
3
4
|
import { ModerationServiceCreator, ReversalSubject } from '../mod-service'
|
|
4
|
-
import Database from '../db'
|
|
5
5
|
|
|
6
6
|
export class EventReverser {
|
|
7
7
|
destroyed = false
|
package/src/daemon/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OzoneConfig, OzoneSecrets } from '../config'
|
|
2
|
-
import DaemonContext from './context'
|
|
3
2
|
import { AppContextOptions } from '../context'
|
|
3
|
+
import { DaemonContext } from './context'
|
|
4
4
|
|
|
5
5
|
export { EventPusher } from './event-pusher'
|
|
6
6
|
export { BlobDiverter } from './blob-diverter'
|
package/src/db/index.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { EventEmitter } from 'node:stream'
|
|
2
3
|
import {
|
|
3
4
|
Kysely,
|
|
4
|
-
PostgresDialect,
|
|
5
|
-
Migrator,
|
|
6
5
|
KyselyPlugin,
|
|
6
|
+
Migrator,
|
|
7
7
|
PluginTransformQueryArgs,
|
|
8
8
|
PluginTransformResultArgs,
|
|
9
|
-
|
|
9
|
+
PostgresDialect,
|
|
10
10
|
QueryResult,
|
|
11
|
+
RootOperationNode,
|
|
11
12
|
UnknownRow,
|
|
12
13
|
} from 'kysely'
|
|
13
|
-
import TypedEmitter from 'typed-emitter'
|
|
14
14
|
import { Pool as PgPool, types as pgTypes } from 'pg'
|
|
15
|
-
import
|
|
16
|
-
import { PgOptions } from './types'
|
|
15
|
+
import TypedEmitter from 'typed-emitter'
|
|
17
16
|
import { dbLogger } from '../logger'
|
|
18
|
-
import { EventEmitter } from 'stream'
|
|
19
17
|
import * as migrations from './migrations'
|
|
20
18
|
import { CtxMigrationProvider } from './migrations/provider'
|
|
19
|
+
import { DatabaseSchema, DatabaseSchemaType } from './schema'
|
|
20
|
+
import { PgOptions } from './types'
|
|
21
21
|
|
|
22
22
|
export class Database {
|
|
23
23
|
pool: PgPool
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Kysely, sql } from 'kysely'
|
|
2
|
-
|
|
3
2
|
import { REASONAPPEAL } from '../../lexicon/types/com/atproto/moderation/defs'
|
|
4
|
-
import { DatabaseSchemaType } from '../schema'
|
|
5
|
-
|
|
6
3
|
import {
|
|
7
4
|
REVIEWESCALATED,
|
|
8
5
|
REVIEWOPEN,
|
|
9
6
|
} from '../../lexicon/types/tools/ozone/moderation/defs'
|
|
7
|
+
import { DatabaseSchemaType } from '../schema'
|
|
10
8
|
import * as modEvent from '../schema/moderation_event'
|
|
11
9
|
import * as modStatus from '../schema/moderation_subject_status'
|
|
12
10
|
import * as recordEventsStats from '../schema/record_events_stats'
|
package/src/db/pagination.ts
CHANGED
package/src/db/schema/index.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { Kysely } from 'kysely'
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as recordPushEvent from './record_push_event'
|
|
2
|
+
import * as accountEventsStats from './account_events_stats'
|
|
3
|
+
import * as accountRecordEventsStats from './account_record_events_stats'
|
|
4
|
+
import * as accountRecordStatusStats from './account_record_status_stats'
|
|
6
5
|
import * as blobPushEvent from './blob_push_event'
|
|
7
|
-
import * as label from './label'
|
|
8
|
-
import * as signingKey from './signing_key'
|
|
9
6
|
import * as communicationTemplate from './communication_template'
|
|
10
|
-
import * as
|
|
7
|
+
import * as label from './label'
|
|
11
8
|
import * as member from './member'
|
|
12
|
-
import * as
|
|
13
|
-
|
|
9
|
+
import * as modEvent from './moderation_event'
|
|
10
|
+
import * as modSubjectStatus from './moderation_subject_status'
|
|
11
|
+
import * as set from './ozone_set'
|
|
14
12
|
import * as recordEventsStats from './record_events_stats'
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
17
|
-
import * as
|
|
13
|
+
import * as recordPushEvent from './record_push_event'
|
|
14
|
+
import * as repoPushEvent from './repo_push_event'
|
|
15
|
+
import * as setting from './setting'
|
|
16
|
+
import * as signingKey from './signing_key'
|
|
18
17
|
|
|
19
18
|
export type DatabaseSchemaType = modEvent.PartialDB &
|
|
20
19
|
modSubjectStatus.PartialDB &
|
package/src/db/types.ts
CHANGED
package/src/error.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { XRPCError } from '@atproto/xrpc-server'
|
|
2
1
|
import { ErrorRequestHandler } from 'express'
|
|
2
|
+
import { XRPCError } from '@atproto/xrpc-server'
|
|
3
3
|
import { httpLogger as log } from './logger'
|
|
4
4
|
|
|
5
5
|
export const handler: ErrorRequestHandler = (err, _req, res, next) => {
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import http from 'http'
|
|
3
|
-
import { AddressInfo } from 'net'
|
|
4
|
-
import events from 'events'
|
|
5
|
-
import { createHttpTerminator, HttpTerminator } from 'http-terminator'
|
|
6
|
-
import cors from 'cors'
|
|
1
|
+
import events from 'node:events'
|
|
2
|
+
import http from 'node:http'
|
|
3
|
+
import { AddressInfo } from 'node:net'
|
|
7
4
|
import compression from 'compression'
|
|
5
|
+
import cors from 'cors'
|
|
6
|
+
import express from 'express'
|
|
7
|
+
import { HttpTerminator, createHttpTerminator } from 'http-terminator'
|
|
8
8
|
import { DAY, SECOND } from '@atproto/common'
|
|
9
9
|
import API, { health, wellKnown } from './api'
|
|
10
|
-
import * as error from './error'
|
|
11
|
-
import { dbLogger, loggerMiddleware } from './logger'
|
|
12
10
|
import { OzoneConfig, OzoneSecrets } from './config'
|
|
13
|
-
import {
|
|
14
|
-
import AppContext, { AppContextOptions } from './context'
|
|
11
|
+
import { AppContext, AppContextOptions } from './context'
|
|
15
12
|
import { Member } from './db/schema/member'
|
|
13
|
+
import * as error from './error'
|
|
14
|
+
import { createServer } from './lexicon'
|
|
15
|
+
import { dbLogger, loggerMiddleware } from './logger'
|
|
16
16
|
|
|
17
17
|
export * from './config'
|
|
18
18
|
export { type ImageInvalidator } from './image-invalidator'
|
|
19
19
|
export { Database } from './db'
|
|
20
|
-
export {
|
|
20
|
+
export { EventPusher, EventReverser, OzoneDaemon } from './daemon'
|
|
21
21
|
export { AppContext } from './context'
|
|
22
22
|
export { httpLogger } from './logger'
|
|
23
23
|
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -4381,6 +4381,7 @@ export const schemaDict = {
|
|
|
4381
4381
|
'lex:app.bsky.actor.defs#hiddenPostsPref',
|
|
4382
4382
|
'lex:app.bsky.actor.defs#bskyAppStatePref',
|
|
4383
4383
|
'lex:app.bsky.actor.defs#labelersPref',
|
|
4384
|
+
'lex:app.bsky.actor.defs#postInteractionSettingsPref',
|
|
4384
4385
|
],
|
|
4385
4386
|
},
|
|
4386
4387
|
},
|
|
@@ -4714,6 +4715,38 @@ export const schemaDict = {
|
|
|
4714
4715
|
},
|
|
4715
4716
|
},
|
|
4716
4717
|
},
|
|
4718
|
+
postInteractionSettingsPref: {
|
|
4719
|
+
type: 'object',
|
|
4720
|
+
description:
|
|
4721
|
+
'Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly.',
|
|
4722
|
+
required: [],
|
|
4723
|
+
properties: {
|
|
4724
|
+
threadgateAllowRules: {
|
|
4725
|
+
description:
|
|
4726
|
+
'Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply.',
|
|
4727
|
+
type: 'array',
|
|
4728
|
+
maxLength: 5,
|
|
4729
|
+
items: {
|
|
4730
|
+
type: 'union',
|
|
4731
|
+
refs: [
|
|
4732
|
+
'lex:app.bsky.feed.threadgate#mentionRule',
|
|
4733
|
+
'lex:app.bsky.feed.threadgate#followingRule',
|
|
4734
|
+
'lex:app.bsky.feed.threadgate#listRule',
|
|
4735
|
+
],
|
|
4736
|
+
},
|
|
4737
|
+
},
|
|
4738
|
+
postgateEmbeddingRules: {
|
|
4739
|
+
description:
|
|
4740
|
+
'Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed.',
|
|
4741
|
+
type: 'array',
|
|
4742
|
+
maxLength: 5,
|
|
4743
|
+
items: {
|
|
4744
|
+
type: 'union',
|
|
4745
|
+
refs: ['lex:app.bsky.feed.postgate#disableRule'],
|
|
4746
|
+
},
|
|
4747
|
+
},
|
|
4748
|
+
},
|
|
4749
|
+
},
|
|
4717
4750
|
},
|
|
4718
4751
|
},
|
|
4719
4752
|
AppBskyActorGetPreferences: {
|
|
@@ -7120,6 +7153,8 @@ export const schemaDict = {
|
|
|
7120
7153
|
'List of AT-URIs embedding this post that the author has detached from.',
|
|
7121
7154
|
},
|
|
7122
7155
|
embeddingRules: {
|
|
7156
|
+
description:
|
|
7157
|
+
'List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed.',
|
|
7123
7158
|
type: 'array',
|
|
7124
7159
|
maxLength: 5,
|
|
7125
7160
|
items: {
|
|
@@ -7333,6 +7368,8 @@ export const schemaDict = {
|
|
|
7333
7368
|
description: 'Reference (AT-URI) to the post record.',
|
|
7334
7369
|
},
|
|
7335
7370
|
allow: {
|
|
7371
|
+
description:
|
|
7372
|
+
'List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply.',
|
|
7336
7373
|
type: 'array',
|
|
7337
7374
|
maxLength: 5,
|
|
7338
7375
|
items: {
|
|
@@ -11549,6 +11586,11 @@ export const schemaDict = {
|
|
|
11549
11586
|
type: 'string',
|
|
11550
11587
|
},
|
|
11551
11588
|
},
|
|
11589
|
+
durationInHours: {
|
|
11590
|
+
type: 'integer',
|
|
11591
|
+
description:
|
|
11592
|
+
'Indicates how long the label will remain on the subject. Only applies on labels that are being added.',
|
|
11593
|
+
},
|
|
11552
11594
|
},
|
|
11553
11595
|
},
|
|
11554
11596
|
modEventAcknowledge: {
|
|
@@ -8,6 +8,8 @@ import { CID } from 'multiformats/cid'
|
|
|
8
8
|
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
|
|
9
9
|
import * as AppBskyGraphDefs from '../graph/defs'
|
|
10
10
|
import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
|
|
11
|
+
import * as AppBskyFeedThreadgate from '../feed/threadgate'
|
|
12
|
+
import * as AppBskyFeedPostgate from '../feed/postgate'
|
|
11
13
|
|
|
12
14
|
export interface ProfileViewBasic {
|
|
13
15
|
did: string
|
|
@@ -188,6 +190,7 @@ export type Preferences = (
|
|
|
188
190
|
| HiddenPostsPref
|
|
189
191
|
| BskyAppStatePref
|
|
190
192
|
| LabelersPref
|
|
193
|
+
| PostInteractionSettingsPref
|
|
191
194
|
| { $type: string; [k: string]: unknown }
|
|
192
195
|
)[]
|
|
193
196
|
|
|
@@ -532,3 +535,36 @@ export function isNux(v: unknown): v is Nux {
|
|
|
532
535
|
export function validateNux(v: unknown): ValidationResult {
|
|
533
536
|
return lexicons.validate('app.bsky.actor.defs#nux', v)
|
|
534
537
|
}
|
|
538
|
+
|
|
539
|
+
/** Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly. */
|
|
540
|
+
export interface PostInteractionSettingsPref {
|
|
541
|
+
/** Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply. */
|
|
542
|
+
threadgateAllowRules?: (
|
|
543
|
+
| AppBskyFeedThreadgate.MentionRule
|
|
544
|
+
| AppBskyFeedThreadgate.FollowingRule
|
|
545
|
+
| AppBskyFeedThreadgate.ListRule
|
|
546
|
+
| { $type: string; [k: string]: unknown }
|
|
547
|
+
)[]
|
|
548
|
+
/** Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed. */
|
|
549
|
+
postgateEmbeddingRules?: (
|
|
550
|
+
| AppBskyFeedPostgate.DisableRule
|
|
551
|
+
| { $type: string; [k: string]: unknown }
|
|
552
|
+
)[]
|
|
553
|
+
[k: string]: unknown
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export function isPostInteractionSettingsPref(
|
|
557
|
+
v: unknown,
|
|
558
|
+
): v is PostInteractionSettingsPref {
|
|
559
|
+
return (
|
|
560
|
+
isObj(v) &&
|
|
561
|
+
hasProp(v, '$type') &&
|
|
562
|
+
v.$type === 'app.bsky.actor.defs#postInteractionSettingsPref'
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export function validatePostInteractionSettingsPref(
|
|
567
|
+
v: unknown,
|
|
568
|
+
): ValidationResult {
|
|
569
|
+
return lexicons.validate('app.bsky.actor.defs#postInteractionSettingsPref', v)
|
|
570
|
+
}
|
|
@@ -12,6 +12,7 @@ export interface Record {
|
|
|
12
12
|
post: string
|
|
13
13
|
/** List of AT-URIs embedding this post that the author has detached from. */
|
|
14
14
|
detachedEmbeddingUris?: string[]
|
|
15
|
+
/** List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed. */
|
|
15
16
|
embeddingRules?: (DisableRule | { $type: string; [k: string]: unknown })[]
|
|
16
17
|
[k: string]: unknown
|
|
17
18
|
}
|
|
@@ -9,6 +9,7 @@ import { CID } from 'multiformats/cid'
|
|
|
9
9
|
export interface Record {
|
|
10
10
|
/** Reference (AT-URI) to the post record. */
|
|
11
11
|
post: string
|
|
12
|
+
/** List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply. */
|
|
12
13
|
allow?: (
|
|
13
14
|
| MentionRule
|
|
14
15
|
| FollowingRule
|
|
@@ -347,6 +347,8 @@ export interface ModEventLabel {
|
|
|
347
347
|
comment?: string
|
|
348
348
|
createLabelVals: string[]
|
|
349
349
|
negateLabelVals: string[]
|
|
350
|
+
/** Indicates how long the label will remain on the subject. Only applies on labels that are being added. */
|
|
351
|
+
durationInHours?: number
|
|
350
352
|
[k: string]: unknown
|
|
351
353
|
}
|
|
352
354
|
|
package/src/logger.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IncomingMessage } from 'node:http'
|
|
2
|
-
import pinoHttp,
|
|
2
|
+
import { pinoHttp, stdSerializers } from 'pino-http'
|
|
3
3
|
import { obfuscateHeaders, subsystemLogger } from '@atproto/common'
|
|
4
4
|
|
|
5
5
|
export const dbLogger: ReturnType<typeof subsystemLogger> =
|
package/src/mod-service/index.ts
CHANGED
|
@@ -1,36 +1,56 @@
|
|
|
1
1
|
import net from 'node:net'
|
|
2
2
|
import { Insertable, sql } from 'kysely'
|
|
3
3
|
import { CID } from 'multiformats/cid'
|
|
4
|
-
import {
|
|
5
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
|
4
|
+
import { AtpAgent } from '@atproto/api'
|
|
6
5
|
import { addHoursToDate, chunkArray } from '@atproto/common'
|
|
7
6
|
import { Keypair } from '@atproto/crypto'
|
|
8
7
|
import { IdResolver } from '@atproto/identity'
|
|
9
|
-
import {
|
|
8
|
+
import { AtUri, INVALID_HANDLE } from '@atproto/syntax'
|
|
9
|
+
import { InvalidRequestError } from '@atproto/xrpc-server'
|
|
10
|
+
import { getReviewState } from '../api/util'
|
|
11
|
+
import { BackgroundQueue } from '../background'
|
|
12
|
+
import { OzoneConfig } from '../config'
|
|
13
|
+
import { EventPusher } from '../daemon'
|
|
10
14
|
import { Database } from '../db'
|
|
11
|
-
import {
|
|
15
|
+
import { StatusKeyset, TimeIdKeyset, paginate } from '../db/pagination'
|
|
16
|
+
import { BlobPushEvent } from '../db/schema/blob_push_event'
|
|
17
|
+
import { LabelChannel } from '../db/schema/label'
|
|
18
|
+
import { ModerationEvent } from '../db/schema/moderation_event'
|
|
19
|
+
import { jsonb } from '../db/types'
|
|
20
|
+
import { ImageInvalidator } from '../image-invalidator'
|
|
21
|
+
import { ids } from '../lexicon/lexicons'
|
|
22
|
+
import { RepoBlobRef, RepoRef } from '../lexicon/types/com/atproto/admin/defs'
|
|
23
|
+
import { Label } from '../lexicon/types/com/atproto/label/defs'
|
|
12
24
|
import { Main as StrongRef } from '../lexicon/types/com/atproto/repo/strongRef'
|
|
13
25
|
import {
|
|
26
|
+
REVIEWESCALATED,
|
|
27
|
+
REVIEWOPEN,
|
|
28
|
+
isAccountEvent,
|
|
29
|
+
isIdentityEvent,
|
|
30
|
+
isModEventAcknowledge,
|
|
14
31
|
isModEventComment,
|
|
32
|
+
isModEventEmail,
|
|
15
33
|
isModEventLabel,
|
|
16
34
|
isModEventMute,
|
|
17
35
|
isModEventReport,
|
|
18
|
-
isModEventTakedown,
|
|
19
|
-
isModEventEmail,
|
|
20
36
|
isModEventTag,
|
|
21
|
-
|
|
22
|
-
isIdentityEvent,
|
|
37
|
+
isModEventTakedown,
|
|
23
38
|
isRecordEvent,
|
|
24
|
-
REVIEWESCALATED,
|
|
25
|
-
REVIEWOPEN,
|
|
26
|
-
isModEventAcknowledge,
|
|
27
39
|
} from '../lexicon/types/tools/ozone/moderation/defs'
|
|
28
|
-
import {
|
|
40
|
+
import { QueryParams as QueryStatusParams } from '../lexicon/types/tools/ozone/moderation/queryStatuses'
|
|
41
|
+
import { httpLogger as log } from '../logger'
|
|
42
|
+
import { LABELER_HEADER_NAME, ParsedLabelers } from '../util'
|
|
29
43
|
import {
|
|
30
44
|
adjustModerationSubjectStatus,
|
|
31
45
|
getStatusIdentifierFromSubject,
|
|
32
46
|
moderationSubjectStatusQueryBuilder,
|
|
33
47
|
} from './status'
|
|
48
|
+
import {
|
|
49
|
+
ModSubject,
|
|
50
|
+
RecordSubject,
|
|
51
|
+
RepoSubject,
|
|
52
|
+
subjectFromStatusRow,
|
|
53
|
+
} from './subject'
|
|
34
54
|
import {
|
|
35
55
|
ModEventType,
|
|
36
56
|
ModerationEventRow,
|
|
@@ -38,28 +58,8 @@ import {
|
|
|
38
58
|
ModerationSubjectStatusRowWithHandle,
|
|
39
59
|
ReversibleModerationEvent,
|
|
40
60
|
} from './types'
|
|
41
|
-
import { ModerationEvent } from '../db/schema/moderation_event'
|
|
42
|
-
import { StatusKeyset, TimeIdKeyset, paginate } from '../db/pagination'
|
|
43
|
-
import { Label } from '../lexicon/types/com/atproto/label/defs'
|
|
44
|
-
import { QueryParams as QueryStatusParams } from '../lexicon/types/tools/ozone/moderation/queryStatuses'
|
|
45
|
-
import {
|
|
46
|
-
ModSubject,
|
|
47
|
-
RecordSubject,
|
|
48
|
-
RepoSubject,
|
|
49
|
-
subjectFromStatusRow,
|
|
50
|
-
} from './subject'
|
|
51
|
-
import { jsonb } from '../db/types'
|
|
52
|
-
import { LabelChannel } from '../db/schema/label'
|
|
53
|
-
import { BlobPushEvent } from '../db/schema/blob_push_event'
|
|
54
|
-
import { BackgroundQueue } from '../background'
|
|
55
|
-
import { EventPusher } from '../daemon'
|
|
56
61
|
import { formatLabel, formatLabelRow, signLabel } from './util'
|
|
57
|
-
import {
|
|
58
|
-
import { httpLogger as log } from '../logger'
|
|
59
|
-
import { OzoneConfig } from '../config'
|
|
60
|
-
import { LABELER_HEADER_NAME, ParsedLabelers } from '../util'
|
|
61
|
-
import { ids } from '../lexicon/lexicons'
|
|
62
|
-
import { getReviewState } from '../api/util'
|
|
62
|
+
import { AuthHeaders, ModerationViews } from './views'
|
|
63
63
|
|
|
64
64
|
export type ModerationServiceCreator = (db: Database) => ModerationService
|
|
65
65
|
|
|
@@ -1159,13 +1159,19 @@ export class ModerationService {
|
|
|
1159
1159
|
uri: string,
|
|
1160
1160
|
cid: string | null,
|
|
1161
1161
|
labels: { create?: string[]; negate?: string[] },
|
|
1162
|
+
durationInHours?: number,
|
|
1162
1163
|
): Promise<Label[]> {
|
|
1164
|
+
const exp =
|
|
1165
|
+
durationInHours !== undefined
|
|
1166
|
+
? addHoursToDate(durationInHours).toISOString()
|
|
1167
|
+
: undefined
|
|
1163
1168
|
const { create = [], negate = [] } = labels
|
|
1164
1169
|
const toCreate = create.map((val) => ({
|
|
1165
1170
|
src: this.cfg.service.did,
|
|
1166
1171
|
uri,
|
|
1167
1172
|
cid: cid ?? undefined,
|
|
1168
1173
|
val,
|
|
1174
|
+
exp,
|
|
1169
1175
|
cts: new Date().toISOString(),
|
|
1170
1176
|
}))
|
|
1171
1177
|
const toNegate = negate.map((val) => ({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { HOUR } from '@atproto/common'
|
|
4
4
|
import { AtUri } from '@atproto/syntax'
|
|
5
5
|
import { Database } from '../db'
|
|
6
|
-
import DatabaseSchema from '../db/schema'
|
|
6
|
+
import { DatabaseSchema } from '../db/schema'
|
|
7
7
|
import { jsonb } from '../db/types'
|
|
8
8
|
import { REASONAPPEAL } from '../lexicon/types/com/atproto/moderation/defs'
|
|
9
9
|
import {
|
|
@@ -77,6 +77,8 @@ const getSubjectStatusForModerationEvent = ({
|
|
|
77
77
|
}
|
|
78
78
|
case 'tools.ozone.moderation.defs#modEventTakedown':
|
|
79
79
|
return {
|
|
80
|
+
// If we are doing a takedown, safe to move the item out of appealed state
|
|
81
|
+
...(currentStatus?.appealed ? { appealed: false } : {}),
|
|
80
82
|
takendown: true,
|
|
81
83
|
lastReviewedBy: createdBy,
|
|
82
84
|
reviewState: REVIEWCLOSED,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AtUri } from '@atproto/syntax'
|
|
2
|
-
import { InputSchema as ReportInput } from '../lexicon/types/com/atproto/moderation/createReport'
|
|
3
|
-
import { InputSchema as ActionInput } from '../lexicon/types/tools/ozone/moderation/emitEvent'
|
|
4
2
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
|
5
|
-
import {
|
|
3
|
+
import { MessageRef } from '../lexicon/types/chat/bsky/convo/defs'
|
|
6
4
|
import { RepoRef } from '../lexicon/types/com/atproto/admin/defs'
|
|
5
|
+
import { InputSchema as ReportInput } from '../lexicon/types/com/atproto/moderation/createReport'
|
|
7
6
|
import { Main as StrongRef } from '../lexicon/types/com/atproto/repo/strongRef'
|
|
8
|
-
import {
|
|
7
|
+
import { InputSchema as ActionInput } from '../lexicon/types/tools/ozone/moderation/emitEvent'
|
|
8
|
+
import { ModerationEventRow, ModerationSubjectStatusRow } from './types'
|
|
9
9
|
|
|
10
10
|
type SubjectInput = ReportInput['subject'] | ActionInput['subject']
|
|
11
11
|
|
package/src/mod-service/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Selectable } from 'kysely'
|
|
1
|
+
import { type Selectable } from 'kysely'
|
|
2
|
+
import { ToolsOzoneModerationDefs } from '@atproto/api'
|
|
2
3
|
import { ModerationEvent } from '../db/schema/moderation_event'
|
|
3
4
|
import { ModerationSubjectStatus } from '../db/schema/moderation_subject_status'
|
|
4
|
-
import { ToolsOzoneModerationDefs } from '@atproto/api'
|
|
5
5
|
import { ModSubject } from './subject'
|
|
6
6
|
|
|
7
7
|
export type ModerationEventRow = Selectable<ModerationEvent>
|