@atproto/pds 0.4.23 → 0.4.24
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/dist/api/chat/index.d.ts +4 -0
- package/dist/api/chat/index.d.ts.map +1 -0
- package/dist/api/chat/index.js +91 -0
- package/dist/api/chat/index.js.map +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/pipethrough.d.ts +2 -0
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +12 -1
- package/dist/pipethrough.js.map +1 -1
- package/package.json +4 -4
- package/src/api/chat/index.ts +90 -0
- package/src/api/index.ts +2 -0
- package/src/pipethrough.ts +17 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# @atproto/pds
|
2
2
|
|
3
|
+
## 0.4.24
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [`cf25a60e2`](https://github.com/bluesky-social/atproto/commit/cf25a60e25b7531a359f0849729209a55193f7d6) Thanks [@devinivy](https://github.com/devinivy)! - Do not allow app passwords to communicate with chat service
|
8
|
+
|
9
|
+
- Updated dependencies [[`1f560f021`](https://github.com/bluesky-social/atproto/commit/1f560f021c07eb9e8d76577e67fd2d7ac39cdee4)]:
|
10
|
+
- @atproto/api@0.12.12
|
11
|
+
|
3
12
|
## 0.4.23
|
4
13
|
|
5
14
|
### Patch Changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAqFvD"}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const pipethrough_1 = require("../../pipethrough");
|
4
|
+
function default_1(server, ctx) {
|
5
|
+
server.chat.bsky.actor.deleteAccount({
|
6
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
7
|
+
handler: async ({ req, auth }) => {
|
8
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did);
|
9
|
+
},
|
10
|
+
});
|
11
|
+
server.chat.bsky.actor.exportAccountData({
|
12
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
13
|
+
handler: ({ req, auth }) => {
|
14
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
15
|
+
},
|
16
|
+
});
|
17
|
+
server.chat.bsky.convo.deleteMessageForSelf({
|
18
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
19
|
+
handler: ({ req, auth, input }) => {
|
20
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
21
|
+
},
|
22
|
+
});
|
23
|
+
server.chat.bsky.convo.getConvo({
|
24
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
25
|
+
handler: ({ req, auth }) => {
|
26
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
27
|
+
},
|
28
|
+
});
|
29
|
+
server.chat.bsky.convo.getConvoForMembers({
|
30
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
31
|
+
handler: ({ req, auth }) => {
|
32
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
33
|
+
},
|
34
|
+
});
|
35
|
+
server.chat.bsky.convo.getLog({
|
36
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
37
|
+
handler: ({ req, auth }) => {
|
38
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
39
|
+
},
|
40
|
+
});
|
41
|
+
server.chat.bsky.convo.getMessages({
|
42
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
43
|
+
handler: ({ req, auth }) => {
|
44
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
45
|
+
},
|
46
|
+
});
|
47
|
+
server.chat.bsky.convo.leaveConvo({
|
48
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
49
|
+
handler: ({ req, auth, input }) => {
|
50
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
51
|
+
},
|
52
|
+
});
|
53
|
+
server.chat.bsky.convo.listConvos({
|
54
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
55
|
+
handler: ({ req, auth }) => {
|
56
|
+
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
57
|
+
},
|
58
|
+
});
|
59
|
+
server.chat.bsky.convo.muteConvo({
|
60
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
61
|
+
handler: ({ req, auth, input }) => {
|
62
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
63
|
+
},
|
64
|
+
});
|
65
|
+
server.chat.bsky.convo.sendMessage({
|
66
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
67
|
+
handler: ({ req, auth, input }) => {
|
68
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
69
|
+
},
|
70
|
+
});
|
71
|
+
server.chat.bsky.convo.sendMessageBatch({
|
72
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
73
|
+
handler: ({ req, auth, input }) => {
|
74
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
75
|
+
},
|
76
|
+
});
|
77
|
+
server.chat.bsky.convo.unmuteConvo({
|
78
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
79
|
+
handler: ({ req, auth, input }) => {
|
80
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
81
|
+
},
|
82
|
+
});
|
83
|
+
server.chat.bsky.convo.updateRead({
|
84
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
85
|
+
handler: ({ req, auth, input }) => {
|
86
|
+
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
87
|
+
},
|
88
|
+
});
|
89
|
+
}
|
90
|
+
exports.default = default_1;
|
91
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/chat/index.ts"],"names":[],"mappings":";;AAEA,mDAAqE;AAErE,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACnC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,oBAAoB;QAC3C,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;YAC/B,OAAO,IAAA,kCAAoB,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QAC7D,CAAC;KACF,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;QACvC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,oBAAoB;QAC3C,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;YACzB,OAAO,IAAA,yBAAW,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACpD,CAAC;KACF,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,oBAAoB;QAC3C,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAChC,OAAO,IAAA,kCAAoB,EAAC,GAAG,EAAE,GAAG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CAAC,CAAA;QACzE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AArFD,4BAqFC"}
|
package/dist/api/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAInC,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,UAKvD"}
|
package/dist/api/index.js
CHANGED
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const atproto_1 = __importDefault(require("./com/atproto"));
|
7
7
|
const bsky_1 = __importDefault(require("./app/bsky"));
|
8
|
+
const chat_1 = __importDefault(require("./chat"));
|
8
9
|
function default_1(server, ctx) {
|
9
10
|
(0, atproto_1.default)(server, ctx);
|
10
11
|
(0, bsky_1.default)(server, ctx);
|
12
|
+
(0, chat_1.default)(server, ctx);
|
11
13
|
return server;
|
12
14
|
}
|
13
15
|
exports.default = default_1;
|
package/dist/api/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;AACA,4DAAsC;AACtC,sDAAgC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;AACA,4DAAsC;AACtC,sDAAgC;AAChC,kDAAyB;AAGzB,mBAAyB,MAAc,EAAE,GAAe;IACtD,IAAA,iBAAU,EAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvB,IAAA,cAAO,EAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpB,IAAA,cAAI,EAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACjB,OAAO,MAAM,CAAA;AACf,CAAC;AALD,4BAKC"}
|
package/dist/pipethrough.d.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
3
|
import express from 'express';
|
4
|
+
import { LexValue } from '@atproto/lexicon';
|
4
5
|
import { CatchallHandler, HandlerPipeThrough } from '@atproto/xrpc-server';
|
5
6
|
import AppContext from './context';
|
6
7
|
export declare const proxyHandler: (ctx: AppContext) => CatchallHandler;
|
7
8
|
export declare const pipethrough: (ctx: AppContext, req: express.Request, requester: string | null, audOverride?: string) => Promise<HandlerPipeThrough>;
|
9
|
+
export declare const pipethroughProcedure: (ctx: AppContext, req: express.Request, requester: string | null, body?: LexValue) => Promise<HandlerPipeThrough>;
|
8
10
|
export declare const formatUrlAndAud: (ctx: AppContext, req: express.Request, audOverride?: string) => Promise<{
|
9
11
|
url: URL;
|
10
12
|
aud: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipethrough.d.ts","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"pipethrough.d.ts","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,QAAQ,EAA2B,MAAM,kBAAkB,CAAA;AACpE,OAAO,EACL,eAAe,EACf,kBAAkB,EAEnB,MAAM,sBAAsB,CAAA;AAK7B,OAAO,UAAU,MAAM,WAAW,CAAA;AAElC,eAAO,MAAM,YAAY,QACjB,UAAU,KAAG,eAclB,CAAA;AAEH,eAAO,MAAM,WAAW,QACjB,UAAU,OACV,eAAe,aACT,MAAM,GAAG,IAAI,gBACV,MAAM,KACnB,QAAQ,kBAAkB,CAM5B,CAAA;AAED,eAAO,MAAM,oBAAoB,QAC1B,UAAU,OACV,eAAe,aACT,MAAM,GAAG,IAAI,SACjB,QAAQ,KACd,QAAQ,kBAAkB,CAS5B,CAAA;AAYD,eAAO,MAAM,eAAe,QACrB,UAAU,OACV,eAAe,gBACN,MAAM,KACnB,QAAQ;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAanC,CAAA;AAED,eAAO,MAAM,aAAa,QACnB,UAAU,OACV,eAAe,OACf,MAAM,aACA,MAAM,GAAG,IAAI,KACvB,QAAQ;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAYpC,CAAA;AA6BD,eAAO,MAAM,gBAAgB,QACtB,UAAU,OACV,eAAe,KACnB,QAAQ;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAgBzD,CAAA;AAKD,eAAO,MAAM,WAAW,QACjB,GAAG,WACC,WAAW,KACnB,QAAQ,QAAQ,CAoBlB,CAAA;AAYD,eAAO,MAAM,YAAY,gBACV,QAAQ,UACb,gBAAgB,kBAwBzB,CAAA;AAED,eAAO,MAAM,aAAa,QAAe,QAAQ;;;;EAWhD,CAAA;AA8BD,eAAO,MAAM,QAAQ,YAAa,MAAM,OAAO,kBAAkB,KAAG,CAKnE,CAAA"}
|
package/dist/pipethrough.js
CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.parseRes = exports.parseProxyRes = exports.pipeProxyRes = exports.makeRequest = exports.parseProxyHeader = exports.formatHeaders = exports.formatUrlAndAud = exports.pipethrough = exports.proxyHandler = void 0;
|
29
|
+
exports.parseRes = exports.parseProxyRes = exports.pipeProxyRes = exports.makeRequest = exports.parseProxyHeader = exports.formatHeaders = exports.formatUrlAndAud = exports.pipethroughProcedure = exports.pipethrough = exports.proxyHandler = void 0;
|
30
30
|
const ui8 = __importStar(require("uint8arrays"));
|
31
31
|
const node_net_1 = __importDefault(require("node:net"));
|
32
32
|
const node_stream_1 = __importDefault(require("node:stream"));
|
@@ -60,6 +60,17 @@ const pipethrough = async (ctx, req, requester, audOverride) => {
|
|
60
60
|
return (0, exports.parseProxyRes)(res);
|
61
61
|
};
|
62
62
|
exports.pipethrough = pipethrough;
|
63
|
+
const pipethroughProcedure = async (ctx, req, requester, body) => {
|
64
|
+
const { url, aud } = await (0, exports.formatUrlAndAud)(ctx, req);
|
65
|
+
const headers = await (0, exports.formatHeaders)(ctx, req, aud, requester);
|
66
|
+
const encodedBody = body
|
67
|
+
? new TextEncoder().encode((0, lexicon_1.stringifyLex)(body))
|
68
|
+
: undefined;
|
69
|
+
const reqInit = formatReqInit(req, headers, encodedBody);
|
70
|
+
const res = await (0, exports.makeRequest)(url, reqInit);
|
71
|
+
return (0, exports.parseProxyRes)(res);
|
72
|
+
};
|
73
|
+
exports.pipethroughProcedure = pipethroughProcedure;
|
63
74
|
// Request setup/formatting
|
64
75
|
// -------------------
|
65
76
|
const REQ_HEADERS_TO_FORWARD = [
|
package/dist/pipethrough.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAClC,wDAA0B;AAC1B,8DAAgC;AAEhC,
|
1
|
+
{"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAClC,wDAA0B;AAC1B,8DAAgC;AAEhC,8CAAoE;AACpE,sDAI6B;AAC7B,wCAAuD;AACvD,iDAAkD;AAClD,qCAAq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Q,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAC/D,IAAI,kBAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9C,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,GAAW,EAAsB,EAAE;IACrD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAClD,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE;IAC9C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,OAAgB,EAA0B,EAAE;IACjE,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IACnB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/pds",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.24",
|
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.12",
|
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.12",
|
74
|
+
"@atproto/bsky": "^0.0.54",
|
75
75
|
"@atproto/lex-cli": "^0.4.0"
|
76
76
|
},
|
77
77
|
"scripts": {
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import AppContext from '../../context'
|
2
|
+
import { Server } from '../../lexicon'
|
3
|
+
import { pipethrough, pipethroughProcedure } from '../../pipethrough'
|
4
|
+
|
5
|
+
export default function (server: Server, ctx: AppContext) {
|
6
|
+
server.chat.bsky.actor.deleteAccount({
|
7
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
8
|
+
handler: async ({ req, auth }) => {
|
9
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did)
|
10
|
+
},
|
11
|
+
})
|
12
|
+
server.chat.bsky.actor.exportAccountData({
|
13
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
14
|
+
handler: ({ req, auth }) => {
|
15
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
16
|
+
},
|
17
|
+
})
|
18
|
+
server.chat.bsky.convo.deleteMessageForSelf({
|
19
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
20
|
+
handler: ({ req, auth, input }) => {
|
21
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
22
|
+
},
|
23
|
+
})
|
24
|
+
server.chat.bsky.convo.getConvo({
|
25
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
26
|
+
handler: ({ req, auth }) => {
|
27
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
28
|
+
},
|
29
|
+
})
|
30
|
+
server.chat.bsky.convo.getConvoForMembers({
|
31
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
32
|
+
handler: ({ req, auth }) => {
|
33
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
34
|
+
},
|
35
|
+
})
|
36
|
+
server.chat.bsky.convo.getLog({
|
37
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
38
|
+
handler: ({ req, auth }) => {
|
39
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
40
|
+
},
|
41
|
+
})
|
42
|
+
server.chat.bsky.convo.getMessages({
|
43
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
44
|
+
handler: ({ req, auth }) => {
|
45
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
46
|
+
},
|
47
|
+
})
|
48
|
+
server.chat.bsky.convo.leaveConvo({
|
49
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
50
|
+
handler: ({ req, auth, input }) => {
|
51
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
52
|
+
},
|
53
|
+
})
|
54
|
+
server.chat.bsky.convo.listConvos({
|
55
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
56
|
+
handler: ({ req, auth }) => {
|
57
|
+
return pipethrough(ctx, req, auth.credentials.did)
|
58
|
+
},
|
59
|
+
})
|
60
|
+
server.chat.bsky.convo.muteConvo({
|
61
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
62
|
+
handler: ({ req, auth, input }) => {
|
63
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
64
|
+
},
|
65
|
+
})
|
66
|
+
server.chat.bsky.convo.sendMessage({
|
67
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
68
|
+
handler: ({ req, auth, input }) => {
|
69
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
70
|
+
},
|
71
|
+
})
|
72
|
+
server.chat.bsky.convo.sendMessageBatch({
|
73
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
74
|
+
handler: ({ req, auth, input }) => {
|
75
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
76
|
+
},
|
77
|
+
})
|
78
|
+
server.chat.bsky.convo.unmuteConvo({
|
79
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
80
|
+
handler: ({ req, auth, input }) => {
|
81
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
82
|
+
},
|
83
|
+
})
|
84
|
+
server.chat.bsky.convo.updateRead({
|
85
|
+
auth: ctx.authVerifier.accessNotAppPassword,
|
86
|
+
handler: ({ req, auth, input }) => {
|
87
|
+
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
88
|
+
},
|
89
|
+
})
|
90
|
+
}
|
package/src/api/index.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import { Server } from '../lexicon'
|
2
2
|
import comAtproto from './com/atproto'
|
3
3
|
import appBsky from './app/bsky'
|
4
|
+
import chat from './chat'
|
4
5
|
import AppContext from '../context'
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
comAtproto(server, ctx)
|
8
9
|
appBsky(server, ctx)
|
10
|
+
chat(server, ctx)
|
9
11
|
return server
|
10
12
|
}
|
package/src/pipethrough.ts
CHANGED
@@ -3,7 +3,7 @@ import * as ui8 from 'uint8arrays'
|
|
3
3
|
import net from 'node:net'
|
4
4
|
import stream from 'node:stream'
|
5
5
|
import webStream from 'node:stream/web'
|
6
|
-
import { jsonToLex } from '@atproto/lexicon'
|
6
|
+
import { LexValue, jsonToLex, stringifyLex } from '@atproto/lexicon'
|
7
7
|
import {
|
8
8
|
CatchallHandler,
|
9
9
|
HandlerPipeThrough,
|
@@ -45,6 +45,22 @@ export const pipethrough = async (
|
|
45
45
|
return parseProxyRes(res)
|
46
46
|
}
|
47
47
|
|
48
|
+
export const pipethroughProcedure = async (
|
49
|
+
ctx: AppContext,
|
50
|
+
req: express.Request,
|
51
|
+
requester: string | null,
|
52
|
+
body?: LexValue,
|
53
|
+
): Promise<HandlerPipeThrough> => {
|
54
|
+
const { url, aud } = await formatUrlAndAud(ctx, req)
|
55
|
+
const headers = await formatHeaders(ctx, req, aud, requester)
|
56
|
+
const encodedBody = body
|
57
|
+
? new TextEncoder().encode(stringifyLex(body))
|
58
|
+
: undefined
|
59
|
+
const reqInit = formatReqInit(req, headers, encodedBody)
|
60
|
+
const res = await makeRequest(url, reqInit)
|
61
|
+
return parseProxyRes(res)
|
62
|
+
}
|
63
|
+
|
48
64
|
// Request setup/formatting
|
49
65
|
// -------------------
|
50
66
|
|