sockethub 5.0.0-alpha.2 → 5.0.0-alpha.3
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/bin/sockethub +2 -29
- package/build.js +21 -0
- package/package.json +15 -65
- package/{dist/defaults.json → sockethub.config.json} +8 -7
- package/tsconfig.json +6 -68
- package/README.md +0 -98
- package/config.json.example +0 -32
- package/dist/bootstrap/init.js +0 -74
- package/dist/bootstrap/init.js.map +0 -1
- package/dist/bootstrap/platforms.js +0 -103
- package/dist/common.js +0 -20
- package/dist/common.js.map +0 -1
- package/dist/config.js +0 -60
- package/dist/config.js.map +0 -1
- package/dist/crypto.js +0 -38
- package/dist/crypto.js.map +0 -1
- package/dist/janitor.js +0 -98
- package/dist/janitor.js.map +0 -1
- package/dist/middleware/create-activity-object.js +0 -19
- package/dist/middleware/create-activity-object.js.map +0 -1
- package/dist/middleware/expand-activity-stream.js +0 -33
- package/dist/middleware/expand-activity-stream.js.map +0 -1
- package/dist/middleware/expand-activity-stream.test.data.js +0 -360
- package/dist/middleware/expand-activity-stream.test.data.js.map +0 -1
- package/dist/middleware/store-credentials.js +0 -19
- package/dist/middleware/store-credentials.js.map +0 -1
- package/dist/middleware/validate.js +0 -77
- package/dist/middleware/validate.js.map +0 -1
- package/dist/middleware/validate.test.data.js +0 -321
- package/dist/middleware/validate.test.data.js.map +0 -1
- package/dist/middleware.js +0 -54
- package/dist/middleware.js.map +0 -1
- package/dist/platform-instance.js +0 -226
- package/dist/platform-instance.js.map +0 -1
- package/dist/platform.js +0 -186
- package/dist/platform.js.map +0 -1
- package/dist/process-manager.js +0 -78
- package/dist/process-manager.js.map +0 -1
- package/dist/routes.js +0 -84
- package/dist/routes.js.map +0 -1
- package/dist/serve.js +0 -102
- package/dist/serve.js.map +0 -1
- package/dist/sockethub-client.js +0 -2604
- package/dist/sockethub-client.js.map +0 -1
- package/dist/sockethub-client.min.js +0 -2
- package/dist/sockethub-client.min.js.LICENSE.txt +0 -24
- package/dist/sockethub.js +0 -130
- package/dist/sockethub.js.map +0 -1
- package/dist/store.js +0 -17
- package/dist/store.js.map +0 -1
- package/src/bootstrap/init.d.ts +0 -8
- package/src/bootstrap/init.ts +0 -91
- package/src/bootstrap/platforms.js +0 -103
- package/src/common.test.ts +0 -54
- package/src/common.ts +0 -14
- package/src/config.d.ts +0 -2
- package/src/config.test.ts +0 -28
- package/src/config.ts +0 -72
- package/src/crypto.d.ts +0 -5
- package/src/crypto.test.ts +0 -41
- package/src/crypto.ts +0 -41
- package/src/defaults.json +0 -32
- package/src/janitor.d.ts +0 -8
- package/src/janitor.ts +0 -89
- package/src/middleware/create-activity-object.test.ts +0 -10
- package/src/middleware/create-activity-object.ts +0 -13
- package/src/middleware/expand-activity-stream.test.data.ts +0 -365
- package/src/middleware/expand-activity-stream.test.ts +0 -78
- package/src/middleware/expand-activity-stream.ts +0 -27
- package/src/middleware/store-credentials.test.ts +0 -72
- package/src/middleware/store-credentials.ts +0 -16
- package/src/middleware/validate.d.ts +0 -1
- package/src/middleware/validate.test.data.ts +0 -320
- package/src/middleware/validate.test.ts +0 -47
- package/src/middleware/validate.ts +0 -49
- package/src/middleware.d.ts +0 -21
- package/src/middleware.test.ts +0 -148
- package/src/middleware.ts +0 -52
- package/src/platform-instance.test.ts +0 -237
- package/src/platform-instance.ts +0 -236
- package/src/platform.ts +0 -189
- package/src/process-manager.ts +0 -64
- package/src/routes.test.ts +0 -100
- package/src/routes.ts +0 -93
- package/src/serve.ts +0 -79
- package/src/sockethub-client.test.ts +0 -235
- package/src/sockethub-client.ts +0 -164
- package/src/sockethub.d.ts +0 -1
- package/src/sockethub.ts +0 -184
- package/src/store.test.ts +0 -26
- package/src/store.ts +0 -17
- package/test/init-suite.js +0 -41
- package/test/sockethub-suite.js +0 -25
- package/views/examples/dummy.ejs +0 -93
- package/views/examples/feeds.ejs +0 -90
- package/views/examples/irc.ejs +0 -239
- package/views/examples/shared.js +0 -72
- package/views/examples/xmpp.ejs +0 -191
- package/views/index.ejs +0 -17
- package/webpack.minified.config.js +0 -14
- package/webpack.normal.config.js +0 -14
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.platformInstances = void 0;
|
|
16
|
-
const child_process_1 = require("child_process");
|
|
17
|
-
const path_1 = require("path");
|
|
18
|
-
const debug_1 = require("debug");
|
|
19
|
-
const bull_1 = __importDefault(require("bull"));
|
|
20
|
-
const config_1 = __importDefault(require("./config"));
|
|
21
|
-
const serve_1 = require("./serve");
|
|
22
|
-
const common_1 = require("./common");
|
|
23
|
-
// collection of platform instances, stored by `id`
|
|
24
|
-
exports.platformInstances = new Map();
|
|
25
|
-
class PlatformInstance {
|
|
26
|
-
constructor(params) {
|
|
27
|
-
this.flaggedForTermination = false;
|
|
28
|
-
this.completedJobHandlers = new Map();
|
|
29
|
-
this.config = {};
|
|
30
|
-
this.sessions = new Set();
|
|
31
|
-
this.sessionCallbacks = {
|
|
32
|
-
'close': (() => new Map())(),
|
|
33
|
-
'message': (() => new Map())()
|
|
34
|
-
};
|
|
35
|
-
this.global = false;
|
|
36
|
-
this.id = params.identifier;
|
|
37
|
-
this.name = params.platform;
|
|
38
|
-
this.parentId = params.parentId;
|
|
39
|
-
if (params.actor) {
|
|
40
|
-
this.actor = params.actor;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.global = true;
|
|
44
|
-
}
|
|
45
|
-
this.debug = (0, debug_1.debug)(`sockethub:platform-instance:${this.id}`);
|
|
46
|
-
// spin off a process
|
|
47
|
-
this.process = (0, child_process_1.fork)((0, path_1.join)(__dirname, 'platform.js'), [this.parentId, this.name, this.id]);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Destroys all references to this platform instance, internal listeners and controlled processes
|
|
51
|
-
*/
|
|
52
|
-
destroy() {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
this.debug(`cleaning up`);
|
|
55
|
-
this.flaggedForTermination = true;
|
|
56
|
-
try {
|
|
57
|
-
yield this.queue.removeAllListeners();
|
|
58
|
-
}
|
|
59
|
-
catch (e) { }
|
|
60
|
-
try {
|
|
61
|
-
yield this.queue.obliterate({ force: true });
|
|
62
|
-
}
|
|
63
|
-
catch (e) { }
|
|
64
|
-
try {
|
|
65
|
-
delete this.queue;
|
|
66
|
-
yield this.process.removeAllListeners('close');
|
|
67
|
-
yield this.process.unref();
|
|
68
|
-
yield this.process.kill();
|
|
69
|
-
}
|
|
70
|
-
catch (e) { }
|
|
71
|
-
exports.platformInstances.delete(this.id);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* When jobs are completed or failed, we prepare the results and send them to the client socket
|
|
76
|
-
*/
|
|
77
|
-
initQueue(secret) {
|
|
78
|
-
this.queue = new bull_1.default(this.parentId + this.id, { redis: config_1.default.get('redis') });
|
|
79
|
-
this.queue.on('global:completed', (jobId, resultString) => {
|
|
80
|
-
const result = resultString ? JSON.parse(resultString) : "";
|
|
81
|
-
this.queue.getJob(jobId).then((job) => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
yield this.handleJobResult('completed', (0, common_1.decryptJobData)(job, secret), result);
|
|
83
|
-
yield job.remove();
|
|
84
|
-
}));
|
|
85
|
-
});
|
|
86
|
-
this.queue.on('global:error', (jobId, result) => {
|
|
87
|
-
this.debug("unknown queue error", jobId, result);
|
|
88
|
-
});
|
|
89
|
-
this.queue.on('global:failed', (jobId, result) => {
|
|
90
|
-
this.queue.getJob(jobId).then((job) => __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
yield this.handleJobResult('failed', (0, common_1.decryptJobData)(job, secret), result);
|
|
92
|
-
yield job.remove();
|
|
93
|
-
}));
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Register listener to be called when the process emits a message.
|
|
98
|
-
* @param sessionId ID of socket connection that will receive messages from platform emits
|
|
99
|
-
*/
|
|
100
|
-
registerSession(sessionId) {
|
|
101
|
-
if (!this.sessions.has(sessionId)) {
|
|
102
|
-
this.sessions.add(sessionId);
|
|
103
|
-
for (let type of Object.keys(this.sessionCallbacks)) {
|
|
104
|
-
const cb = this.callbackFunction(type, sessionId);
|
|
105
|
-
this.process.on(type, cb);
|
|
106
|
-
this.sessionCallbacks[type].set(sessionId, cb);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Sends a message to client (user), can be registered with an event emitted from the platform
|
|
112
|
-
* process.
|
|
113
|
-
* @param sessionId ID of the socket connection to send the message to
|
|
114
|
-
* @param msg ActivityStream object to send to client
|
|
115
|
-
*/
|
|
116
|
-
sendToClient(sessionId, msg) {
|
|
117
|
-
(0, serve_1.getSocket)(sessionId).then((socket) => {
|
|
118
|
-
try {
|
|
119
|
-
// this property should never be exposed externally
|
|
120
|
-
delete msg.sessionSecret;
|
|
121
|
-
}
|
|
122
|
-
catch (e) { }
|
|
123
|
-
msg.context = this.name;
|
|
124
|
-
if ((msg.type === 'error') && (typeof msg.actor === 'undefined') && (this.actor)) {
|
|
125
|
-
// ensure an actor is present if not otherwise defined
|
|
126
|
-
msg.actor = { id: this.actor };
|
|
127
|
-
}
|
|
128
|
-
socket.emit('message', msg);
|
|
129
|
-
}, (err) => this.debug(`sendToClient ${err}`));
|
|
130
|
-
}
|
|
131
|
-
// send message to every connected socket associated with this platform instance.
|
|
132
|
-
broadcastToSharedPeers(sessionId, msg) {
|
|
133
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
for (let sid of this.sessions.values()) {
|
|
135
|
-
if (sid !== sessionId) {
|
|
136
|
-
this.debug(`broadcasting message to ${sid}`);
|
|
137
|
-
yield this.sendToClient(sid, msg);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
// handle job results coming in on the queue from platform instances
|
|
143
|
-
handleJobResult(type, jobData, result) {
|
|
144
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
this.debug(`${type} job ${jobData.title}`);
|
|
146
|
-
delete jobData.msg.sessionSecret;
|
|
147
|
-
let msg = jobData.msg;
|
|
148
|
-
if (type === 'failed') {
|
|
149
|
-
msg.error = result ? result : "job failed for unknown reason";
|
|
150
|
-
if ((this.config.persist) && (this.config.requireCredentials.includes(jobData.msg.type))) {
|
|
151
|
-
this.debug(`critical job type ${jobData.msg.type} failed, terminating platform instance`);
|
|
152
|
-
yield this.destroy();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// send result to client
|
|
156
|
-
const callback = this.completedJobHandlers.get(jobData.title);
|
|
157
|
-
if (callback) {
|
|
158
|
-
callback(msg);
|
|
159
|
-
this.completedJobHandlers.delete(jobData.title);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
yield this.sendToClient(jobData.sessionId, msg);
|
|
163
|
-
}
|
|
164
|
-
// let all related peers know of result as an independent message
|
|
165
|
-
// (not as part of a job completion, or failure)
|
|
166
|
-
yield this.broadcastToSharedPeers(jobData.sessionId, msg);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Sends error message to client and clears all references to this class.
|
|
171
|
-
* @param sessionId
|
|
172
|
-
* @param errorMessage
|
|
173
|
-
*/
|
|
174
|
-
reportError(sessionId, errorMessage) {
|
|
175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
const errorObject = {
|
|
177
|
-
context: this.name,
|
|
178
|
-
type: 'error',
|
|
179
|
-
actor: { id: this.actor },
|
|
180
|
-
error: errorMessage
|
|
181
|
-
};
|
|
182
|
-
this.sendToClient(sessionId, errorObject);
|
|
183
|
-
this.sessions.clear();
|
|
184
|
-
yield this.destroy();
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Updates the instance with a new identifier, updating the platformInstances mapping as well.
|
|
189
|
-
* @param identifier
|
|
190
|
-
*/
|
|
191
|
-
updateIdentifier(identifier) {
|
|
192
|
-
exports.platformInstances.delete(this.id);
|
|
193
|
-
this.id = identifier;
|
|
194
|
-
exports.platformInstances.set(this.id, this);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Generates a function tied to a given client session (socket connection), the generated
|
|
198
|
-
* function will be called for each session ID registered, for every platform emit.
|
|
199
|
-
* @param listener
|
|
200
|
-
* @param sessionId
|
|
201
|
-
*/
|
|
202
|
-
callbackFunction(listener, sessionId) {
|
|
203
|
-
const funcs = {
|
|
204
|
-
'close': (e) => {
|
|
205
|
-
this.debug(`close even triggered ${this.id}: ${e}`);
|
|
206
|
-
this.reportError(sessionId, `Error: session thread closed unexpectedly: ${e}`);
|
|
207
|
-
},
|
|
208
|
-
'message': (data) => {
|
|
209
|
-
if (data[0] === 'updateActor') {
|
|
210
|
-
// We need to update the key to the store in order to find it in the future.
|
|
211
|
-
this.updateIdentifier(data[2]);
|
|
212
|
-
}
|
|
213
|
-
else if (data[0] === 'error') {
|
|
214
|
-
this.reportError(sessionId, data[1]);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
// treat like a message to clients
|
|
218
|
-
this.sendToClient(sessionId, data[1]);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
return funcs[listener];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
exports.default = PlatformInstance;
|
|
226
|
-
//# sourceMappingURL=/platform-instance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-instance.js","sourceRoot":"/","sources":["platform-instance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAmD;AACnD,+BAA4B;AAC5B,iCAAwC;AACxC,gDAAyB;AAEzB,sDAA8B;AAE9B,mCAAoC;AACpC,qCAA0C;AAE1C,mDAAmD;AACtC,QAAA,iBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;AAkBrE,MAAqB,gBAAgB;IAkBnC,YAAY,MAA8B;QAjB1C,0BAAqB,GAAY,KAAK,CAAC;QAGvC,yBAAoB,GAA0B,IAAI,GAAG,EAAE,CAAC;QACxD,WAAM,GAAmB,EAAE,CAAC;QAKnB,aAAQ,GAAgB,IAAI,GAAG,EAAE,CAAC;QAClC,qBAAgB,GAAW;YAClC,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE;YAC5B,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE;SAC/B,CAAC;QACc,WAAM,GAAa,KAAK,CAAC;QAIvC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;SAC3B;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SACpB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AI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBAChC;qBAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;oBAC9B,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBACtC;qBAAM;oBACL,kCAAkC;oBAClC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBACvC;YACH,CAAC;SACF,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;CACF;AA9MD,mCA8MC"}
|
package/dist/platform.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const debug_1 = __importDefault(require("debug"));
|
|
7
|
-
const object_hash_1 = __importDefault(require("object-hash"));
|
|
8
|
-
const config_1 = __importDefault(require("./config"));
|
|
9
|
-
const bull_1 = __importDefault(require("bull"));
|
|
10
|
-
const common_1 = require("./common");
|
|
11
|
-
const store_1 = require("./store");
|
|
12
|
-
// command-line params
|
|
13
|
-
const parentId = process.argv[2];
|
|
14
|
-
const platformName = process.argv[3];
|
|
15
|
-
let identifier = process.argv[4];
|
|
16
|
-
const loggerPrefix = `sockethub:platform:${platformName}:${identifier}`;
|
|
17
|
-
let logger = (0, debug_1.default)(loggerPrefix);
|
|
18
|
-
const PlatformModule = require(`sockethub-platform-${platformName}`);
|
|
19
|
-
let queueStarted = false;
|
|
20
|
-
let parentSecret1, parentSecret2;
|
|
21
|
-
logger(`platform handler initialized for ${platformName} ${identifier}`);
|
|
22
|
-
/**
|
|
23
|
-
* Handle any uncaught errors from the platform by alerting the worker and shutting down.
|
|
24
|
-
*/
|
|
25
|
-
process.on('uncaughtException', (err) => {
|
|
26
|
-
console.log('EXCEPTION IN PLATFORM');
|
|
27
|
-
// eslint-disable-next-line security-node/detect-crlf
|
|
28
|
-
console.log(err.stack);
|
|
29
|
-
process.send(['error', err.toString()]);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Incoming messages from the worker to this platform. Data is an array, the first property is the
|
|
34
|
-
* method to call, the rest are params.
|
|
35
|
-
*/
|
|
36
|
-
process.on('message', (data) => {
|
|
37
|
-
if (data[0] === 'secrets') {
|
|
38
|
-
parentSecret1 = data[1].parentSecret1;
|
|
39
|
-
parentSecret2 = data[1].parentSecret2;
|
|
40
|
-
startQueueListener();
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Initialize platform module
|
|
45
|
-
*/
|
|
46
|
-
const platformSession = {
|
|
47
|
-
debug: (0, debug_1.default)(`sockethub:platform:${platformName}:${identifier}`),
|
|
48
|
-
sendToClient: getSendFunction('message'),
|
|
49
|
-
updateActor: updateActor
|
|
50
|
-
};
|
|
51
|
-
const platform = new PlatformModule(platformSession);
|
|
52
|
-
/**
|
|
53
|
-
* Get the credentials stored for this user in this sessions store, if given the correct
|
|
54
|
-
* sessionSecret.
|
|
55
|
-
* @param actorId
|
|
56
|
-
* @param sessionId
|
|
57
|
-
* @param sessionSecret
|
|
58
|
-
* @param cb
|
|
59
|
-
*/
|
|
60
|
-
function getCredentials(actorId, sessionId, sessionSecret, cb) {
|
|
61
|
-
if (platform.config.noCredentials) {
|
|
62
|
-
return cb();
|
|
63
|
-
}
|
|
64
|
-
const store = (0, store_1.getSessionStore)(parentId, parentSecret1, sessionId, sessionSecret);
|
|
65
|
-
store.get(actorId, (err, credentials) => {
|
|
66
|
-
if (platform.config.persist) {
|
|
67
|
-
// don't continue if we don't get credentials
|
|
68
|
-
if (err) {
|
|
69
|
-
return cb(err);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else if (!credentials) {
|
|
73
|
-
// also skip if this is a non-persist platform with no credentials
|
|
74
|
-
return cb();
|
|
75
|
-
}
|
|
76
|
-
if (platform.credentialsHash) {
|
|
77
|
-
if (platform.credentialsHash !== (0, object_hash_1.default)(credentials.object)) {
|
|
78
|
-
return cb('provided credentials do not match existing platform instance for actor '
|
|
79
|
-
+ platform.actor.id);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
platform.credentialsHash = (0, object_hash_1.default)(credentials.object);
|
|
84
|
-
}
|
|
85
|
-
cb(undefined, credentials);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns a function used to handle completed jobs from the platform code (the `done` callback).
|
|
90
|
-
* @param secret the secret used to decrypt credentials
|
|
91
|
-
*/
|
|
92
|
-
function getJobHandler(secret) {
|
|
93
|
-
return (job, done) => {
|
|
94
|
-
const jobData = (0, common_1.decryptJobData)(job, secret);
|
|
95
|
-
const jobLog = (0, debug_1.default)(`${loggerPrefix}:${jobData.sessionId}`);
|
|
96
|
-
jobLog(`received ${jobData.title} ${jobData.msg.type}`);
|
|
97
|
-
const sessionSecret = jobData.msg.sessionSecret;
|
|
98
|
-
delete jobData.msg.sessionSecret;
|
|
99
|
-
return getCredentials(jobData.msg.actor.id, jobData.sessionId, sessionSecret, (err, credentials) => {
|
|
100
|
-
if (err) {
|
|
101
|
-
return done(new Error(err));
|
|
102
|
-
}
|
|
103
|
-
let jobCallbackCalled = false;
|
|
104
|
-
const doneCallback = (err, result) => {
|
|
105
|
-
if (jobCallbackCalled) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
jobCallbackCalled = true;
|
|
109
|
-
if (err) {
|
|
110
|
-
jobLog(`errored ${jobData.title} ${jobData.msg.type}`);
|
|
111
|
-
let errMsg;
|
|
112
|
-
// some error objects (eg. TimeoutError) don't interoplate correctly to human-readable
|
|
113
|
-
// so we have to do this little dance
|
|
114
|
-
try {
|
|
115
|
-
errMsg = err.toString();
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
errMsg = err;
|
|
119
|
-
}
|
|
120
|
-
done(new Error(errMsg));
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
jobLog(`completed ${jobData.title} ${jobData.msg.type}`);
|
|
124
|
-
done(null, result);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
if ((Array.isArray(platform.config.requireCredentials)) &&
|
|
128
|
-
(platform.config.requireCredentials.includes(jobData.msg.type))) {
|
|
129
|
-
// add the credentials object if this method requires it
|
|
130
|
-
platform[jobData.msg.type](jobData.msg, credentials, doneCallback);
|
|
131
|
-
}
|
|
132
|
-
else if (platform.config.persist) {
|
|
133
|
-
if (platform.initialized) {
|
|
134
|
-
platform[jobData.msg.type](jobData.msg, doneCallback);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
done(new Error(`${jobData.msg.type} called on uninitialized platform`));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
platform[jobData.msg.type](jobData.msg, doneCallback);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get an function which sends a message to the parent thread (PlatformInstance). The platform
|
|
148
|
-
* can call that function to send messages back to the client.
|
|
149
|
-
* @param command string containing the type of command to be sent. 'message' or 'close'
|
|
150
|
-
*/
|
|
151
|
-
function getSendFunction(command) {
|
|
152
|
-
return function (msg, special) {
|
|
153
|
-
process.send([command, msg, special]);
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* When a user changes it's actor name, the channel identifier changes, we need to ensure that
|
|
158
|
-
* both the queue thread (listening on the channel for jobs) and the logging object are updated.
|
|
159
|
-
* @param credentials
|
|
160
|
-
*/
|
|
161
|
-
function updateActor(credentials) {
|
|
162
|
-
identifier = (0, common_1.getPlatformId)(platformName, credentials.actor.id);
|
|
163
|
-
logger(`platform actor updated to ${credentials.actor.id} identifier ${identifier}`);
|
|
164
|
-
logger = (0, debug_1.default)(`sockethub:platform:${identifier}`);
|
|
165
|
-
platform.credentialsHash = (0, object_hash_1.default)(credentials.object);
|
|
166
|
-
platform.debug = (0, debug_1.default)(`sockethub:platform:${platformName}:${identifier}`);
|
|
167
|
-
process.send(['updateActor', undefined, identifier]);
|
|
168
|
-
startQueueListener(true);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* starts listening on the queue for incoming jobs
|
|
172
|
-
* @param refresh boolean if the param is true, we re-init the queue.process
|
|
173
|
-
* (used when identifier changes)
|
|
174
|
-
*/
|
|
175
|
-
function startQueueListener(refresh = false) {
|
|
176
|
-
const secret = parentSecret1 + parentSecret2;
|
|
177
|
-
if ((queueStarted) && (!refresh)) {
|
|
178
|
-
logger('start queue called multiple times, skipping');
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const queue = new bull_1.default(parentId + identifier, { redis: config_1.default.get('redis') });
|
|
182
|
-
queueStarted = true;
|
|
183
|
-
logger('listening on the queue for incoming jobs');
|
|
184
|
-
queue.process(getJobHandler(secret));
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=/platform.js.map
|
package/dist/platform.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"/","sources":["platform.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,8DAA+B;AAC/B,sDAA8B;AAC9B,gDAAyB;AACzB,qCAAyD;AAGzD,mCAA0C;AAE1C,sBAAsB;AACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACrC,IAAI,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjC,MAAM,YAAY,GAAG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A,eAAK,EAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;IACnD,QAAQ,CAAC,eAAe,GAAG,IAAA,qBAAI,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,GAAG,IAAA,eAAK,EAAC,sBAAsB,YAAY,IAAI,UAAU,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACrD,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,UAAmB,KAAK;IAClD,MAAM,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC7C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE;QAChC,MAAM,CAAC,6CAA6C,CAAC,CAAC;QACtD,OAAO;KACR;IACD,MAAM,KAAK,GAAG,IAAI,cAAK,CAAC,QAAQ,GAAG,UAAU,EAAE,EAAE,KAAK,EAAE,gBAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/E,YAAY,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,0CAA0C,CAAC,CAAC;IACnD,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/process-manager.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const init_1 = __importDefault(require("./bootstrap/init"));
|
|
26
|
-
const platform_instance_1 = __importStar(require("./platform-instance"));
|
|
27
|
-
const common_1 = require("./common");
|
|
28
|
-
class ProcessManager {
|
|
29
|
-
constructor(parentId, parentSecret1, parentSecret2) {
|
|
30
|
-
this.parentId = parentId;
|
|
31
|
-
this.parentSecret1 = parentSecret1;
|
|
32
|
-
this.parentSecret2 = parentSecret2;
|
|
33
|
-
}
|
|
34
|
-
get(platform, actorId, sessionId) {
|
|
35
|
-
const platformDetails = init_1.default.platforms.get(platform);
|
|
36
|
-
let pi;
|
|
37
|
-
if (platformDetails.config.persist) {
|
|
38
|
-
// ensure process is started - one for each actor
|
|
39
|
-
pi = this.ensureProcess(platform, sessionId, actorId);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// ensure process is started - one for all jobs
|
|
43
|
-
pi = this.ensureProcess(platform);
|
|
44
|
-
}
|
|
45
|
-
pi.config = platformDetails.config;
|
|
46
|
-
return pi;
|
|
47
|
-
}
|
|
48
|
-
createPlatformInstance(identifier, platform, actor) {
|
|
49
|
-
const secrets = [
|
|
50
|
-
'secrets', {
|
|
51
|
-
parentSecret1: this.parentSecret1,
|
|
52
|
-
parentSecret2: this.parentSecret2
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
const platformInstanceConfig = {
|
|
56
|
-
identifier: identifier,
|
|
57
|
-
platform: platform,
|
|
58
|
-
parentId: this.parentId,
|
|
59
|
-
actor: actor
|
|
60
|
-
};
|
|
61
|
-
const platformInstance = new platform_instance_1.default(platformInstanceConfig);
|
|
62
|
-
platformInstance.initQueue(this.parentSecret1 + this.parentSecret2);
|
|
63
|
-
platformInstance.process.send(secrets);
|
|
64
|
-
return platformInstance;
|
|
65
|
-
}
|
|
66
|
-
ensureProcess(platform, sessionId, actor) {
|
|
67
|
-
const identifier = (0, common_1.getPlatformId)(platform, actor);
|
|
68
|
-
const platformInstance = platform_instance_1.platformInstances.get(identifier) ||
|
|
69
|
-
this.createPlatformInstance(identifier, platform, actor);
|
|
70
|
-
if (sessionId) {
|
|
71
|
-
platformInstance.registerSession(sessionId);
|
|
72
|
-
}
|
|
73
|
-
platform_instance_1.platformInstances.set(identifier, platformInstance);
|
|
74
|
-
return platformInstance;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.default = ProcessManager;
|
|
78
|
-
//# sourceMappingURL=/process-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process-manager.js","sourceRoot":"/","sources":["process-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAoC;AACpC,yEAC4F;AAC5F,qCAAyC;AAEzC,MAAM,cAAc;IAKlB,YAAY,QAAgB,EAAE,aAAqB,EAAE,aAAqB;QACxE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,SAAkB;QACvD,MAAM,eAAe,GAAG,c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AAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnE,IAAI,SAAS,EAAE;YACb,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;SAC7C;QACD,qCAAiB,CAAC,GAAG,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QACpD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,kBAAe,cAAc,CAAC"}
|
package/dist/routes.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.examplePages = exports.examplePaths = exports.basePaths = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const config_1 = __importDefault(require("./config"));
|
|
9
|
-
const debug_1 = __importDefault(require("debug"));
|
|
10
|
-
const debug_scope = process.env.DEBUG || '', logger = (0, debug_1.default)('sockethub:routes'), address = config_1.default.get('public:protocol') + '://' +
|
|
11
|
-
config_1.default.get('public:host') + ':' +
|
|
12
|
-
config_1.default.get('public:port') +
|
|
13
|
-
config_1.default.get('public:path');
|
|
14
|
-
exports.basePaths = {
|
|
15
|
-
'/sockethub-client.js': path_1.default.resolve(`${__dirname}/../dist/sockethub-client.js`),
|
|
16
|
-
'/sockethub-client.min.js': path_1.default.resolve(`${__dirname}/../dist/sockethub-client.min.js`),
|
|
17
|
-
'/sockethub-client.js.map': path_1.default.resolve(`${__dirname}/../dist/sockethub-client.js.map`),
|
|
18
|
-
'/socket.io.js': path_1.default.resolve(`${__dirname}/../node_modules/socket.io/client-dist/socket.io.js`),
|
|
19
|
-
'/socket.io.js.map': path_1.default.resolve(`${__dirname}/../node_modules/socket.io/client-dist/socket.io.js.map`),
|
|
20
|
-
};
|
|
21
|
-
exports.examplePaths = {
|
|
22
|
-
'/jquery.js': path_1.default.resolve(`${__dirname}/../node_modules/jquery/dist/jquery.min.js`),
|
|
23
|
-
'/jquery.min.map': path_1.default.resolve(`${__dirname}/../node_modules/jquery/dist/jquery.min.map`),
|
|
24
|
-
'/examples/shared.js': path_1.default.resolve(`${__dirname}/../views/examples/shared.js`)
|
|
25
|
-
};
|
|
26
|
-
exports.examplePages = {
|
|
27
|
-
'/': path_1.default.resolve(`${__dirname}/../views/index.ejs`),
|
|
28
|
-
'/examples/dummy': path_1.default.resolve(`${__dirname}/../views/examples/dummy.ejs`),
|
|
29
|
-
'/examples/feeds': path_1.default.resolve(`${__dirname}/../views/examples/feeds.ejs`),
|
|
30
|
-
'/examples/irc': path_1.default.resolve(`${__dirname}/../views/examples/irc.ejs`),
|
|
31
|
-
'/examples/xmpp': path_1.default.resolve(`${__dirname}/../views/examples/xmpp.ejs`)
|
|
32
|
-
};
|
|
33
|
-
function prepFileRoutes(pathMap) {
|
|
34
|
-
let _routes = [];
|
|
35
|
-
Object.keys(pathMap).forEach((key) => {
|
|
36
|
-
_routes.push({
|
|
37
|
-
meta: {
|
|
38
|
-
method: 'GET',
|
|
39
|
-
path: key
|
|
40
|
-
},
|
|
41
|
-
route: (req, res) => {
|
|
42
|
-
logger(`serving resource ${req.url}`);
|
|
43
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
44
|
-
res.sendFile(pathMap[req.url]);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return _routes;
|
|
49
|
-
}
|
|
50
|
-
const baseRoutes = prepFileRoutes(exports.basePaths);
|
|
51
|
-
const exampleRoutes = prepFileRoutes(exports.examplePaths);
|
|
52
|
-
Object.keys(exports.examplePages).forEach((key) => {
|
|
53
|
-
exampleRoutes.push({
|
|
54
|
-
meta: {
|
|
55
|
-
method: 'GET',
|
|
56
|
-
path: key
|
|
57
|
-
},
|
|
58
|
-
route: (req, res) => {
|
|
59
|
-
logger(`serving page ${req.url}`);
|
|
60
|
-
res.render(exports.examplePages[req.url], {
|
|
61
|
-
debug_scope: debug_scope,
|
|
62
|
-
address: address,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
function addRoute(app) {
|
|
68
|
-
return (route) => {
|
|
69
|
-
app[route.meta.method.toLowerCase()](route.meta.path, route.route);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Setup
|
|
74
|
-
*/
|
|
75
|
-
const routes = {
|
|
76
|
-
setup: function (app, examplesEnabled = config_1.default.get('examples:enabled')) {
|
|
77
|
-
baseRoutes.forEach(addRoute(app));
|
|
78
|
-
if (examplesEnabled) {
|
|
79
|
-
exampleRoutes.forEach(addRoute(app));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports.default = routes;
|
|
84
|
-
//# sourceMappingURL=/routes.js.map
|
package/dist/routes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"/","sources":["routes.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,sDAA8B;AAC9B,kDAA0B;AAE1B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,EACrC,MAAM,GAAQ,IAAA,eAAK,EAAC,kBAAkB,CAAC,EACvC,OAAO,GAAO,gBAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,KAAK;IACrC,gBAAM,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,GAAG;IAC/B,gBAAM,CAAC,GAAG,CAAC,aAAa,CAAC;IACzB,gBAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAEjC,QAAA,SAAS,GAAG;IACvB,sBAAsB,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,SAAS,8BAA8B,CAAC;IAChF,0BAA0B,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,SAAS,kCAAkC,CAAC;IACx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