Skip to content

Commit 3cae24f

Browse files
authored
Npm workspace (#437)
* feat: add workspaces for client and service, update scripts for workspace usage chore: bump service version to 1.8.0 and update dependencies in package-lock.json * fix: enhance messaging API to handle AES key registration and add audio notifications
1 parent 02126bb commit 3cae24f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

backend/api/messaging/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ router.post(
6666
if (!valid) {
6767
return res.sendStatus(404);
6868
}
69-
const existing = await db.findOneFromDB({ channel, user: sender }, PUBLIC_KEY_COLLECTION);
69+
const existing = await db.findOneFromDB<{ aesKey: string | null }>({ channel, user: sender }, PUBLIC_KEY_COLLECTION);
7070
if (existing) {
71-
return res.status(409).send({ error: "Key already registered for this session" });
71+
if (existing.aesKey) {
72+
return res.status(409).send({ error: "Key already registered for this session" });
73+
}
74+
// First call registered publicKey with aesKey: null; this call adds the encrypted AES key
75+
await db.updateOneFromDb({ channel, user: sender }, { aesKey }, PUBLIC_KEY_COLLECTION);
76+
return res.send({ status: "ok" });
7277
}
7378
await db.insertInDb({ aesKey, publicKey, user: sender, channel }, PUBLIC_KEY_COLLECTION);
7479
return res.send({ status: "ok" });

service/build.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ async function build() {
1818
minify: isProduction,
1919
logLevel: 'info',
2020
metafile: true,
21-
define: {
22-
'process.env.CHATE2EE_API_URL': JSON.stringify(process.env.CHATE2EE_API_URL) || 'undefined',
23-
},
2421
};
2522

2623
if (watch) {

0 commit comments

Comments
 (0)