diff --git a/api/src/controllers/internal/Session.ts b/api/src/controllers/internal/Session.ts index 3573658..3000c07 100644 --- a/api/src/controllers/internal/Session.ts +++ b/api/src/controllers/internal/Session.ts @@ -189,33 +189,37 @@ ${autoExecContent}` } private scheduleSessionDestroy(session: Session) { - setTimeout(async () => { - if (session.inUse) { - // adding 10 more minutes - const newDeathTimeStamp = - parseInt(session.deathTimeStamp) + 10 * 60 * 1000 - session.deathTimeStamp = newDeathTimeStamp.toString() - - this.scheduleSessionDestroy(session) - } else { - const { expiresAfterMins } = session - - // delay session destroy if expiresAfterMins present - if (expiresAfterMins && !expiresAfterMins.used) { - // calculate session death time using expiresAfterMins + setTimeout( + async () => { + if (session.inUse) { + // adding 10 more minutes const newDeathTimeStamp = - parseInt(session.deathTimeStamp) + expiresAfterMins.mins * 60 * 1000 + parseInt(session.deathTimeStamp) + 10 * 60 * 1000 session.deathTimeStamp = newDeathTimeStamp.toString() - // set expiresAfterMins to true to avoid using it again - session.expiresAfterMins!.used = true - this.scheduleSessionDestroy(session) } else { - await this.deleteSession(session) + const { expiresAfterMins } = session + + // delay session destroy if expiresAfterMins present + if (expiresAfterMins && !expiresAfterMins.used) { + // calculate session death time using expiresAfterMins + const newDeathTimeStamp = + parseInt(session.deathTimeStamp) + + expiresAfterMins.mins * 60 * 1000 + session.deathTimeStamp = newDeathTimeStamp.toString() + + // set expiresAfterMins to true to avoid using it again + session.expiresAfterMins!.used = true + + this.scheduleSessionDestroy(session) + } else { + await this.deleteSession(session) + } } - } - }, parseInt(session.deathTimeStamp) - new Date().getTime() - 100) + }, + parseInt(session.deathTimeStamp) - new Date().getTime() - 100 + ) } } diff --git a/api/src/controllers/user.ts b/api/src/controllers/user.ts index 424df90..d8790d9 100644 --- a/api/src/controllers/user.ts +++ b/api/src/controllers/user.ts @@ -285,7 +285,7 @@ const getUser = async ( username: user.username, isActive: user.isActive, isAdmin: user.isAdmin, - autoExec: getAutoExec ? user.autoExec ?? '' : undefined, + autoExec: getAutoExec ? (user.autoExec ?? '') : undefined, groups: user.groups } } diff --git a/api/src/utils/upload.ts b/api/src/utils/upload.ts index d4a4119..f85cf57 100644 --- a/api/src/utils/upload.ts +++ b/api/src/utils/upload.ts @@ -51,9 +51,8 @@ export const generateFileUploadSasCode = async ( let fileCount = 0 const uploadedFiles: UploadedFiles[] = [] - const sasSessionFolderList: string[] = await listFilesInFolder( - sasSessionFolder - ) + const sasSessionFolderList: string[] = + await listFilesInFolder(sasSessionFolder) sasSessionFolderList.forEach((fileName) => { let fileCountString = fileCount < 100 ? '0' + fileCount : fileCount fileCountString = fileCount < 10 ? '00' + fileCount : fileCount