Oops. ssb.createTunnel is necessary.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4067 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-12-01 01:19:35 +00:00
parent 7fe3bddeba
commit 8115881c08

View File

@ -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));