Added basic auth
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module.exports = {
|
||||
name: "CRTelemetry",
|
||||
port: 80,
|
||||
username: "admin",
|
||||
password: "password",
|
||||
logger: {
|
||||
level: "info",
|
||||
error_path: "/app/logs/error.log",
|
||||
|
||||
@@ -49,9 +49,7 @@ setEventListeners(download, () => {
|
||||
});
|
||||
|
||||
setEventListeners(logout, () => {
|
||||
// fetch logout
|
||||
// check response type
|
||||
// redirect to auth
|
||||
window.location.href = `${window.location.protocol}//log:out@${window.location.host}`;
|
||||
});
|
||||
|
||||
for (let i = 1; i < sql_rows.length; i++) {
|
||||
|
||||
Generated
+28
@@ -8,6 +8,7 @@
|
||||
"better-sqlite3": "^11.10.0",
|
||||
"ejs": "^3.1.10",
|
||||
"express": "^5.1.0",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
"express-fileupload": "^1.5.1",
|
||||
"winston": "^3.17.0"
|
||||
}
|
||||
@@ -116,6 +117,24 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/basic-auth": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/basic-auth/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/better-sqlite3": {
|
||||
"version": "11.10.0",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.10.0.tgz",
|
||||
@@ -576,6 +595,15 @@
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/express-basic-auth": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/express-basic-auth/-/express-basic-auth-1.2.1.tgz",
|
||||
"integrity": "sha512-L6YQ1wQ/mNjVLAmK3AG1RK6VkokA1BIY6wmiH304Xtt/cLTps40EusZsU1Uop+v9lTDPxdtzbFmdXfFO3KEnwA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"basic-auth": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/express-fileupload": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-1.5.1.tgz",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"better-sqlite3": "^11.10.0",
|
||||
"ejs": "^3.1.10",
|
||||
"express": "^5.1.0",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
"express-fileupload": "^1.5.1",
|
||||
"winston": "^3.17.0"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ const Database = require("better-sqlite3");
|
||||
const winston = require("winston");
|
||||
const path = require("path");
|
||||
const fileUpload = require("express-fileupload");
|
||||
const basicAuth = require("express-basic-auth");
|
||||
const fs = require("fs");
|
||||
const app_conf = require("./app/config/app.conf.js");
|
||||
const db_conf = require("./app/config/db.conf.js");
|
||||
@@ -19,10 +20,15 @@ app.use(app_conf.web_paths.js, express.static(path.join(__dirname, app_conf.web_
|
||||
app.use(express.json());
|
||||
app.use(fileUpload({
|
||||
limits: { fileSize: 102400 },
|
||||
|
||||
useTempFiles: true,
|
||||
tempFileDir: path.join(__dirname, app_conf.temp_directory)
|
||||
}));
|
||||
app.use(basicAuth({
|
||||
users: {
|
||||
[app_conf.username]: app_conf.password
|
||||
},
|
||||
challenge: true
|
||||
}));
|
||||
|
||||
/*
|
||||
* Initialize console and file logger
|
||||
|
||||
Reference in New Issue
Block a user