forked from cory/tildefriends
Fix one lingering call to ssb.connectionSendJson.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4129 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
134b2556ad
commit
ce0b4de5a1
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&WEvJYebSMi5d2eXgUwJJmvR/Q4slFg3zHYB8Q2mXJII=.sha256","index.md":"&79+ntX4sRvg+MboV5nMFz01BSicxsWIQRx719VHS8uk=.sha256","todo.md":"&vLL7JVe1FcqOcYmd22KMkIw3T2IrEbxyonMw5rdICjA=.sha256","structure.md":"&jph8x/fMXKOd4I0ZiUVb0ZLTfPQ7gBWoxJPrvtX6vtw=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256","ssb.md":"&JH1JfoTaCcUifCpnAwhImKBACI0PHoLhoOw1WAnWpLw=.sha256","vision.md":"&v2wu2MGlhNvaALQQ9rGna7ZeEQWSghFgQcDfD5xEyE0=.sha256"}}
|
{"type":"tildefriends-app","files":{"app.js":"&WEvJYebSMi5d2eXgUwJJmvR/Q4slFg3zHYB8Q2mXJII=.sha256","index.md":"&79+ntX4sRvg+MboV5nMFz01BSicxsWIQRx719VHS8uk=.sha256","todo.md":"&hQABwP24zFFhdHagRMF3Am7rV2yH19e+0xJ4wnZ4kfM=.sha256","structure.md":"&jph8x/fMXKOd4I0ZiUVb0ZLTfPQ7gBWoxJPrvtX6vtw=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256","ssb.md":"&JH1JfoTaCcUifCpnAwhImKBACI0PHoLhoOw1WAnWpLw=.sha256","vision.md":"&v2wu2MGlhNvaALQQ9rGna7ZeEQWSghFgQcDfD5xEyE0=.sha256"}}
|
@ -23,17 +23,15 @@
|
|||||||
- placeholder/missing images
|
- placeholder/missing images
|
||||||
- no denial of service
|
- no denial of service
|
||||||
- package standalone executable
|
- package standalone executable
|
||||||
- blob_wants 2.0
|
|
||||||
- editor without app iframe
|
- editor without app iframe
|
||||||
- sequence_before_author -> flags
|
- sequence_before_author -> flags
|
||||||
- linkify ssb: links
|
- linkify ssb: links
|
||||||
- perfect rooms support
|
- perfect rooms support
|
||||||
|
|
||||||
## MVP2
|
|
||||||
- connections 2.0
|
- connections 2.0
|
||||||
- make a better connections API
|
- make a better connections API
|
||||||
|
|
||||||
## Maybe Done
|
## Maybe Done
|
||||||
|
- blob_wants 2.0
|
||||||
- image downsample
|
- image downsample
|
||||||
- app: todo
|
- app: todo
|
||||||
- app: build archive
|
- app: build archive
|
||||||
|
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&gxOJaVf/HdjVJVC9NvZ9n3/825OD1xMMHdF/dFQwe24=.sha256","lit-all.min.js":"&XKgdRySJuiZeZvchNFGjVWn0XOVhQFmG7/HTWYQ8s68=.sha256","index.html":"&TxhFekB9ov7tf/fmkAg7x5797i27oLidhgxEfDKC0T0=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&lA9iFp1YbqSndxXZuwtgmrj7NDMkN71nJITbtjWL3VA=.sha256","tf-id-picker.js":"&maN8DUFrmRxW5nsVyOAMk5k1ekcz/pfzvSS99ac3jo8=.sha256","tf-app.js":"&7hclNu41CIoNk1JlXHiYmDPDyDIICZfMickJYtnF5eQ=.sha256","tf-message.js":"&oXFucwmn16nvKslQoGKTppO+71EoDZJE54z3WrlNUPI=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&6RQUuxB3PkOhYEJr9+89Ptx7uijczjn0r035yCcQOQQ=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&iIQ8FAqBiaOfjLvXwL8X1ewkhBqiZNo2jwnlSzui+bY=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&NC9VddNdX+ZpyIDUQJvH2y1u3ZczQub5+bNmN9ndj7I=.sha256","tf-styles.js":"&LFeL/vWgrv4N8q/mBrQAnhbaOI+dXNJYvH9bn1bXSqQ=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&F7T3LVS867x7vsKhYRR7eLNdCFZmrZ3JzEMfJEEKRm0=.sha256","tf-tab-connections.js":"&Ftt5RnkrhndV2lwC7XXUZX8JiUODqPjqEVgSTJQD6JU=.sha256","tf-news.js":"&gfG5LwXpugDkwDCOCOxQnNn0jLURZexSmvDu4SpQohA=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256","commonmark-hashtag.js":"&H+V1OLA9GDdzycKclz276zAtSZLpT3rlNVa4+qQmp4o=.sha256"}}
|
{"type":"tildefriends-app","files":{"app.js":"&XTD0RACx/SmKdvQUuGYL92LHkSReC8F/1zVHiC5xiog=.sha256","lit-all.min.js":"&XKgdRySJuiZeZvchNFGjVWn0XOVhQFmG7/HTWYQ8s68=.sha256","index.html":"&TxhFekB9ov7tf/fmkAg7x5797i27oLidhgxEfDKC0T0=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&lA9iFp1YbqSndxXZuwtgmrj7NDMkN71nJITbtjWL3VA=.sha256","tf-id-picker.js":"&maN8DUFrmRxW5nsVyOAMk5k1ekcz/pfzvSS99ac3jo8=.sha256","tf-app.js":"&7hclNu41CIoNk1JlXHiYmDPDyDIICZfMickJYtnF5eQ=.sha256","tf-message.js":"&oXFucwmn16nvKslQoGKTppO+71EoDZJE54z3WrlNUPI=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&6RQUuxB3PkOhYEJr9+89Ptx7uijczjn0r035yCcQOQQ=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&ZFkTrACfSE3CeacnuHcpqysPuNm2TJ2ATVQfJv+qjzU=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&NC9VddNdX+ZpyIDUQJvH2y1u3ZczQub5+bNmN9ndj7I=.sha256","tf-styles.js":"&LFeL/vWgrv4N8q/mBrQAnhbaOI+dXNJYvH9bn1bXSqQ=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&F7T3LVS867x7vsKhYRR7eLNdCFZmrZ3JzEMfJEEKRm0=.sha256","tf-tab-connections.js":"&ZO74cEYH83A6ZAZDNnTS1w+Aa05GnZonBJL9aufaJ3o=.sha256","tf-news.js":"&gfG5LwXpugDkwDCOCOxQnNn0jLURZexSmvDu4SpQohA=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256","commonmark-hashtag.js":"&H+V1OLA9GDdzycKclz276zAtSZLpT3rlNVa4+qQmp4o=.sha256"}}
|
@ -30,12 +30,8 @@ tfrpc.register(async function getBroadcasts() {
|
|||||||
tfrpc.register(async function getConnections() {
|
tfrpc.register(async function getConnections() {
|
||||||
return ssb.connections();
|
return ssb.connections();
|
||||||
});
|
});
|
||||||
tfrpc.register(async function connectionSendJson(id, message) {
|
tfrpc.register(async function createTunnel(portal, target) {
|
||||||
return ssb.connectionSendJson(id, message);
|
return ssb.createTunnel(portal, target);
|
||||||
});
|
|
||||||
tfrpc.register(async function createTunnel(portal, request_number, target) {
|
|
||||||
let t = ssb.createTunnel(portal, request_number, target);
|
|
||||||
return t;
|
|
||||||
});
|
});
|
||||||
tfrpc.register(async function connect(token) {
|
tfrpc.register(async function connect(token) {
|
||||||
await ssb.connect(token);
|
await ssb.connect(token);
|
||||||
|
@ -94,7 +94,7 @@ class TfComposeElement extends LitElement {
|
|||||||
if (type.startsWith('image/')) {
|
if (type.startsWith('image/')) {
|
||||||
let best_buffer;
|
let best_buffer;
|
||||||
let best_type;
|
let best_type;
|
||||||
for (let format of ['image/png', 'image/jpeg']) {
|
for (let format of ['image/png', 'image/jpeg', 'image/webp']) {
|
||||||
let test_buffer = await self.convert_to_format(buffer, file.type, format);
|
let test_buffer = await self.convert_to_format(buffer, file.type, format);
|
||||||
console.log(format, test_buffer.length);
|
console.log(format, test_buffer.length);
|
||||||
if (!best_buffer || test_buffer.length < best_buffer.length) {
|
if (!best_buffer || test_buffer.length < best_buffer.length) {
|
||||||
|
@ -46,8 +46,7 @@ class TfTabConnectionsElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _tunnel(portal, target) {
|
async _tunnel(portal, target) {
|
||||||
let request_number = await tfrpc.rpc.connectionSendJson(portal, {name: ['tunnel', 'connect'], args: [{portal: portal, target: target}], type: 'duplex'});
|
return tfrpc.rpc.createTunnel(portal, target);
|
||||||
return tfrpc.rpc.createTunnel(portal, request_number, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render_room_peer(connection) {
|
render_room_peer(connection) {
|
||||||
|
@ -90,7 +90,6 @@ bool tf_ssb_whoami(tf_ssb_t* ssb, char* out_id, size_t out_id_size);
|
|||||||
|
|
||||||
void tf_ssb_visit_broadcasts(tf_ssb_t* ssb, void (*callback)(const char* host, const struct sockaddr_in* addr, tf_ssb_connection_t* tunnel, const uint8_t* pub, void* user_data), void* user_data);
|
void tf_ssb_visit_broadcasts(tf_ssb_t* ssb, void (*callback)(const char* host, const struct sockaddr_in* addr, tf_ssb_connection_t* tunnel, const uint8_t* pub, void* user_data), void* user_data);
|
||||||
|
|
||||||
tf_ssb_connection_t* tf_ssb_get_connection(tf_ssb_t* ssb, const char* id);
|
|
||||||
const char** tf_ssb_get_connection_ids(tf_ssb_t* ssb);
|
const char** tf_ssb_get_connection_ids(tf_ssb_t* ssb);
|
||||||
int tf_ssb_get_connections(tf_ssb_t* ssb, tf_ssb_connection_t** out_connections, int out_connections_count);
|
int tf_ssb_get_connections(tf_ssb_t* ssb, tf_ssb_connection_t** out_connections, int out_connections_count);
|
||||||
void tf_ssb_connect(tf_ssb_t* ssb, const char* host, int port, const uint8_t* key);
|
void tf_ssb_connect(tf_ssb_t* ssb, const char* host, int port, const uint8_t* key);
|
||||||
|
31
src/ssb.js.c
31
src/ssb.js.c
@ -698,15 +698,38 @@ static JSValue _tf_ssb_hmacsha256_verify(JSContext* context, JSValueConst this_v
|
|||||||
|
|
||||||
static JSValue _tf_ssb_createTunnel(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
static JSValue _tf_ssb_createTunnel(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||||
{
|
{
|
||||||
|
JSValue result = JS_UNDEFINED;
|
||||||
tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId);
|
tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId);
|
||||||
const char* portal_id = JS_ToCString(context, argv[0]);
|
const char* portal_id = JS_ToCString(context, argv[0]);
|
||||||
int32_t request_number = 0;
|
const char* target_id = JS_ToCString(context, argv[1]);
|
||||||
JS_ToInt32(context, &request_number, argv[1]);
|
|
||||||
const char* target_id = JS_ToCString(context, argv[2]);
|
tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id);
|
||||||
|
if (connection)
|
||||||
|
{
|
||||||
|
// let request_number = await tfrpc.rpc.connectionSendJson(portal, {name: ['tunnel', 'connect'], args: [{portal: portal, target: target}], type: 'duplex'});
|
||||||
|
int32_t request_number = tf_ssb_connection_next_request_number(connection);
|
||||||
|
JSValue message = JS_NewObject(context);
|
||||||
|
JSValue name = JS_NewArray(context);
|
||||||
|
JS_SetPropertyUint32(context, name, 0, JS_NewString(context, "tunnel"));
|
||||||
|
JS_SetPropertyUint32(context, name, 1, JS_NewString(context, "connect"));
|
||||||
|
JS_SetPropertyStr(context, message, "name", name);
|
||||||
|
JSValue arg = JS_NewObject(context);
|
||||||
|
JS_SetPropertyStr(context, arg, "portal", JS_NewString(context, portal_id));
|
||||||
|
JS_SetPropertyStr(context, arg, "target", JS_NewString(context, target_id));
|
||||||
|
JSValue args = JS_NewArray(context);
|
||||||
|
JS_SetPropertyUint32(context, args, 0, arg);
|
||||||
|
JS_SetPropertyStr(context, message, "args", args);
|
||||||
|
JS_SetPropertyStr(context, message, "type", JS_NewString(context, "duplex"));
|
||||||
|
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream, request_number, message, NULL, NULL, NULL);
|
||||||
|
JS_FreeValue(context, message);
|
||||||
|
|
||||||
tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id);
|
tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id);
|
||||||
|
result = JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
JS_FreeCString(context, target_id);
|
JS_FreeCString(context, target_id);
|
||||||
JS_FreeCString(context, portal_id);
|
JS_FreeCString(context, portal_id);
|
||||||
return JS_UNDEFINED;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSValue _tf_ssb_followingDeep(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
static JSValue _tf_ssb_followingDeep(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user