Skip to content

Commit

Permalink
move wsRegex constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ksentak committed Aug 9, 2023
1 parent fbe3b0b commit 2c9666f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/sessionManagement.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import fs from 'fs';
import yaml from 'js-yaml';
import WebSocket from 'ws';

const wsRegex = /^(ws(s)?):\/\//i;

class SessionHandler {
constructor() {
this.mode = null;
Expand All @@ -34,7 +36,6 @@ class SessionHandler {

// Determine mode based on directory/url
_determineMode(dir) {
const wsRegex = /^(ws(s)?):\/\//i;
if (wsRegex.test(dir)) {
this.mode = 'websocket';
} else {
Expand Down Expand Up @@ -117,7 +118,6 @@ class Session {
// logger.info(`${sessionStart.toISOString()}`);

// Check if the output path is a WebSocket URL
const wsRegex = /^(ws(s)?):\/\//i;
this.sessionOutputPath = wsRegex.test(this.sessionOutputPath) ? "./sessions/output" : this.sessionOutputPath;

if (!fs.existsSync(this.sessionOutputPath)) {
Expand Down

0 comments on commit 2c9666f

Please sign in to comment.