diff --git a/historyKeeper.js b/lib/historyKeeper.js similarity index 99% rename from historyKeeper.js rename to lib/historyKeeper.js index 2cb0f98ec..414d064c3 100644 --- a/historyKeeper.js +++ b/lib/historyKeeper.js @@ -5,10 +5,10 @@ const nThen = require('nthen'); const Nacl = require('tweetnacl/nacl-fast'); const Crypto = require('crypto'); -const Once = require("./lib/once"); -const Meta = require("./lib/metadata"); -const WriteQueue = require("./lib/write-queue"); -const BatchRead = require("./lib/batch-read"); +const Once = require("./once"); +const Meta = require("./metadata"); +const WriteQueue = require("./write-queue"); +const BatchRead = require("./batch-read"); let Log; const now = function () { return (new Date()).getTime(); }; diff --git a/rpc.js b/lib/rpc.js similarity index 98% rename from rpc.js rename to lib/rpc.js index 1790682ec..dfe27302d 100644 --- a/rpc.js +++ b/lib/rpc.js @@ -11,25 +11,25 @@ var Fs = require("fs"); var Fse = require("fs-extra"); var Path = require("path"); var Https = require("https"); -const Package = require('./package.json'); -const Pinned = require('./scripts/pinned'); +const Package = require('../package.json'); +const Pinned = require('../scripts/pinned'); const Saferphore = require("saferphore"); const nThen = require("nthen"); const getFolderSize = require("get-folder-size"); -const Pins = require("./lib/pins"); -const Meta = require("./lib/metadata"); -const WriteQueue = require("./lib/write-queue"); -const BatchRead = require("./lib/batch-read"); +const Pins = require("./pins"); +const Meta = require("./metadata"); +const WriteQueue = require("./write-queue"); +const BatchRead = require("./batch-read"); -const Util = require("./lib/common-util"); +const Util = require("./common-util"); const escapeKeyCharacters = Util.escapeKeyCharacters; const unescapeKeyCharacters = Util.unescapeKeyCharacters; const mkEvent = Util.mkEvent; var RPC = module.exports; -var Store = require("./storage/file"); -var BlobStore = require("./storage/blob"); +var Store = require("../storage/file"); +var BlobStore = require("../storage/blob"); var DEFAULT_LIMIT = 50 * 1024 * 1024; var SESSION_EXPIRATION_TIME = 60 * 1000; @@ -611,6 +611,9 @@ var updateLimits = function (Env, config, publicKey, cb /*:(?string, ?any[])=>vo req.end(body); }; +// XXX it's possible for this to respond before the server has had a chance +// to fetch the limits. Maybe we should respond with an error... +// or wait until we actually know the limits before responding var getLimit = function (Env, publicKey, cb) { var unescapedKey = unescapeKeyCharacters(publicKey); var limit = Env.limits[unescapedKey]; @@ -1445,6 +1448,7 @@ RPC.create = function (config, cb) { evPinnedPadsReady: mkEvent(true), limits: {}, admins: [], + sessionExpirationInterval: undefined, }; try { diff --git a/server.js b/server.js index 399eb1442..fec59a7ea 100644 --- a/server.js +++ b/server.js @@ -264,7 +264,7 @@ var nt = nThen(function (w) { }, 1000 * 60 * 5); // run every five minutes })); }).nThen(function (w) { - require("./rpc").create(config, w(function (e, _rpc) { + require("./lib/rpc").create(config, w(function (e, _rpc) { if (e) { w.abort(); throw e; @@ -272,7 +272,7 @@ var nt = nThen(function (w) { rpc = _rpc; })); }).nThen(function () { - var HK = require('./historyKeeper.js'); + var HK = require('./lib/historyKeeper.js'); var hkConfig = { tasks: config.tasks, rpc: rpc,