@joystick.js/node-canary 0.0.0-canary.341 → 0.0.0-canary.343
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,11 +14,6 @@ var sessions_default = {
|
|
|
14
14
|
return process.databases._sessions?.collection("sessions").findOne({
|
|
15
15
|
_id: input?.session_id
|
|
16
16
|
});
|
|
17
|
-
},
|
|
18
|
-
delete_expired_sessions: async () => {
|
|
19
|
-
return process.databases._sessions?.collection("sessions").deleteMany({
|
|
20
|
-
createdAt: { $lte: dayjs().subtract(1, "hour").format() }
|
|
21
|
-
});
|
|
22
17
|
}
|
|
23
18
|
};
|
|
24
19
|
export {
|
|
@@ -27,15 +27,6 @@ var sessions_default = {
|
|
|
27
27
|
input?.session_id
|
|
28
28
|
]);
|
|
29
29
|
return session;
|
|
30
|
-
},
|
|
31
|
-
delete_expired_sessions: async () => {
|
|
32
|
-
const date = new Date();
|
|
33
|
-
date.setHours(date.getHours() - 1);
|
|
34
|
-
return process.databases.postgresql.query(`
|
|
35
|
-
DELETE FROM sessions WHERE created_at::timestamp < $1
|
|
36
|
-
`, [
|
|
37
|
-
date.toISOString()
|
|
38
|
-
]);
|
|
39
30
|
}
|
|
40
31
|
};
|
|
41
32
|
export {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import setCookie from "../../lib/setCookie.js";
|
|
2
2
|
import runSessionQuery from "../runSessionQuery.js";
|
|
3
3
|
var session_default = async (req, res, next) => {
|
|
4
|
-
await runSessionQuery("delete_expired_sessions");
|
|
5
4
|
let session_id = req?.cookies?.joystickSession;
|
|
6
5
|
const existing_session = session_id ? await runSessionQuery("get_session", {
|
|
7
6
|
session_id
|