aboutsummaryrefslogtreecommitdiffstats
path: root/backend/dist/config/session-store.js
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-11-04 23:59:44 +0000
committerLeonardo Bishop <me@leonardobishop.com>2023-11-04 23:59:44 +0000
commitc6c93acc32893d891adb39011674c02f3f04999e (patch)
treec58a17d789301cbc59bef1e0e3730dd9dc9aae98 /backend/dist/config/session-store.js
parent9125c0bc964e499b40ddfa3e87d0b474dc63f5db (diff)
gitignore some shit
Diffstat (limited to 'backend/dist/config/session-store.js')
-rw-r--r--backend/dist/config/session-store.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/backend/dist/config/session-store.js b/backend/dist/config/session-store.js
deleted file mode 100644
index e40e6f6..0000000
--- a/backend/dist/config/session-store.js
+++ /dev/null
@@ -1,59 +0,0 @@
-const sessions = {};
-function makeid(length) {
- let result = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- let counter = 0;
- while (counter < length) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- counter += 1;
- }
- return result;
-}
-export const createNewSession = () => {
- const id = makeid(10);
- const session = {
- id,
- state: "waiting",
- host: undefined,
- clients: [],
- };
- sessions[id] = session;
- return session;
-};
-export const setSessionState = (id, state) => {
- if (!sessions[id]) {
- return;
- }
- sessions[id].state = state;
-};
-export const setSessionHost = (id, clientId) => {
- if (!sessions[id]) {
- return;
- }
- sessions[id].host = clientId;
-};
-export const addSessionClient = (id, clientId) => {
- var _a;
- if (!sessions[id]) {
- return;
- }
- (_a = sessions[id]) === null || _a === void 0 ? void 0 : _a.clients.push(clientId);
-};
-export const cleanupSession = (id) => {
- if (!sessions[id]) {
- return;
- }
- // if (sessions[id].host) {
- // sessions[id].host!.close();
- // }
- //
- // sessions[id].clients.forEach((client) => {
- // client.close();
- // });
- delete sessions[id];
-};
-export const getSession = (id) => {
- return sessions[id];
-};
-//# sourceMappingURL=session-store.js.map \ No newline at end of file