Skip to content

Commit 9dba3c7

Browse files
committed
Add fake update feature
1 parent ac3d1b3 commit 9dba3c7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ release date when you use `npm version` (see `README.md`).
1111

1212
- Add a timestamp to messages.
1313

14+
- Add a `fake-update` endpoint to the backend. This can be used to send fake
15+
delta-chat client generated updates. There is no UI yet.
16+
1417
## [0.15.1][] - 2022-07-04
1518

1619
### Fixed

backend/app.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,22 @@ export function createFrontend(
6969
color: instance.color,
7070
});
7171
});
72-
app.post<{}, {}>("/clear", (req, res) => {
72+
app.post<{}, { status: string }>("/clear", (req, res) => {
7373
instances.clear();
7474
res.json({
7575
status: "ok",
7676
});
7777
});
7878

79+
app.post<any, { status: string }>("/fake-update", (req, res) => {
80+
const instanceId = Array.from(instances.instances.keys())[0];
81+
const instance = instances.instances.get(instanceId);
82+
instance?.webXdc.sendUpdate({ payload: req.body }, "fake update");
83+
res.json({
84+
status: "ok",
85+
});
86+
});
87+
7988
app.ws("/webxdc-message", (ws, req) => {
8089
instances.onMessage((message) => {
8190
ws.send(JSON.stringify(message));

0 commit comments

Comments
 (0)