chore: updated dependencies of server

This commit is contained in:
Davide Passoni 2024-12-12 13:27:35 +01:00
parent d7edb00254
commit 6250f760a9
4 changed files with 29 additions and 19 deletions

View File

@ -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"
}
}

View File

@ -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"));
});
}

View File

@ -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) => {

View File

@ -3,8 +3,9 @@
"outDir": "./build",
"allowJs": true,
"target": "ES2023",
"module": "Node16",
"moduleResolution": "Node16"
"module": "NodeNext",
"moduleResolution": "nodenext",
"skipLibCheck": true
},
"include": [
"./src/**/*"