@atproto/pds 0.4.6 → 0.4.7
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 +9 -0
- package/dist/config/config.d.ts +1 -0
- package/dist/config/env.d.ts +1 -0
- package/dist/index.js +34 -1
- package/dist/index.js.map +2 -2
- package/dist/lexicon/lexicons.d.ts +13 -0
- package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +7 -0
- package/package.json +5 -5
- package/src/api/com/atproto/server/describeServer.ts +4 -0
- package/src/config/config.ts +2 -0
- package/src/config/env.ts +2 -0
- package/src/lexicon/lexicons.ts +13 -0
- package/src/lexicon/types/com/atproto/server/describeServer.ts +18 -0
- package/tests/account.test.ts +2 -0
- package/tests/proxied/__snapshots__/feedgen.test.ts.snap +0 -3
- package/tests/proxied/__snapshots__/views.test.ts.snap +0 -73
- package/tests/proxied/admin.test.ts +22 -17
@@ -2206,6 +2206,11 @@ export declare const schemaDict: {
|
|
2206
2206
|
description: string;
|
2207
2207
|
ref: string;
|
2208
2208
|
};
|
2209
|
+
contact: {
|
2210
|
+
type: string;
|
2211
|
+
description: string;
|
2212
|
+
ref: string;
|
2213
|
+
};
|
2209
2214
|
did: {
|
2210
2215
|
type: string;
|
2211
2216
|
format: string;
|
@@ -2225,6 +2230,14 @@ export declare const schemaDict: {
|
|
2225
2230
|
};
|
2226
2231
|
};
|
2227
2232
|
};
|
2233
|
+
contact: {
|
2234
|
+
type: string;
|
2235
|
+
properties: {
|
2236
|
+
email: {
|
2237
|
+
type: string;
|
2238
|
+
};
|
2239
|
+
};
|
2240
|
+
};
|
2228
2241
|
};
|
2229
2242
|
};
|
2230
2243
|
ComAtprotoServerGetAccountInviteCodes: {
|
@@ -9,6 +9,7 @@ export interface OutputSchema {
|
|
9
9
|
phoneVerificationRequired?: boolean;
|
10
10
|
availableUserDomains: string[];
|
11
11
|
links?: Links;
|
12
|
+
contact?: Contact;
|
12
13
|
did: string;
|
13
14
|
[k: string]: unknown;
|
14
15
|
}
|
@@ -40,3 +41,9 @@ export interface Links {
|
|
40
41
|
}
|
41
42
|
export declare function isLinks(v: unknown): v is Links;
|
42
43
|
export declare function validateLinks(v: unknown): ValidationResult;
|
44
|
+
export interface Contact {
|
45
|
+
email?: string;
|
46
|
+
[k: string]: unknown;
|
47
|
+
}
|
48
|
+
export declare function isContact(v: unknown): v is Contact;
|
49
|
+
export declare function validateContact(v: unknown): ValidationResult;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/pds",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.7",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
6
6
|
"keywords": [
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"typed-emitter": "^2.1.0",
|
45
45
|
"uint8arrays": "3.0.0",
|
46
46
|
"zod": "^3.21.4",
|
47
|
-
"@atproto/api": "^0.11.
|
47
|
+
"@atproto/api": "^0.11.1",
|
48
48
|
"@atproto/aws": "^0.1.9",
|
49
49
|
"@atproto/common": "^0.3.4",
|
50
50
|
"@atproto/crypto": "^0.3.0",
|
@@ -68,9 +68,9 @@
|
|
68
68
|
"axios": "^0.27.2",
|
69
69
|
"get-port": "^6.1.2",
|
70
70
|
"ws": "^8.12.0",
|
71
|
-
"@atproto/api": "^0.11.
|
72
|
-
"@atproto/bsky": "^0.0.
|
73
|
-
"@atproto/dev-env": "^0.2.
|
71
|
+
"@atproto/api": "^0.11.1",
|
72
|
+
"@atproto/bsky": "^0.0.39",
|
73
|
+
"@atproto/dev-env": "^0.2.39",
|
74
74
|
"@atproto/lex-cli": "^0.3.2"
|
75
75
|
},
|
76
76
|
"scripts": {
|
@@ -7,6 +7,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
7
7
|
const inviteCodeRequired = ctx.cfg.invites.required
|
8
8
|
const privacyPolicy = ctx.cfg.service.privacyPolicyUrl
|
9
9
|
const termsOfService = ctx.cfg.service.termsOfServiceUrl
|
10
|
+
const contactEmailAddress = ctx.cfg.service.contactEmailAddress
|
10
11
|
|
11
12
|
return {
|
12
13
|
encoding: 'application/json',
|
@@ -15,6 +16,9 @@ export default function (server: Server, ctx: AppContext) {
|
|
15
16
|
availableUserDomains,
|
16
17
|
inviteCodeRequired,
|
17
18
|
links: { privacyPolicy, termsOfService },
|
19
|
+
contact: {
|
20
|
+
email: contactEmailAddress,
|
21
|
+
},
|
18
22
|
},
|
19
23
|
}
|
20
24
|
})
|
package/src/config/config.ts
CHANGED
@@ -22,6 +22,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
|
|
22
22
|
version: env.version, // default?
|
23
23
|
privacyPolicyUrl: env.privacyPolicyUrl,
|
24
24
|
termsOfServiceUrl: env.termsOfServiceUrl,
|
25
|
+
contactEmailAddress: env.contactEmailAddress,
|
25
26
|
acceptingImports: env.acceptingImports ?? true,
|
26
27
|
blobUploadLimit: env.blobUploadLimit ?? 5 * 1024 * 1024, // 5mb
|
27
28
|
devMode: env.devMode ?? false,
|
@@ -281,6 +282,7 @@ export type ServiceConfig = {
|
|
281
282
|
termsOfServiceUrl?: string
|
282
283
|
acceptingImports: boolean
|
283
284
|
blobUploadLimit: number
|
285
|
+
contactEmailAddress?: string
|
284
286
|
devMode: boolean
|
285
287
|
}
|
286
288
|
|
package/src/config/env.ts
CHANGED
@@ -9,6 +9,7 @@ export const readEnv = (): ServerEnvironment => {
|
|
9
9
|
version: envStr('PDS_VERSION'),
|
10
10
|
privacyPolicyUrl: envStr('PDS_PRIVACY_POLICY_URL'),
|
11
11
|
termsOfServiceUrl: envStr('PDS_TERMS_OF_SERVICE_URL'),
|
12
|
+
contactEmailAddress: envStr('PDS_CONTACT_EMAIL_ADDRESS'),
|
12
13
|
acceptingImports: envBool('PDS_ACCEPTING_REPO_IMPORTS'),
|
13
14
|
blobUploadLimit: envInt('PDS_BLOB_UPLOAD_LIMIT'),
|
14
15
|
devMode: envBool('PDS_DEV_MODE'),
|
@@ -115,6 +116,7 @@ export type ServerEnvironment = {
|
|
115
116
|
version?: string
|
116
117
|
privacyPolicyUrl?: string
|
117
118
|
termsOfServiceUrl?: string
|
119
|
+
contactEmailAddress?: string
|
118
120
|
acceptingImports?: boolean
|
119
121
|
blobUploadLimit?: number
|
120
122
|
devMode?: boolean
|
package/src/lexicon/lexicons.ts
CHANGED
@@ -2420,6 +2420,11 @@ export const schemaDict = {
|
|
2420
2420
|
description: 'URLs of service policy documents.',
|
2421
2421
|
ref: 'lex:com.atproto.server.describeServer#links',
|
2422
2422
|
},
|
2423
|
+
contact: {
|
2424
|
+
type: 'ref',
|
2425
|
+
description: 'Contact information',
|
2426
|
+
ref: 'lex:com.atproto.server.describeServer#contact',
|
2427
|
+
},
|
2423
2428
|
did: {
|
2424
2429
|
type: 'string',
|
2425
2430
|
format: 'did',
|
@@ -2439,6 +2444,14 @@ export const schemaDict = {
|
|
2439
2444
|
},
|
2440
2445
|
},
|
2441
2446
|
},
|
2447
|
+
contact: {
|
2448
|
+
type: 'object',
|
2449
|
+
properties: {
|
2450
|
+
email: {
|
2451
|
+
type: 'string',
|
2452
|
+
},
|
2453
|
+
},
|
2454
|
+
},
|
2442
2455
|
},
|
2443
2456
|
},
|
2444
2457
|
ComAtprotoServerGetAccountInviteCodes: {
|
@@ -20,6 +20,7 @@ export interface OutputSchema {
|
|
20
20
|
/** List of domain suffixes that can be used in account handles. */
|
21
21
|
availableUserDomains: string[]
|
22
22
|
links?: Links
|
23
|
+
contact?: Contact
|
23
24
|
did: string
|
24
25
|
[k: string]: unknown
|
25
26
|
}
|
@@ -66,3 +67,20 @@ export function isLinks(v: unknown): v is Links {
|
|
66
67
|
export function validateLinks(v: unknown): ValidationResult {
|
67
68
|
return lexicons.validate('com.atproto.server.describeServer#links', v)
|
68
69
|
}
|
70
|
+
|
71
|
+
export interface Contact {
|
72
|
+
email?: string
|
73
|
+
[k: string]: unknown
|
74
|
+
}
|
75
|
+
|
76
|
+
export function isContact(v: unknown): v is Contact {
|
77
|
+
return (
|
78
|
+
isObj(v) &&
|
79
|
+
hasProp(v, '$type') &&
|
80
|
+
v.$type === 'com.atproto.server.describeServer#contact'
|
81
|
+
)
|
82
|
+
}
|
83
|
+
|
84
|
+
export function validateContact(v: unknown): ValidationResult {
|
85
|
+
return lexicons.validate('com.atproto.server.describeServer#contact', v)
|
86
|
+
}
|
package/tests/account.test.ts
CHANGED
@@ -26,6 +26,7 @@ describe('account', () => {
|
|
26
26
|
network = await TestNetworkNoAppView.create({
|
27
27
|
dbPostgresSchema: 'account',
|
28
28
|
pds: {
|
29
|
+
contactEmailAddress: 'abuse@example.com',
|
29
30
|
termsOfServiceUrl: 'https://example.com/tos',
|
30
31
|
privacyPolicyUrl: 'https://example.com/privacy-policy',
|
31
32
|
},
|
@@ -58,6 +59,7 @@ describe('account', () => {
|
|
58
59
|
'https://example.com/privacy-policy',
|
59
60
|
)
|
60
61
|
expect(res.data.links?.termsOfService).toBe('https://example.com/tos')
|
62
|
+
expect(res.data.contact?.email).toBe('abuse@example.com')
|
61
63
|
})
|
62
64
|
|
63
65
|
it('fails on invalid handles', async () => {
|
@@ -14,7 +14,6 @@ Object {
|
|
14
14
|
Object {
|
15
15
|
"cid": "cids(2)",
|
16
16
|
"cts": "1970-01-01T00:00:00.000Z",
|
17
|
-
"neg": false,
|
18
17
|
"src": "user(0)",
|
19
18
|
"uri": "record(1)",
|
20
19
|
"val": "self-label-a",
|
@@ -22,7 +21,6 @@ Object {
|
|
22
21
|
Object {
|
23
22
|
"cid": "cids(2)",
|
24
23
|
"cts": "1970-01-01T00:00:00.000Z",
|
25
|
-
"neg": false,
|
26
24
|
"src": "user(0)",
|
27
25
|
"uri": "record(1)",
|
28
26
|
"val": "self-label-b",
|
@@ -39,7 +37,6 @@ Object {
|
|
39
37
|
Object {
|
40
38
|
"cid": "cids(0)",
|
41
39
|
"cts": "1970-01-01T00:00:00.000Z",
|
42
|
-
"neg": false,
|
43
40
|
"src": "user(0)",
|
44
41
|
"uri": "record(0)",
|
45
42
|
"val": "self-label",
|