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