forked from cory/tildefriends
Get my foot in the door converting ssb.js to C.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4050 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
29
core/ssb.js
29
core/ssb.js
@ -205,35 +205,8 @@ ssb.addRpc(['blobs', 'has'], function(request) {
|
||||
request.send_json(found);
|
||||
});
|
||||
|
||||
ssb.addRpc(['blobs', 'get'], function(request) {
|
||||
for (let arg of request.args) {
|
||||
var blob;
|
||||
if (arg.key) {
|
||||
blob = ssb.blobGet(arg.key);
|
||||
} else {
|
||||
blob = ssb.blobGet(arg);
|
||||
}
|
||||
const k_send_max = 8192;
|
||||
if (blob.byteLength > k_send_max) {
|
||||
for (var i = 0; i < blob.byteLength; i += k_send_max) {
|
||||
var buffer = new Uint8Array(blob, i, Math.min(blob.byteLength - i, k_send_max));
|
||||
request.send_binary(buffer);
|
||||
}
|
||||
} else {
|
||||
request.send_binary(blob);
|
||||
}
|
||||
request.send_json_end(true);
|
||||
}
|
||||
});
|
||||
|
||||
ssb.addRpc(['gossip', 'ping'], function(request) {
|
||||
request.more(function ping(message) {
|
||||
message.send_json(Date.now());
|
||||
});
|
||||
});
|
||||
|
||||
ssb.addRpc(['tunnel', 'isRoom'], function(request) {
|
||||
request.send_json({"name":"tilde friends tunnel","membership":false,"features":["tunnel","room1"]});
|
||||
request.send_json({"name": "tilde friends tunnel", "membership": false, "features": ["tunnel", "room1"]});
|
||||
});
|
||||
|
||||
function notify_attendant_changed(id, type) {
|
||||
|
Reference in New Issue
Block a user