From 8115881c0803fa6063b4c70239980d9c927bf3ce Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 1 Dec 2022 01:19:35 +0000 Subject: [PATCH] Oops. ssb.createTunnel is necessary. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4067 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.js.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ssb.js.c b/src/ssb.js.c index cd70d936..6cfcdd58 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -930,6 +930,19 @@ static JSValue _tf_ssb_hmacsha256_verify(JSContext* context, JSValueConst this_v return result; } +static JSValue _tf_ssb_createTunnel(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) +{ + tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId); + const char* portal_id = JS_ToCString(context, argv[0]); + int32_t request_number = 0; + JS_ToInt32(context, &request_number, argv[1]); + const char* target_id = JS_ToCString(context, argv[2]); + tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id); + JS_FreeCString(context, target_id); + JS_FreeCString(context, portal_id); + return JS_UNDEFINED; +} + static JSValue _tf_ssb_connectionSendJson(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) { tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId); @@ -995,6 +1008,7 @@ void tf_ssb_register(JSContext* context, tf_ssb_t* ssb) JS_SetPropertyStr(context, object, "storeMessage", JS_NewCFunction(context, _tf_ssb_storeMessage, "storeMessage", 1)); JS_SetPropertyStr(context, object, "getBroadcasts", JS_NewCFunction(context, _tf_ssb_getBroadcasts, "getBroadcasts", 0)); JS_SetPropertyStr(context, object, "connect", JS_NewCFunction(context, _tf_ssb_connect, "connect", 1)); + JS_SetPropertyStr(context, object, "createTunnel", JS_NewCFunction(context, _tf_ssb_createTunnel, "createTunnel", 3)); /* Should be trusted only. */ JS_SetPropertyStr(context, object, "addRpc", JS_NewCFunction(context, _tf_ssb_add_rpc, "addRpc", 2));