<commit_before>// ABOUT
// Runs the SyncLounge Server software - handles rooms
// Defaults to 8089

// V2.0

// USER CONFIG

// END USER CONFIG
var express = require('express')
var cors = require('cors')

let SettingsHelper = require('./SettingsHelper')
let settings = new SettingsHelper()

var root = express()
root.use(cors({ credentials: false }))
root.use((req, res, next) => {
  res.setHeader('Access-Control-Allow-Credentials', false)
  next()
})
var ptserver = express()

var PORT = process.env.server_port || 8089

// Setup our PTServer

ptserver.get('/health', (req, res) => {
  res.setHeader('Content-Type', 'application/json')
  let connectedUsers = Object.keys(ptserver_io.sockets.connected).length
  let load = 'low'
  if (connectedUsers > 25) {
    load = 'medium'
  }
  if (connectedUsers > 50) {
    load = 'high'
  }
  return res.send(JSON.stringify({ load })).end()
})
ptserver.get('/', (req, res) => {
  return res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.')
})
// Merge everything together

let serverRoot = settings.serverRoot || '/'
console.log('Setting up with serverRoot of', serverRoot)
root.use(serverRoot, ptserver)
root.get('*', function (req, res) {
  return res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.')
})

var rootserver = require('http').createServer(root)
var ptserver_io = require('socket.io')(rootserver, { path: serverRoot + 'socket.io' })

ptserver_io.on('connection', (socket) => {
  console.log('Someone connected to the ptserver socket')

  socket.on('join', function (data) {
    // A user is attempting to join a room
    if (data == null) {
      return
    }
    if (!data || !data.username || !data.room) {
      console.log('Invalid join attempt', data)
      return socket.emit('join-result', false, {}, 'Invalid data', [])<commit_msg>serverRoot fixes<commit_after>// ABOUT
// Runs the SyncLounge Server software - handles rooms
// Defaults to 8089

// V2.0

// USER CONFIG

// END USER CONFIG
var express = require('express')
var cors = require('cors')

let SettingsHelper = require('./SettingsHelper')
let settings = new SettingsHelper()

var root = express()
root.use(cors({ credentials: false }))
root.use((req, res, next) => {
  res.setHeader('Access-Control-Allow-Credentials', false)
  next()
})
var ptserver = express()

var PORT = process.env.server_port || 8089

// Setup our PTServer

ptserver.get('/health', (req, res) => {
  res.setHeader('Content-Type', 'application/json')
  let connectedUsers = Object.keys(ptserver_io.sockets.connected).length
  let load = 'low'
  if (connectedUsers > 25) {
    load = 'medium'
  }
  if (connectedUsers > 50) {
    load = 'high'
  }
  return res.send(JSON.stringify({ load })).end()
})
ptserver.get('/', (req, res) => {
  return res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.')
})
// Merge everything together

let serverRoot = settings.serverRoot || ''
console.log('Setting up with serverRoot of', serverRoot)
root.use(serverRoot, ptserver)
root.get('*', function (req, res) {
  return res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.')
})

var rootserver = require('http').createServer(root)
var ptserver_io = require('socket.io')(rootserver, { path: serverRoot + 'socket.io' })

ptserver_io.on('connection', (socket) => {
  console.log('Someone connected to the ptserver socket')

  socket.on('join', function (data) {
    // A user is attempting to join a room
    if (data == null) {
      return
    }
    if (!data || !data.username || !data.room) {
      console.log('Invalid join attempt', data)
      return socket.emit('join-result', false, {}, 'Invalid data', [])
{'fraction_non_alphanumeric': 0.15889603429796356, 'fraction_numerical': 0.007502679528403001, 'mean_word_length': 3.970705725699068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1907378', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1181, 'n_words': 337}