Add a setting to toggle whether replication is allowed, to be able to make a pure room, or even less, node.

This commit is contained in:
2024-08-14 20:02:46 -04:00
parent b37669184a
commit 107666cc60
4 changed files with 67 additions and 3 deletions

View File

@ -265,6 +265,7 @@ typedef struct _tf_ssb_t
uv_thread_t thread_self;
bool is_room;
bool is_replicator;
char* room_name;
char seeds_host[256];
time_t last_seed_check;
@ -2196,6 +2197,7 @@ tf_ssb_t* tf_ssb_create(uv_loop_t* loop, JSContext* context, const char* db_path
{
tf_ssb_t* ssb = tf_malloc(sizeof(tf_ssb_t));
memset(ssb, 0, sizeof(*ssb));
ssb->is_replicator = true;
const char* actual_key = network_key ? network_key : k_ssb_network_string;
if (sodium_hex2bin(ssb->network_key, sizeof(ssb->network_key), actual_key, strlen(actual_key), ": ", NULL, NULL))
@ -3997,6 +3999,16 @@ const char* tf_ssb_get_room_name(tf_ssb_t* ssb)
return ssb->room_name;
}
bool tf_ssb_is_replicator(tf_ssb_t* ssb)
{
return ssb->is_replicator;
}
void tf_ssb_set_is_replicator(tf_ssb_t* ssb, bool is_replicator)
{
ssb->is_replicator = is_replicator;
}
void tf_ssb_set_room_name(tf_ssb_t* ssb, const char* room_name)
{
tf_free(ssb->room_name);