cryptpad-server 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/core.js CHANGED
@@ -1354,6 +1354,9 @@ function requireWsConnector() {
1354
1354
  cb(void 0, ctx.self);
1355
1355
  };
1356
1356
  const port = config.wsPort || config.port;
1357
+ httpServer.on("error", e => {
1358
+ cb(e);
1359
+ });
1357
1360
  httpServer.listen(port, config.host, onServerReady);
1358
1361
  },
1359
1362
  initClient: (ctx, config, id, onConnected, cb) => {
@@ -3153,6 +3156,14 @@ function requireFile() {
3153
3156
  writeLinkedFile(env, path, content, cb);
3154
3157
  });
3155
3158
  };
3159
+ const hasLinkedDocuments = (env, channelId) => {
3160
+ const path = mkLinkedPath(env, channelId);
3161
+ try {
3162
+ return Fs.existsSync(path);
3163
+ } catch (e) {
3164
+ return false;
3165
+ }
3166
+ };
3156
3167
  const getLinkedDocuments = (env, channelId, cb) => {
3157
3168
  const path = mkLinkedPath(env, channelId);
3158
3169
  readLinkedFile(env, path, cb);
@@ -4225,6 +4236,7 @@ function requireFile() {
4225
4236
  writeMetadata(env, channelName, data, Util.both(cb, next));
4226
4237
  });
4227
4238
  },
4239
+ hasLinkedDocuments: channelId => hasLinkedDocuments(env, channelId),
4228
4240
  getLinkedDocuments: (channelId, cb) => {
4229
4241
  if (!isValidChannelId(channelId)) {
4230
4242
  return cb(new Error("EINVAL"));
@@ -7682,7 +7694,7 @@ function requireHttpCommands() {
7682
7694
  return httpCommands;
7683
7695
  }
7684
7696
 
7685
- var version = "0.0.3";
7697
+ var version = "0.0.4";
7686
7698
 
7687
7699
  var require$$2 = {
7688
7700
  version
@@ -9077,7 +9089,6 @@ function requireCore() {
9077
9089
  };
9078
9090
  const {challengePath} = Core.getPaths(mainConfig);
9079
9091
  Env.challengePath = challengePath;
9080
- Env.workers = WorkerModule(workerConfig);
9081
9092
  let queriesToStorage = [];
9082
9093
  let queriesToFront = [];
9083
9094
  let eventsToStorage = [];
@@ -9122,11 +9133,13 @@ function requireCore() {
9122
9133
  Env.Log.error("INTERFACE_INIT_ERROR", err);
9123
9134
  return;
9124
9135
  }
9136
+ Env.workers = WorkerModule(workerConfig);
9125
9137
  if (process.send !== undefined) {
9126
9138
  process.send({
9127
9139
  type: "core",
9128
9140
  index,
9129
- msg: "READY"
9141
+ msg: "READY",
9142
+ pid: process.pid
9130
9143
  });
9131
9144
  }
9132
9145
  checkCacheInterval();
@@ -970,6 +970,10 @@ function requireWorker() {
970
970
  txid: obj.txid,
971
971
  pid: obj.pid,
972
972
  value
973
+ }, e => {
974
+ if (e) {
975
+ console.error("E_RESPONSE", Util.serializeError(e));
976
+ }
973
977
  });
974
978
  };
975
979
  if (!ready) {
@@ -986,6 +990,9 @@ function requireWorker() {
986
990
  }
987
991
  command(data, cb);
988
992
  });
993
+ process.on("disconnect", () => {
994
+ process.exit(0);
995
+ });
989
996
  process.on("uncaughtException", function(err) {
990
997
  console.error("[%s] UNCAUGHT EXCEPTION IN DB WORKER", new Date);
991
998
  console.error(err);