@atproto/pds 0.4.30 → 0.4.32
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 +20 -0
- package/dist/account-manager/helpers/account.d.ts.map +1 -1
- package/dist/account-manager/helpers/account.js +4 -1
- package/dist/account-manager/helpers/account.js.map +1 -1
- package/dist/api/com/atproto/admin/updateSubjectStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/updateSubjectStatus.js +15 -3
- package/dist/api/com/atproto/admin/updateSubjectStatus.js.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.js +7 -1
- package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.js +7 -1
- package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
- package/dist/lexicon/index.d.ts +9 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +28 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +108 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +112 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/com/atproto/admin/searchAccounts.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/admin/searchAccounts.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/admin/searchAccounts.js +3 -0
- package/dist/lexicon/types/com/atproto/admin/searchAccounts.js.map +1 -0
- package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts +51 -0
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/server/getConfig.js +26 -0
- package/dist/lexicon/types/tools/ozone/server/getConfig.js.map +1 -0
- package/package.json +4 -4
- package/src/account-manager/helpers/account.ts +4 -1
- package/src/api/com/atproto/admin/updateSubjectStatus.ts +16 -3
- package/src/api/com/atproto/server/activateAccount.ts +11 -1
- package/src/api/com/atproto/server/deactivateAccount.ts +11 -1
- package/src/lexicon/index.ts +34 -0
- package/src/lexicon/lexicons.ts +112 -0
- package/src/lexicon/types/com/atproto/admin/searchAccounts.ts +49 -0
- package/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts +1 -0
- package/src/lexicon/types/tools/ozone/server/getConfig.ts +85 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
|
+
import * as ComAtprotoAdminDefs from './defs';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
email?: string;
|
|
9
|
+
cursor?: string;
|
|
10
|
+
limit: number;
|
|
11
|
+
}
|
|
12
|
+
export type InputSchema = undefined;
|
|
13
|
+
export interface OutputSchema {
|
|
14
|
+
cursor?: string;
|
|
15
|
+
accounts: ComAtprotoAdminDefs.AccountView[];
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export type HandlerInput = undefined;
|
|
19
|
+
export interface HandlerSuccess {
|
|
20
|
+
encoding: 'application/json';
|
|
21
|
+
body: OutputSchema;
|
|
22
|
+
headers?: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number;
|
|
28
|
+
message?: string;
|
|
29
|
+
}
|
|
30
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
31
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
32
|
+
auth: HA;
|
|
33
|
+
params: QueryParams;
|
|
34
|
+
input: HandlerInput;
|
|
35
|
+
req: express.Request;
|
|
36
|
+
res: express.Response;
|
|
37
|
+
};
|
|
38
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
39
|
+
//# sourceMappingURL=searchAccounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchAccounts.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/com/atproto/admin/searchAccounts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,mBAAmB,MAAM,QAAQ,CAAA;AAE7C,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,mBAAmB,CAAC,WAAW,EAAE,CAAA;IAC3C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchAccounts.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/com/atproto/admin/searchAccounts.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateSubjectStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,mBAAmB,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,uBAAuB,MAAM,mBAAmB,CAAA;AAE5D,MAAM,WAAW,WAAW;CAAG;AAE/B,MAAM,WAAW,WAAW;IAC1B,OAAO,EACH,mBAAmB,CAAC,OAAO,GAC3B,uBAAuB,CAAC,IAAI,GAC5B,mBAAmB,CAAC,WAAW,GAC/B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IAC3C,QAAQ,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAA;IACzC,CAAC,CAAC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AAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { ValidationResult } from '@atproto/lexicon';
|
|
6
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
}
|
|
9
|
+
export type InputSchema = undefined;
|
|
10
|
+
export interface OutputSchema {
|
|
11
|
+
appview?: ServiceConfig;
|
|
12
|
+
pds?: ServiceConfig;
|
|
13
|
+
blobDivert?: ServiceConfig;
|
|
14
|
+
chat?: ServiceConfig;
|
|
15
|
+
viewer?: ViewerConfig;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export type HandlerInput = undefined;
|
|
19
|
+
export interface HandlerSuccess {
|
|
20
|
+
encoding: 'application/json';
|
|
21
|
+
body: OutputSchema;
|
|
22
|
+
headers?: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number;
|
|
28
|
+
message?: string;
|
|
29
|
+
}
|
|
30
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
31
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
32
|
+
auth: HA;
|
|
33
|
+
params: QueryParams;
|
|
34
|
+
input: HandlerInput;
|
|
35
|
+
req: express.Request;
|
|
36
|
+
res: express.Response;
|
|
37
|
+
};
|
|
38
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
39
|
+
export interface ServiceConfig {
|
|
40
|
+
url?: string;
|
|
41
|
+
[k: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
export declare function isServiceConfig(v: unknown): v is ServiceConfig;
|
|
44
|
+
export declare function validateServiceConfig(v: unknown): ValidationResult;
|
|
45
|
+
export interface ViewerConfig {
|
|
46
|
+
role?: 'tools.ozone.team.defs#roleAdmin' | 'tools.ozone.team.defs#roleModerator' | 'tools.ozone.team.defs#roleTriage' | (string & {});
|
|
47
|
+
[k: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export declare function isViewerConfig(v: unknown): v is ViewerConfig;
|
|
50
|
+
export declare function validateViewerConfig(v: unknown): ValidationResult;
|
|
51
|
+
//# sourceMappingURL=getConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/tools/ozone/server/getConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAI5D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB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GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAM9D;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAElE;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EACD,iCAAiC,GACjC,qCAAqC,GACrC,kCAAkC,GAClC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAM5D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAEjE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateViewerConfig = exports.isViewerConfig = exports.validateServiceConfig = exports.isServiceConfig = void 0;
|
|
4
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
5
|
+
const util_1 = require("../../../../util");
|
|
6
|
+
function isServiceConfig(v) {
|
|
7
|
+
return ((0, util_1.isObj)(v) &&
|
|
8
|
+
(0, util_1.hasProp)(v, '$type') &&
|
|
9
|
+
v.$type === 'tools.ozone.server.getConfig#serviceConfig');
|
|
10
|
+
}
|
|
11
|
+
exports.isServiceConfig = isServiceConfig;
|
|
12
|
+
function validateServiceConfig(v) {
|
|
13
|
+
return lexicons_1.lexicons.validate('tools.ozone.server.getConfig#serviceConfig', v);
|
|
14
|
+
}
|
|
15
|
+
exports.validateServiceConfig = validateServiceConfig;
|
|
16
|
+
function isViewerConfig(v) {
|
|
17
|
+
return ((0, util_1.isObj)(v) &&
|
|
18
|
+
(0, util_1.hasProp)(v, '$type') &&
|
|
19
|
+
v.$type === 'tools.ozone.server.getConfig#viewerConfig');
|
|
20
|
+
}
|
|
21
|
+
exports.isViewerConfig = isViewerConfig;
|
|
22
|
+
function validateViewerConfig(v) {
|
|
23
|
+
return lexicons_1.lexicons.validate('tools.ozone.server.getConfig#viewerConfig', v);
|
|
24
|
+
}
|
|
25
|
+
exports.validateViewerConfig = validateViewerConfig;
|
|
26
|
+
//# sourceMappingURL=getConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/tools/ozone/server/getConfig.ts"],"names":[],"mappings":";;;AAKA,mDAA+C;AAC/C,2CAAiD;AA+CjD,SAAgB,eAAe,CAAC,CAAU;IACxC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,4CAA4C,CACzD,CAAA;AACH,CAAC;AAND,0CAMC;AAED,SAAgB,qBAAqB,CAAC,CAAU;IAC9C,OAAO,mBAAQ,CAAC,QAAQ,CAAC,4CAA4C,EAAE,CAAC,CAAC,CAAA;AAC3E,CAAC;AAFD,sDAEC;AAWD,SAAgB,cAAc,CAAC,CAAU;IACvC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,2CAA2C,CACxD,CAAA;AACH,CAAC;AAND,wCAMC;AAED,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,mBAAQ,CAAC,QAAQ,CAAC,2CAA2C,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC;AAFD,oDAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/pds",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
|
6
6
|
"keywords": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typed-emitter": "^2.1.0",
|
|
44
44
|
"uint8arrays": "3.0.0",
|
|
45
45
|
"zod": "^3.21.4",
|
|
46
|
-
"@atproto/api": "^0.12.
|
|
46
|
+
"@atproto/api": "^0.12.17",
|
|
47
47
|
"@atproto/aws": "^0.2.0",
|
|
48
48
|
"@atproto/common": "^0.4.0",
|
|
49
49
|
"@atproto/crypto": "^0.4.0",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"jest": "^28.1.2",
|
|
71
71
|
"ts-node": "^10.8.2",
|
|
72
72
|
"ws": "^8.12.0",
|
|
73
|
-
"@atproto/api": "^0.12.
|
|
74
|
-
"@atproto/bsky": "^0.0.
|
|
73
|
+
"@atproto/api": "^0.12.17",
|
|
74
|
+
"@atproto/bsky": "^0.0.60",
|
|
75
75
|
"@atproto/lex-cli": "^0.4.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
@@ -182,7 +182,10 @@ export const updateEmail = async (
|
|
|
182
182
|
await db.executeWithRetry(
|
|
183
183
|
db.db
|
|
184
184
|
.updateTable('account')
|
|
185
|
-
.set({
|
|
185
|
+
.set({
|
|
186
|
+
email: email.toLowerCase(),
|
|
187
|
+
emailConfirmedAt: null,
|
|
188
|
+
})
|
|
186
189
|
.where('did', '=', did),
|
|
187
190
|
)
|
|
188
191
|
} catch (err) {
|
|
@@ -13,12 +13,10 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
13
13
|
server.com.atproto.admin.updateSubjectStatus({
|
|
14
14
|
auth: ctx.authVerifier.moderator,
|
|
15
15
|
handler: async ({ input }) => {
|
|
16
|
-
const { subject, takedown } = input.body
|
|
16
|
+
const { subject, takedown, deactivated } = input.body
|
|
17
17
|
if (takedown) {
|
|
18
18
|
if (isRepoRef(subject)) {
|
|
19
19
|
await ctx.accountManager.takedownAccount(subject.did, takedown)
|
|
20
|
-
const status = await ctx.accountManager.getAccountStatus(subject.did)
|
|
21
|
-
await ctx.sequencer.sequenceAccountEvt(subject.did, status)
|
|
22
20
|
} else if (isStrongRef(subject)) {
|
|
23
21
|
const uri = new AtUri(subject.uri)
|
|
24
22
|
await ctx.actorStore.transact(uri.hostname, (store) =>
|
|
@@ -36,6 +34,21 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|
|
37
|
+
if (deactivated) {
|
|
38
|
+
if (isRepoRef(subject)) {
|
|
39
|
+
if (deactivated.applied) {
|
|
40
|
+
await ctx.accountManager.deactivateAccount(subject.did, null)
|
|
41
|
+
} else {
|
|
42
|
+
await ctx.accountManager.activateAccount(subject.did)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (isRepoRef(subject)) {
|
|
48
|
+
const status = await ctx.accountManager.getAccountStatus(subject.did)
|
|
49
|
+
await ctx.sequencer.sequenceAccountEvt(subject.did, status)
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
return {
|
|
40
53
|
encoding: 'application/json',
|
|
41
54
|
body: {
|
|
@@ -4,11 +4,21 @@ import { INVALID_HANDLE } from '@atproto/syntax'
|
|
|
4
4
|
import { Server } from '../../../../lexicon'
|
|
5
5
|
import AppContext from '../../../../context'
|
|
6
6
|
import { assertValidDidDocumentForService } from './util'
|
|
7
|
+
import { authPassthru } from '../../../proxy'
|
|
7
8
|
|
|
8
9
|
export default function (server: Server, ctx: AppContext) {
|
|
9
10
|
server.com.atproto.server.activateAccount({
|
|
10
11
|
auth: ctx.authVerifier.accessFull(),
|
|
11
|
-
handler: async ({ auth }) => {
|
|
12
|
+
handler: async ({ auth, req }) => {
|
|
13
|
+
// in the case of entryway, the full flow is activateAccount (PDS) -> activateAccount (Entryway) -> updateSubjectStatus(PDS)
|
|
14
|
+
if (ctx.entrywayAgent) {
|
|
15
|
+
await ctx.entrywayAgent.com.atproto.server.activateAccount(
|
|
16
|
+
undefined,
|
|
17
|
+
authPassthru(req, true),
|
|
18
|
+
)
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
const requester = auth.credentials.did
|
|
13
23
|
|
|
14
24
|
await assertValidDidDocumentForService(ctx, requester)
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { Server } from '../../../../lexicon'
|
|
2
2
|
import AppContext from '../../../../context'
|
|
3
|
+
import { authPassthru } from '../../../proxy'
|
|
3
4
|
|
|
4
5
|
export default function (server: Server, ctx: AppContext) {
|
|
5
6
|
server.com.atproto.server.deactivateAccount({
|
|
6
7
|
auth: ctx.authVerifier.accessFull(),
|
|
7
|
-
handler: async ({ auth, input }) => {
|
|
8
|
+
handler: async ({ auth, input, req }) => {
|
|
9
|
+
// in the case of entryway, the full flow is deactivateAccount (PDS) -> deactivateAccount (Entryway) -> updateSubjectStatus(PDS)
|
|
10
|
+
if (ctx.entrywayAgent) {
|
|
11
|
+
await ctx.entrywayAgent.com.atproto.server.deactivateAccount(
|
|
12
|
+
input.body,
|
|
13
|
+
authPassthru(req, true),
|
|
14
|
+
)
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
const requester = auth.credentials.did
|
|
9
19
|
await ctx.accountManager.deactivateAccount(
|
|
10
20
|
requester,
|
package/src/lexicon/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ import * as ComAtprotoAdminGetAccountInfo from './types/com/atproto/admin/getAcc
|
|
|
17
17
|
import * as ComAtprotoAdminGetAccountInfos from './types/com/atproto/admin/getAccountInfos'
|
|
18
18
|
import * as ComAtprotoAdminGetInviteCodes from './types/com/atproto/admin/getInviteCodes'
|
|
19
19
|
import * as ComAtprotoAdminGetSubjectStatus from './types/com/atproto/admin/getSubjectStatus'
|
|
20
|
+
import * as ComAtprotoAdminSearchAccounts from './types/com/atproto/admin/searchAccounts'
|
|
20
21
|
import * as ComAtprotoAdminSendEmail from './types/com/atproto/admin/sendEmail'
|
|
21
22
|
import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/updateAccountEmail'
|
|
22
23
|
import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle'
|
|
@@ -158,6 +159,7 @@ import * as ToolsOzoneModerationGetRepo from './types/tools/ozone/moderation/get
|
|
|
158
159
|
import * as ToolsOzoneModerationQueryEvents from './types/tools/ozone/moderation/queryEvents'
|
|
159
160
|
import * as ToolsOzoneModerationQueryStatuses from './types/tools/ozone/moderation/queryStatuses'
|
|
160
161
|
import * as ToolsOzoneModerationSearchRepos from './types/tools/ozone/moderation/searchRepos'
|
|
162
|
+
import * as ToolsOzoneServerGetConfig from './types/tools/ozone/server/getConfig'
|
|
161
163
|
|
|
162
164
|
export const COM_ATPROTO_MODERATION = {
|
|
163
165
|
DefsReasonSpam: 'com.atproto.moderation.defs#reasonSpam',
|
|
@@ -342,6 +344,17 @@ export class ComAtprotoAdminNS {
|
|
|
342
344
|
return this._server.xrpc.method(nsid, cfg)
|
|
343
345
|
}
|
|
344
346
|
|
|
347
|
+
searchAccounts<AV extends AuthVerifier>(
|
|
348
|
+
cfg: ConfigOf<
|
|
349
|
+
AV,
|
|
350
|
+
ComAtprotoAdminSearchAccounts.Handler<ExtractAuth<AV>>,
|
|
351
|
+
ComAtprotoAdminSearchAccounts.HandlerReqCtx<ExtractAuth<AV>>
|
|
352
|
+
>,
|
|
353
|
+
) {
|
|
354
|
+
const nsid = 'com.atproto.admin.searchAccounts' // @ts-ignore
|
|
355
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
356
|
+
}
|
|
357
|
+
|
|
345
358
|
sendEmail<AV extends AuthVerifier>(
|
|
346
359
|
cfg: ConfigOf<
|
|
347
360
|
AV,
|
|
@@ -1993,11 +2006,13 @@ export class ToolsOzoneNS {
|
|
|
1993
2006
|
_server: Server
|
|
1994
2007
|
communication: ToolsOzoneCommunicationNS
|
|
1995
2008
|
moderation: ToolsOzoneModerationNS
|
|
2009
|
+
server: ToolsOzoneServerNS
|
|
1996
2010
|
|
|
1997
2011
|
constructor(server: Server) {
|
|
1998
2012
|
this._server = server
|
|
1999
2013
|
this.communication = new ToolsOzoneCommunicationNS(server)
|
|
2000
2014
|
this.moderation = new ToolsOzoneModerationNS(server)
|
|
2015
|
+
this.server = new ToolsOzoneServerNS(server)
|
|
2001
2016
|
}
|
|
2002
2017
|
}
|
|
2003
2018
|
|
|
@@ -2138,6 +2153,25 @@ export class ToolsOzoneModerationNS {
|
|
|
2138
2153
|
}
|
|
2139
2154
|
}
|
|
2140
2155
|
|
|
2156
|
+
export class ToolsOzoneServerNS {
|
|
2157
|
+
_server: Server
|
|
2158
|
+
|
|
2159
|
+
constructor(server: Server) {
|
|
2160
|
+
this._server = server
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
getConfig<AV extends AuthVerifier>(
|
|
2164
|
+
cfg: ConfigOf<
|
|
2165
|
+
AV,
|
|
2166
|
+
ToolsOzoneServerGetConfig.Handler<ExtractAuth<AV>>,
|
|
2167
|
+
ToolsOzoneServerGetConfig.HandlerReqCtx<ExtractAuth<AV>>
|
|
2168
|
+
>,
|
|
2169
|
+
) {
|
|
2170
|
+
const nsid = 'tools.ozone.server.getConfig' // @ts-ignore
|
|
2171
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2141
2175
|
type SharedRateLimitOpts<T> = {
|
|
2142
2176
|
name: string
|
|
2143
2177
|
calcKey?: (ctx: T) => string
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -378,6 +378,52 @@ export const schemaDict = {
|
|
|
378
378
|
},
|
|
379
379
|
},
|
|
380
380
|
},
|
|
381
|
+
ComAtprotoAdminSearchAccounts: {
|
|
382
|
+
lexicon: 1,
|
|
383
|
+
id: 'com.atproto.admin.searchAccounts',
|
|
384
|
+
defs: {
|
|
385
|
+
main: {
|
|
386
|
+
type: 'query',
|
|
387
|
+
description: 'Get list of accounts that matches your search query.',
|
|
388
|
+
parameters: {
|
|
389
|
+
type: 'params',
|
|
390
|
+
properties: {
|
|
391
|
+
email: {
|
|
392
|
+
type: 'string',
|
|
393
|
+
},
|
|
394
|
+
cursor: {
|
|
395
|
+
type: 'string',
|
|
396
|
+
},
|
|
397
|
+
limit: {
|
|
398
|
+
type: 'integer',
|
|
399
|
+
minimum: 1,
|
|
400
|
+
maximum: 100,
|
|
401
|
+
default: 50,
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
output: {
|
|
406
|
+
encoding: 'application/json',
|
|
407
|
+
schema: {
|
|
408
|
+
type: 'object',
|
|
409
|
+
required: ['accounts'],
|
|
410
|
+
properties: {
|
|
411
|
+
cursor: {
|
|
412
|
+
type: 'string',
|
|
413
|
+
},
|
|
414
|
+
accounts: {
|
|
415
|
+
type: 'array',
|
|
416
|
+
items: {
|
|
417
|
+
type: 'ref',
|
|
418
|
+
ref: 'lex:com.atproto.admin.defs#accountView',
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
},
|
|
381
427
|
ComAtprotoAdminSendEmail: {
|
|
382
428
|
lexicon: 1,
|
|
383
429
|
id: 'com.atproto.admin.sendEmail',
|
|
@@ -535,6 +581,10 @@ export const schemaDict = {
|
|
|
535
581
|
type: 'ref',
|
|
536
582
|
ref: 'lex:com.atproto.admin.defs#statusAttr',
|
|
537
583
|
},
|
|
584
|
+
deactivated: {
|
|
585
|
+
type: 'ref',
|
|
586
|
+
ref: 'lex:com.atproto.admin.defs#statusAttr',
|
|
587
|
+
},
|
|
538
588
|
},
|
|
539
589
|
},
|
|
540
590
|
},
|
|
@@ -10770,6 +10820,66 @@ export const schemaDict = {
|
|
|
10770
10820
|
},
|
|
10771
10821
|
},
|
|
10772
10822
|
},
|
|
10823
|
+
ToolsOzoneServerGetConfig: {
|
|
10824
|
+
lexicon: 1,
|
|
10825
|
+
id: 'tools.ozone.server.getConfig',
|
|
10826
|
+
defs: {
|
|
10827
|
+
main: {
|
|
10828
|
+
type: 'query',
|
|
10829
|
+
description: "Get details about ozone's server configuration.",
|
|
10830
|
+
output: {
|
|
10831
|
+
encoding: 'application/json',
|
|
10832
|
+
schema: {
|
|
10833
|
+
type: 'object',
|
|
10834
|
+
properties: {
|
|
10835
|
+
appview: {
|
|
10836
|
+
type: 'ref',
|
|
10837
|
+
ref: 'lex:tools.ozone.server.getConfig#serviceConfig',
|
|
10838
|
+
},
|
|
10839
|
+
pds: {
|
|
10840
|
+
type: 'ref',
|
|
10841
|
+
ref: 'lex:tools.ozone.server.getConfig#serviceConfig',
|
|
10842
|
+
},
|
|
10843
|
+
blobDivert: {
|
|
10844
|
+
type: 'ref',
|
|
10845
|
+
ref: 'lex:tools.ozone.server.getConfig#serviceConfig',
|
|
10846
|
+
},
|
|
10847
|
+
chat: {
|
|
10848
|
+
type: 'ref',
|
|
10849
|
+
ref: 'lex:tools.ozone.server.getConfig#serviceConfig',
|
|
10850
|
+
},
|
|
10851
|
+
viewer: {
|
|
10852
|
+
type: 'ref',
|
|
10853
|
+
ref: 'lex:tools.ozone.server.getConfig#viewerConfig',
|
|
10854
|
+
},
|
|
10855
|
+
},
|
|
10856
|
+
},
|
|
10857
|
+
},
|
|
10858
|
+
},
|
|
10859
|
+
serviceConfig: {
|
|
10860
|
+
type: 'object',
|
|
10861
|
+
properties: {
|
|
10862
|
+
url: {
|
|
10863
|
+
type: 'string',
|
|
10864
|
+
format: 'uri',
|
|
10865
|
+
},
|
|
10866
|
+
},
|
|
10867
|
+
},
|
|
10868
|
+
viewerConfig: {
|
|
10869
|
+
type: 'object',
|
|
10870
|
+
properties: {
|
|
10871
|
+
role: {
|
|
10872
|
+
type: 'string',
|
|
10873
|
+
knownValues: [
|
|
10874
|
+
'tools.ozone.team.defs#roleAdmin',
|
|
10875
|
+
'tools.ozone.team.defs#roleModerator',
|
|
10876
|
+
'tools.ozone.team.defs#roleTriage',
|
|
10877
|
+
],
|
|
10878
|
+
},
|
|
10879
|
+
},
|
|
10880
|
+
},
|
|
10881
|
+
},
|
|
10882
|
+
},
|
|
10773
10883
|
}
|
|
10774
10884
|
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
|
|
10775
10885
|
export const lexicons: Lexicons = new Lexicons(schemas)
|
|
@@ -10784,6 +10894,7 @@ export const ids = {
|
|
|
10784
10894
|
ComAtprotoAdminGetAccountInfos: 'com.atproto.admin.getAccountInfos',
|
|
10785
10895
|
ComAtprotoAdminGetInviteCodes: 'com.atproto.admin.getInviteCodes',
|
|
10786
10896
|
ComAtprotoAdminGetSubjectStatus: 'com.atproto.admin.getSubjectStatus',
|
|
10897
|
+
ComAtprotoAdminSearchAccounts: 'com.atproto.admin.searchAccounts',
|
|
10787
10898
|
ComAtprotoAdminSendEmail: 'com.atproto.admin.sendEmail',
|
|
10788
10899
|
ComAtprotoAdminUpdateAccountEmail: 'com.atproto.admin.updateAccountEmail',
|
|
10789
10900
|
ComAtprotoAdminUpdateAccountHandle: 'com.atproto.admin.updateAccountHandle',
|
|
@@ -10975,4 +11086,5 @@ export const ids = {
|
|
|
10975
11086
|
ToolsOzoneModerationQueryEvents: 'tools.ozone.moderation.queryEvents',
|
|
10976
11087
|
ToolsOzoneModerationQueryStatuses: 'tools.ozone.moderation.queryStatuses',
|
|
10977
11088
|
ToolsOzoneModerationSearchRepos: 'tools.ozone.moderation.searchRepos',
|
|
11089
|
+
ToolsOzoneServerGetConfig: 'tools.ozone.server.getConfig',
|
|
10978
11090
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ComAtprotoAdminDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {
|
|
13
|
+
email?: string
|
|
14
|
+
cursor?: string
|
|
15
|
+
limit: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type InputSchema = undefined
|
|
19
|
+
|
|
20
|
+
export interface OutputSchema {
|
|
21
|
+
cursor?: string
|
|
22
|
+
accounts: ComAtprotoAdminDefs.AccountView[]
|
|
23
|
+
[k: string]: unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type HandlerInput = undefined
|
|
27
|
+
|
|
28
|
+
export interface HandlerSuccess {
|
|
29
|
+
encoding: 'application/json'
|
|
30
|
+
body: OutputSchema
|
|
31
|
+
headers?: { [key: string]: string }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface HandlerError {
|
|
35
|
+
status: number
|
|
36
|
+
message?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
40
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
41
|
+
auth: HA
|
|
42
|
+
params: QueryParams
|
|
43
|
+
input: HandlerInput
|
|
44
|
+
req: express.Request
|
|
45
|
+
res: express.Response
|
|
46
|
+
}
|
|
47
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
48
|
+
ctx: HandlerReqCtx<HA>,
|
|
49
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {}
|
|
12
|
+
|
|
13
|
+
export type InputSchema = undefined
|
|
14
|
+
|
|
15
|
+
export interface OutputSchema {
|
|
16
|
+
appview?: ServiceConfig
|
|
17
|
+
pds?: ServiceConfig
|
|
18
|
+
blobDivert?: ServiceConfig
|
|
19
|
+
chat?: ServiceConfig
|
|
20
|
+
viewer?: ViewerConfig
|
|
21
|
+
[k: string]: unknown
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type HandlerInput = undefined
|
|
25
|
+
|
|
26
|
+
export interface HandlerSuccess {
|
|
27
|
+
encoding: 'application/json'
|
|
28
|
+
body: OutputSchema
|
|
29
|
+
headers?: { [key: string]: string }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface HandlerError {
|
|
33
|
+
status: number
|
|
34
|
+
message?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
38
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
39
|
+
auth: HA
|
|
40
|
+
params: QueryParams
|
|
41
|
+
input: HandlerInput
|
|
42
|
+
req: express.Request
|
|
43
|
+
res: express.Response
|
|
44
|
+
}
|
|
45
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
46
|
+
ctx: HandlerReqCtx<HA>,
|
|
47
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
48
|
+
|
|
49
|
+
export interface ServiceConfig {
|
|
50
|
+
url?: string
|
|
51
|
+
[k: string]: unknown
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function isServiceConfig(v: unknown): v is ServiceConfig {
|
|
55
|
+
return (
|
|
56
|
+
isObj(v) &&
|
|
57
|
+
hasProp(v, '$type') &&
|
|
58
|
+
v.$type === 'tools.ozone.server.getConfig#serviceConfig'
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function validateServiceConfig(v: unknown): ValidationResult {
|
|
63
|
+
return lexicons.validate('tools.ozone.server.getConfig#serviceConfig', v)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ViewerConfig {
|
|
67
|
+
role?:
|
|
68
|
+
| 'tools.ozone.team.defs#roleAdmin'
|
|
69
|
+
| 'tools.ozone.team.defs#roleModerator'
|
|
70
|
+
| 'tools.ozone.team.defs#roleTriage'
|
|
71
|
+
| (string & {})
|
|
72
|
+
[k: string]: unknown
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function isViewerConfig(v: unknown): v is ViewerConfig {
|
|
76
|
+
return (
|
|
77
|
+
isObj(v) &&
|
|
78
|
+
hasProp(v, '$type') &&
|
|
79
|
+
v.$type === 'tools.ozone.server.getConfig#viewerConfig'
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function validateViewerConfig(v: unknown): ValidationResult {
|
|
84
|
+
return lexicons.validate('tools.ozone.server.getConfig#viewerConfig', v)
|
|
85
|
+
}
|