forked from cory/tildefriends
		
	Expose the server's public key. Going to use this to make local accounts visible externally and also to make it easy to show the room link.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4557 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/ssb.js.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/ssb.js.c
									
									
									
									
									
								
							| @@ -96,6 +96,21 @@ static JSValue _tf_ssb_getIdentities(JSContext* context, JSValueConst this_val, | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| static JSValue _tf_ssb_getServerIdentity(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) | ||||
| { | ||||
| 	JSValue result = JS_NewArray(context); | ||||
| 	tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId); | ||||
| 	if (ssb) | ||||
| 	{ | ||||
| 		char id[k_id_base64_len] = { 0 }; | ||||
| 		if (tf_ssb_whoami(ssb, id, sizeof(id))) | ||||
| 		{ | ||||
| 			result = JS_NewString(context, id); | ||||
| 		} | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| static JSValue _tf_ssb_getAllIdentities(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) | ||||
| { | ||||
| 	JSValue result = JS_NewArray(context); | ||||
| @@ -1459,6 +1474,7 @@ void tf_ssb_register(JSContext* context, tf_ssb_t* ssb) | ||||
| 	JS_SetPropertyStr(context, object, "appendMessageWithIdentity", JS_NewCFunction(context, _tf_ssb_appendMessageWithIdentity, "appendMessageWithIdentity", 3)); | ||||
|  | ||||
| 	/* Does not require an identity. */ | ||||
| 	JS_SetPropertyStr(context, object, "getServerIdentity", JS_NewCFunction(context, _tf_ssb_getServerIdentity, "getServerIdentity", 0)); | ||||
| 	JS_SetPropertyStr(context, object, "getAllIdentities", JS_NewCFunction(context, _tf_ssb_getAllIdentities, "getAllIdentities", 0)); | ||||
| 	JS_SetPropertyStr(context, object, "getMessage", JS_NewCFunction(context, _tf_ssb_getMessage, "getMessage", 2)); | ||||
| 	JS_SetPropertyStr(context, object, "blobGet", JS_NewCFunction(context, _tf_ssb_blobGet, "blobGet", 1)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user