Browse Source

make webpush use our notification server vkey instead of a random, ill-formated
key (necessary for some client notifications, such as moshidon)

violette p. 9 months ago
parent
commit
4102a6a7ac
2 changed files with 6 additions and 1 deletions
  1. 2 0
      doc/snac.8
  2. 4 1
      mastoapi.c

+ 2 - 0
doc/snac.8

@@ -294,6 +294,8 @@ The URL to a favicon. If it's not set, the default one is used instead.
 The maximum number of days an instance is considered down after continuous failed
 The maximum number of days an instance is considered down after continuous failed
 outgoing messages (default: 15). Anyway, whenever any incoming activity from a
 outgoing messages (default: 15). Anyway, whenever any incoming activity from a
 failed instance is detected, this counter is reset for it.
 failed instance is detected, this counter is reset for it.
+.It Ic vkey
+Public vapid key. Used for notification on some client.
 .El
 .El
 .Pp
 .Pp
 You must restart the server to make effective these changes.
 You must restart the server to make effective these changes.

+ 4 - 1
mastoapi.c

@@ -3044,7 +3044,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
             xs *app  = xs_dict_new();
             xs *app  = xs_dict_new();
             xs *id   = xs_replace_i(tid(0), ".", "");
             xs *id   = xs_replace_i(tid(0), ".", "");
             xs *csec = random_str();
             xs *csec = random_str();
-            xs *vkey = random_str();
+            char *vkey = (char *)xs_dict_get(srv_config, "vkey");
+            if (vkey == NULL)
+                vkey = random_str();
+
             xs *cid  = NULL;
             xs *cid  = NULL;
 
 
             /* pick a non-existent random cid */
             /* pick a non-existent random cid */