move some server deps from repo root to lib/

pull/1/head
ansuz 5 years ago
parent c4194117a7
commit f45de2b52f

@ -5,10 +5,10 @@
const nThen = require('nthen'); const nThen = require('nthen');
const Nacl = require('tweetnacl/nacl-fast'); const Nacl = require('tweetnacl/nacl-fast');
const Crypto = require('crypto'); const Crypto = require('crypto');
const Once = require("./lib/once"); const Once = require("./once");
const Meta = require("./lib/metadata"); const Meta = require("./metadata");
const WriteQueue = require("./lib/write-queue"); const WriteQueue = require("./write-queue");
const BatchRead = require("./lib/batch-read"); const BatchRead = require("./batch-read");
let Log; let Log;
const now = function () { return (new Date()).getTime(); }; const now = function () { return (new Date()).getTime(); };

@ -11,25 +11,25 @@ var Fs = require("fs");
var Fse = require("fs-extra"); var Fse = require("fs-extra");
var Path = require("path"); var Path = require("path");
var Https = require("https"); var Https = require("https");
const Package = require('./package.json'); const Package = require('../package.json');
const Pinned = require('./scripts/pinned'); const Pinned = require('../scripts/pinned');
const Saferphore = require("saferphore"); const Saferphore = require("saferphore");
const nThen = require("nthen"); const nThen = require("nthen");
const getFolderSize = require("get-folder-size"); const getFolderSize = require("get-folder-size");
const Pins = require("./lib/pins"); const Pins = require("./pins");
const Meta = require("./lib/metadata"); const Meta = require("./metadata");
const WriteQueue = require("./lib/write-queue"); const WriteQueue = require("./write-queue");
const BatchRead = require("./lib/batch-read"); const BatchRead = require("./batch-read");
const Util = require("./lib/common-util"); const Util = require("./common-util");
const escapeKeyCharacters = Util.escapeKeyCharacters; const escapeKeyCharacters = Util.escapeKeyCharacters;
const unescapeKeyCharacters = Util.unescapeKeyCharacters; const unescapeKeyCharacters = Util.unescapeKeyCharacters;
const mkEvent = Util.mkEvent; const mkEvent = Util.mkEvent;
var RPC = module.exports; var RPC = module.exports;
var Store = require("./storage/file"); var Store = require("../storage/file");
var BlobStore = require("./storage/blob"); var BlobStore = require("../storage/blob");
var DEFAULT_LIMIT = 50 * 1024 * 1024; var DEFAULT_LIMIT = 50 * 1024 * 1024;
var SESSION_EXPIRATION_TIME = 60 * 1000; var SESSION_EXPIRATION_TIME = 60 * 1000;
@ -611,6 +611,9 @@ var updateLimits = function (Env, config, publicKey, cb /*:(?string, ?any[])=>vo
req.end(body); 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 getLimit = function (Env, publicKey, cb) {
var unescapedKey = unescapeKeyCharacters(publicKey); var unescapedKey = unescapeKeyCharacters(publicKey);
var limit = Env.limits[unescapedKey]; var limit = Env.limits[unescapedKey];
@ -1445,6 +1448,7 @@ RPC.create = function (config, cb) {
evPinnedPadsReady: mkEvent(true), evPinnedPadsReady: mkEvent(true),
limits: {}, limits: {},
admins: [], admins: [],
sessionExpirationInterval: undefined,
}; };
try { try {

@ -264,7 +264,7 @@ var nt = nThen(function (w) {
}, 1000 * 60 * 5); // run every five minutes }, 1000 * 60 * 5); // run every five minutes
})); }));
}).nThen(function (w) { }).nThen(function (w) {
require("./rpc").create(config, w(function (e, _rpc) { require("./lib/rpc").create(config, w(function (e, _rpc) {
if (e) { if (e) {
w.abort(); w.abort();
throw e; throw e;
@ -272,7 +272,7 @@ var nt = nThen(function (w) {
rpc = _rpc; rpc = _rpc;
})); }));
}).nThen(function () { }).nThen(function () {
var HK = require('./historyKeeper.js'); var HK = require('./lib/historyKeeper.js');
var hkConfig = { var hkConfig = {
tasks: config.tasks, tasks: config.tasks,
rpc: rpc, rpc: rpc,

Loading…
Cancel
Save