cryptpad-server 0.0.2 → 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 +17 -18
- package/build/core.worker.js +7 -0
- package/build/eviction.js +7736 -0
- package/build/front.js +17 -9
- package/build/http.js +16 -5
- package/build/http.worker.js +46 -11
- package/build/storage.cluster.js +34 -9
- package/build/storage.js +61 -16
- package/build/storage.worker.js +89 -10
- package/index.js +35 -38
- package/package.json +8 -4
- package/readme.md +1 -5
- package/build/websocket.js +0 -35556
- package/build/ws.worker.js +0 -46222
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) => {
|
|
@@ -1967,7 +1970,6 @@ function requireCore$1() {
|
|
|
1967
1970
|
const Util = requireCommonUtil$1();
|
|
1968
1971
|
const Constants = requireConstants();
|
|
1969
1972
|
const escapeKeyCharacters = Util.escapeKeyCharacters;
|
|
1970
|
-
__require$3();
|
|
1971
1973
|
const Crypto = __require$5();
|
|
1972
1974
|
const Keys = requireKeys();
|
|
1973
1975
|
Core.DEFAULT_LIMIT = 50 * 1024 * 1024;
|
|
@@ -2087,8 +2089,7 @@ function requireCore$1() {
|
|
|
2087
2089
|
cb();
|
|
2088
2090
|
};
|
|
2089
2091
|
Core.getPaths = (mainConfig, isEnv) => {
|
|
2090
|
-
const {
|
|
2091
|
-
Constants.paths;
|
|
2092
|
+
const {config} = mainConfig;
|
|
2092
2093
|
const all = {
|
|
2093
2094
|
basePath: config.basePath || config.base || "./data",
|
|
2094
2095
|
filePath: config.filePath || "./datastore",
|
|
@@ -3155,6 +3156,14 @@ function requireFile() {
|
|
|
3155
3156
|
writeLinkedFile(env, path, content, cb);
|
|
3156
3157
|
});
|
|
3157
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
|
+
};
|
|
3158
3167
|
const getLinkedDocuments = (env, channelId, cb) => {
|
|
3159
3168
|
const path = mkLinkedPath(env, channelId);
|
|
3160
3169
|
readLinkedFile(env, path, cb);
|
|
@@ -4227,6 +4236,7 @@ function requireFile() {
|
|
|
4227
4236
|
writeMetadata(env, channelName, data, Util.both(cb, next));
|
|
4228
4237
|
});
|
|
4229
4238
|
},
|
|
4239
|
+
hasLinkedDocuments: channelId => hasLinkedDocuments(env, channelId),
|
|
4230
4240
|
getLinkedDocuments: (channelId, cb) => {
|
|
4231
4241
|
if (!isValidChannelId(channelId)) {
|
|
4232
4242
|
return cb(new Error("EINVAL"));
|
|
@@ -4445,11 +4455,6 @@ function requireAdmin() {
|
|
|
4445
4455
|
const nThen = require$$3;
|
|
4446
4456
|
const Crypto = __require$5();
|
|
4447
4457
|
const Admin = {};
|
|
4448
|
-
const getWorkerProfiles = function(Env, _publicKey, _data, cb) {
|
|
4449
|
-
cb(void 0, {
|
|
4450
|
-
"Not Implemented": 1
|
|
4451
|
-
});
|
|
4452
|
-
};
|
|
4453
4458
|
const getUid = () => Crypto.randomBytes(18).toString("hex");
|
|
4454
4459
|
const getInvitations = (Env, _publicKey, _data, cb) => {
|
|
4455
4460
|
Env.interface.broadcast("storage", "ADMIN_CMD", {
|
|
@@ -4518,11 +4523,6 @@ function requireAdmin() {
|
|
|
4518
4523
|
}
|
|
4519
4524
|
Env.flushCache(args, cb);
|
|
4520
4525
|
};
|
|
4521
|
-
const getDiskUsage = (Env, _publicKey, _data, cb) => {
|
|
4522
|
-
cb(void 0, {
|
|
4523
|
-
DEPRECATED: 0
|
|
4524
|
-
});
|
|
4525
|
-
};
|
|
4526
4526
|
const getRegisteredUsers = (Env, _publicKey, _data, cb) => {
|
|
4527
4527
|
Env.interface.broadcast("storage", "GET_REGISTERED_USERS", {}, (_err, data) => {
|
|
4528
4528
|
let users = data.reduce((acc, it) => acc + it?.users, 0);
|
|
@@ -5166,7 +5166,6 @@ function requireAdmin() {
|
|
|
5166
5166
|
ACTIVE_SESSIONS: getActiveSessions,
|
|
5167
5167
|
ACTIVE_PADS: getActiveChannelCount,
|
|
5168
5168
|
REGISTERED_USERS: getRegisteredUsers,
|
|
5169
|
-
DISK_USAGE: getDiskUsage,
|
|
5170
5169
|
FLUSH_CACHE: flushCache,
|
|
5171
5170
|
GET_FILE_DESCRIPTOR_COUNT: getFileDescriptorCount,
|
|
5172
5171
|
GET_FILE_DESCRIPTOR_LIMIT: getFileDescriptorLimit,
|
|
@@ -5203,7 +5202,6 @@ function requireAdmin() {
|
|
|
5203
5202
|
ADMIN_DECREE: Admin.sendDecree,
|
|
5204
5203
|
INSTANCE_STATUS: instanceStatus,
|
|
5205
5204
|
GET_LIMITS: getLimits,
|
|
5206
|
-
GET_WORKER_PROFILES: getWorkerProfiles,
|
|
5207
5205
|
GET_USER_TOTAL_SIZE: getUserTotalSize,
|
|
5208
5206
|
GET_ALL_INVITATIONS: getInvitations,
|
|
5209
5207
|
CREATE_INVITATION: createInvitation,
|
|
@@ -7696,7 +7694,7 @@ function requireHttpCommands() {
|
|
|
7696
7694
|
return httpCommands;
|
|
7697
7695
|
}
|
|
7698
7696
|
|
|
7699
|
-
var version = "0.0.
|
|
7697
|
+
var version = "0.0.4";
|
|
7700
7698
|
|
|
7701
7699
|
var require$$2 = {
|
|
7702
7700
|
version
|
|
@@ -9091,7 +9089,6 @@ function requireCore() {
|
|
|
9091
9089
|
};
|
|
9092
9090
|
const {challengePath} = Core.getPaths(mainConfig);
|
|
9093
9091
|
Env.challengePath = challengePath;
|
|
9094
|
-
Env.workers = WorkerModule(workerConfig);
|
|
9095
9092
|
let queriesToStorage = [];
|
|
9096
9093
|
let queriesToFront = [];
|
|
9097
9094
|
let eventsToStorage = [];
|
|
@@ -9136,11 +9133,13 @@ function requireCore() {
|
|
|
9136
9133
|
Env.Log.error("INTERFACE_INIT_ERROR", err);
|
|
9137
9134
|
return;
|
|
9138
9135
|
}
|
|
9136
|
+
Env.workers = WorkerModule(workerConfig);
|
|
9139
9137
|
if (process.send !== undefined) {
|
|
9140
9138
|
process.send({
|
|
9141
9139
|
type: "core",
|
|
9142
9140
|
index,
|
|
9143
|
-
msg: "READY"
|
|
9141
|
+
msg: "READY",
|
|
9142
|
+
pid: process.pid
|
|
9144
9143
|
});
|
|
9145
9144
|
}
|
|
9146
9145
|
checkCacheInterval();
|
package/build/core.worker.js
CHANGED
|
@@ -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);
|