From 6250f760a97c1e281407d1d59c10632cb7d2451f Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Thu, 12 Dec 2024 13:27:35 +0100 Subject: [PATCH] chore: updated dependencies of server --- frontend/server/package.json | 30 ++++++++++++++---------- frontend/server/src/app.ts | 5 +++- frontend/server/src/routes/api/speech.ts | 8 ++++--- frontend/server/tsconfig.json | 5 ++-- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/frontend/server/package.json b/frontend/server/package.json index 49cf8b1b..7265c31f 100644 --- a/frontend/server/package.json +++ b/frontend/server/package.json @@ -13,29 +13,33 @@ "@google-cloud/speech": "^6.7.0", "appjs": "^0.0.20", "appjs-win32": "^0.0.19", - "body-parser": "^1.20.2", + "body-parser": "^1.20.3", "cors": "^2.8.5", - "debug": "~2.6.9", - "ejs": "^3.1.8", - "electron": "^28.0.0", - "express": "^4.18.2", + "debug": "~4.4.0", + "ejs": "^3.1.10", + "electron": "^33.2.1", + "express": "^4.21.2", "express-basic-auth": "^1.2.1", - "http-proxy-middleware": "^2.0.6", - "morgan": "~1.9.1", - "node-gtts": "^2.0.2", - "open": "^10.0.0", - "regedit": "^5.1.2", + "http-proxy-middleware": "^3.0.3", + "morgan": "~1.10.0", + "node-fetch": "^3.3.2", + "open": "^10.1.0", + "regedit": "^5.1.3", "save": "^2.9.0", "sha256": "^0.2.0", "srtm-elevation": "^2.1.2", - "tcp-ping-port": "^1.0.1", - "uuid": "^9.0.1", + "tcp-ping-port": "^1.0.2", + "uuid": "^11.0.3", + "whatwg-url": "^14.1.0", "ws": "^8.18.0", "yargs": "^17.7.2" }, "devDependencies": { "ts-node": "^10.9.2", - "typescript": "^5.5.3", + "typescript": "^5.7.2", "vite": "^6.0.3" + }, + "overrides": { + "node-fetch": "^3.3.2" } } diff --git a/frontend/server/src/app.ts b/frontend/server/src/app.ts index 8dd8c3d6..1e05f4f1 100644 --- a/frontend/server/src/app.ts +++ b/frontend/server/src/app.ts @@ -160,6 +160,7 @@ module.exports = function (configLocation, viteProxy) { app.use("/olympus", async (req, res, next) => { /* Check if custom authorization headers are being used */ const user = + //@ts-ignore req.auth?.user ?? checkCustomHeaders(config, usersConfig, groupsConfig, req); @@ -174,9 +175,11 @@ module.exports = function (configLocation, viteProxy) { /* Check that the user is authorized to that role */ if (userConfig.roles.includes(req.headers["x-command-mode"])) { /* Check that the role is valid */ + //@ts-ignore if (req.headers["x-command-mode"] in defaultUsers) { /* Apply the authorization headers */ req.headers.authorization = `Basic ${btoa( + //@ts-ignore user + ":" + defaultUsers[req.headers["x-command-mode"]] )}`; } else { @@ -246,7 +249,7 @@ module.exports = function (configLocation, viteProxy) { ); } else { app.get("/", function (req, res) { - res.sendfile(path.join(__dirname, "..", "public", "index.html")); + res.sendFile(path.join(__dirname, "..", "public", "index.html")); }); } diff --git a/frontend/server/src/routes/api/speech.ts b/frontend/server/src/routes/api/speech.ts index 0b512bc4..bb3027e2 100644 --- a/frontend/server/src/routes/api/speech.ts +++ b/frontend/server/src/routes/api/speech.ts @@ -1,12 +1,14 @@ import express = require("express"); -const gtts = require("node-gtts")("en"); +//const gtts = require("node-gtts")("en"); const speech = require("@google-cloud/speech"); const router = express.Router(); module.exports = function () { router.put("/generate", (req, res, next) => { - res.set({ "Content-Type": "audio/mpeg" }); - gtts.stream(req.body.text).pipe(res); + //res.set({ "Content-Type": "audio/mpeg" }); + // TODO + //gtts.stream(req.body.text).pipe(res); + res.sendStatus(404); }); router.put("/recognize", (req, res, next) => { diff --git a/frontend/server/tsconfig.json b/frontend/server/tsconfig.json index e5a37c12..6d39d54a 100644 --- a/frontend/server/tsconfig.json +++ b/frontend/server/tsconfig.json @@ -3,8 +3,9 @@ "outDir": "./build", "allowJs": true, "target": "ES2023", - "module": "Node16", - "moduleResolution": "Node16" + "module": "NodeNext", + "moduleResolution": "nodenext", + "skipLibCheck": true }, "include": [ "./src/**/*"