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B","file":"/npm/blockhub-node-operator@1.4.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/blockhub-node-operator@1.4.0/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var express = require('express')\nvar proto = require('./server')\nvar util = require('./util')\nvar http = require('http')\nvar https = require('https')\n\nfunction ExpressServer(server, options) {\n  var app = express()\n\n  util.extend(app, proto)\n\n  options = app._options = util.extend({}, {\n    debug: false,\n    timeout: 5000,\n    key: 'nodeOperator',\n    ip_limit: 5000,\n    concurrent_limit: 5000,\n    allow_discovery: true,\n    proxied: false\n  }, options)\n\n  // Connected clients\n  app._clients = {}\n\n  // Messages waiting for another peer.\n  app._outstanding = {}\n\n  // Mark concurrent users per ip\n  app._ips = {}\n\n  if (options.proxied) {\n    app.set('trust proxy', options.proxied)\n  }\n\n  app.on('mount', function() {\n    if (!server) {\n      throw new Error('Server is not passed to constructor - '+\n        'can\\'t start BlockHubServer')\n    }\n\n    // Initialize HTTP routes. This is only used for the first few milliseconds\n    // before a socket is opened for a Peer.\n    app._initializeHTTP()\n    app._setCleanupIntervals()\n    app._initializeWSS(server)\n  })\n\n  return app\n}\n\nfunction BlockHubServer(options, callback) {\n  var app = express()\n\n  options = options || {}\n  var path = options.path || '/'\n  var port = options.port || 80\n\n  delete options.path\n\n  if (path[0] !== '/') {\n    path = '/' + path\n  }\n\n  if (path[path.length - 1] !== '/') {\n    path += '/'\n  }\n\n  var server\n  if (options.ssl) {\n    if (options.ssl.certificate) {\n      // Preserve compatibility with 0.2.7 API\n      options.ssl.cert = options.ssl.certificate\n      delete options.ssl.certificate\n    }\n\n    server = https.createServer(options.ssl, app)\n    delete options.ssl\n  } else {\n    server = http.createServer(app)\n  }\n\n  var nodeOperator = ExpressServer(server, options)\n  app.use(path, nodeOperator)\n\n  if (callback) {\n    server.listen(port, function() {\n      callback(server)\n    })\n  } else {\n    server.listen(port)\n  }\n\n  return nodeOperator\n}\n\nexports = module.exports = {\n  ExpressServer: ExpressServer,\n  BlockHubServer: BlockHubServer\n}\n"]}