mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
chore: updated dependencies of server
This commit is contained in:
@@ -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"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user