|
|
@ -1,4 +1,4 @@ |
|
|
|
import session, { |
|
|
|
import expressSession, { |
|
|
|
SessionData, |
|
|
|
SessionData, |
|
|
|
Store as BaseSessionStore, |
|
|
|
Store as BaseSessionStore, |
|
|
|
} from 'express-session'; |
|
|
|
} from 'express-session'; |
|
|
@ -13,7 +13,7 @@ import { getSessionSecret } from './lib/getSessionSecret'; |
|
|
|
import { isObject } from './lib/isObject'; |
|
|
|
import { isObject } from './lib/isObject'; |
|
|
|
import { stderr, stdout, stdoutVar, uuidgen } from './lib/shell'; |
|
|
|
import { stderr, stdout, stdoutVar, uuidgen } from './lib/shell'; |
|
|
|
|
|
|
|
|
|
|
|
const DEFAULT_COOKIE_ORIGINAL_MAX_AGE = 1000 * 60 * 60; |
|
|
|
const DEFAULT_COOKIE_ORIGINAL_MAX_AGE = 3600000; |
|
|
|
|
|
|
|
|
|
|
|
const getWriteCode = (obj: object) => { |
|
|
|
const getWriteCode = (obj: object) => { |
|
|
|
let result: number | undefined; |
|
|
|
let result: number | undefined; |
|
|
@ -218,7 +218,7 @@ export class SessionStore extends BaseSessionStore { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const sessionHandler = session({ |
|
|
|
const session = expressSession({ |
|
|
|
cookie: { maxAge: DEFAULT_COOKIE_ORIGINAL_MAX_AGE }, |
|
|
|
cookie: { maxAge: DEFAULT_COOKIE_ORIGINAL_MAX_AGE }, |
|
|
|
genid: ({ path }) => { |
|
|
|
genid: ({ path }) => { |
|
|
|
const sid = uuidgen('--random').trim(); |
|
|
|
const sid = uuidgen('--random').trim(); |
|
|
@ -233,4 +233,4 @@ const sessionHandler = session({ |
|
|
|
store: new SessionStore(), |
|
|
|
store: new SessionStore(), |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
export default sessionHandler; |
|
|
|
export default session; |
|
|
|