diff --git a/app.js b/app.js index 9b85dd0..9d35a74 100644 --- a/app.js +++ b/app.js @@ -109,7 +109,7 @@ app.use((request, response, next) => { response.locals.urlPrefix = getConfigProperty('reverseProxy.urlPrefix'); next(); }); -app.get(urlPrefix + '/', sessionChecker, (_request, response) => { +app.get(`${urlPrefix}/`, sessionChecker, (_request, response) => { response.redirect(`${urlPrefix}/dashboard`); }); app.use(`${urlPrefix}/dashboard`, sessionChecker, routerDashboard); @@ -127,15 +127,15 @@ app.get(`${urlPrefix}/logout`, (request, response) => { Object.hasOwn(request.cookies, sessionCookieName)) { request.session.destroy(() => { response.clearCookie(sessionCookieName); - response.redirect(urlPrefix + '/'); + response.redirect(`${urlPrefix}/`); }); } else { - response.redirect(urlPrefix + '/login'); + response.redirect(`${urlPrefix}/login`); } }); app.use((request, _response, next) => { debug(request.url); - next(createError(404, 'File not found: ' + request.url)); + next(createError(404, `File not found: ${request.url}`)); }); export default app; diff --git a/app.ts b/app.ts index 26df7ea..61623d0 100644 --- a/app.ts +++ b/app.ts @@ -223,7 +223,7 @@ app.use((request, response, next) => { next() }) -app.get(urlPrefix + '/', sessionChecker, (_request, response) => { +app.get(`${urlPrefix}/`, sessionChecker, (_request, response) => { response.redirect(`${urlPrefix}/dashboard`) }) @@ -247,17 +247,17 @@ app.get(`${urlPrefix}/logout`, (request, response) => { ) { request.session.destroy(() => { response.clearCookie(sessionCookieName) - response.redirect(urlPrefix + '/') + response.redirect(`${urlPrefix}/`) }) } else { - response.redirect(urlPrefix + '/login') + response.redirect(`${urlPrefix}/login`) } }) // Catch 404 and forward to error handler app.use((request, _response, next) => { debug(request.url) - next(createError(404, 'File not found: ' + request.url)) + next(createError(404, `File not found: ${request.url}`)) }) export default app diff --git a/handlers/permissions.js b/handlers/permissions.js index 8ae033d..023f99b 100644 --- a/handlers/permissions.js +++ b/handlers/permissions.js @@ -11,7 +11,7 @@ export const adminGetHandler = (request, response, next) => { next(); return; } - response.redirect(urlPrefix + '/dashboard'); + response.redirect(`${urlPrefix}/dashboard`); }; export const adminPostHandler = (request, response, next) => { if (request.session.user?.isAdmin ?? false) { @@ -25,7 +25,7 @@ export const updateGetHandler = (request, response, next) => { next(); return; } - response.redirect(urlPrefix + '/dashboard'); + response.redirect(`${urlPrefix}/dashboard`); }; export const updatePostHandler = (request, response, next) => { if (request.session.user?.canUpdate ?? false) { diff --git a/handlers/permissions.ts b/handlers/permissions.ts index 4cc9e69..14d1c7d 100644 --- a/handlers/permissions.ts +++ b/handlers/permissions.ts @@ -17,7 +17,7 @@ export const adminGetHandler: RequestHandler = (request, response, next) => { return } - response.redirect(urlPrefix + '/dashboard') + response.redirect(`${urlPrefix}/dashboard`) } export const adminPostHandler: RequestHandler = (request, response, next) => { @@ -35,7 +35,7 @@ export const updateGetHandler: RequestHandler = (request, response, next) => { return } - response.redirect(urlPrefix + '/dashboard') + response.redirect(`${urlPrefix}/dashboard`) } export const updatePostHandler: RequestHandler = (request, response, next) => { diff --git a/helpers/functions.authentication.js b/helpers/functions.authentication.js index 168534c..d8343cc 100644 --- a/helpers/functions.authentication.js +++ b/helpers/functions.authentication.js @@ -10,7 +10,7 @@ async function authenticateViaActiveDirectory(userName, password) { return await new Promise((resolve) => { try { const ad = new ActiveDirectory(activeDirectoryConfig); - ad.authenticate(userDomain + '\\' + userName, password, (error, auth) => { + ad.authenticate(`${userDomain}\\${userName}`, password, (error, auth) => { let authenticated = false; if ((error ?? '') === '') { authenticated = auth; @@ -25,7 +25,7 @@ async function authenticateViaActiveDirectory(userName, password) { } const adWebAuthConfig = getConfigProperty('adWebAuthConfig'); async function authenticateViaADWebAuth(userName, password) { - return await adWebAuth.authenticate(userDomain + '\\' + userName, password, adWebAuthConfig); + return await adWebAuth.authenticate(`${userDomain}\\${userName}`, password, adWebAuthConfig); } const authenticateFunction = activeDirectoryConfig === undefined ? authenticateViaADWebAuth @@ -48,5 +48,5 @@ export function getSafeRedirectURL(possibleRedirectURL = '') { return urlPrefix + urlToCheck; } } - return urlPrefix + '/dashboard/'; + return `${urlPrefix}/dashboard/`; } diff --git a/helpers/functions.authentication.ts b/helpers/functions.authentication.ts index 3649e09..4cef3d2 100644 --- a/helpers/functions.authentication.ts +++ b/helpers/functions.authentication.ts @@ -19,7 +19,7 @@ async function authenticateViaActiveDirectory( try { const ad = new ActiveDirectory(activeDirectoryConfig) - ad.authenticate(userDomain + '\\' + userName, password, (error, auth) => { + ad.authenticate(`${userDomain}\\${userName}`, password, (error, auth) => { let authenticated = false if ((error ?? '') === '') { @@ -41,7 +41,7 @@ async function authenticateViaADWebAuth( password: string ): Promise { return await adWebAuth.authenticate( - userDomain + '\\' + userName, + `${userDomain}\\${userName}`, password, adWebAuthConfig ) @@ -80,5 +80,5 @@ export function getSafeRedirectURL(possibleRedirectURL = ''): string { } } - return urlPrefix + '/dashboard/' + return `${urlPrefix}/dashboard/` } diff --git a/tasks/uploadedFilesProcessor.js b/tasks/uploadedFilesProcessor.js index a48ce7c..a12d00a 100644 --- a/tasks/uploadedFilesProcessor.js +++ b/tasks/uploadedFilesProcessor.js @@ -29,9 +29,7 @@ async function processUploadedFiles() { processAgainOnComplete = false; const fileNames = await fs.readdir(uploadsFolder); const rightNow = new Date(); - const systemFolderPath = path.join(importedFolderRoot, rightNow.getFullYear().toString() + - '-' + - (rightNow.getMonth() + 1).toString()); + const systemFolderPath = path.join(importedFolderRoot, `${rightNow.getFullYear().toString()}-${(rightNow.getMonth() + 1).toString()}`); try { await fs.mkdir(systemFolderPath); } diff --git a/tasks/uploadedFilesProcessor.ts b/tasks/uploadedFilesProcessor.ts index b69e130..9d20768 100644 --- a/tasks/uploadedFilesProcessor.ts +++ b/tasks/uploadedFilesProcessor.ts @@ -66,9 +66,7 @@ async function processUploadedFiles(): Promise { const systemFolderPath = path.join( importedFolderRoot, - rightNow.getFullYear().toString() + - '-' + - (rightNow.getMonth() + 1).toString() + `${rightNow.getFullYear().toString()}-${(rightNow.getMonth() + 1).toString()}` ) try {