summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-09-27 18:01:51 +0200
committerdefault <nobody@localhost>2022-09-27 18:01:51 +0200
commitf1dbd8e70092fac0b202a98a10a832851cdd7f14 (patch)
tree2cf8137bc291b81e3d5771ad953abde1da38b463
parent5784ddecb493802846695d8044d78448409de340 (diff)
New variable USER_AGENT.
-rw-r--r--data.c2
-rw-r--r--http.c2
-rw-r--r--httpd.c2
-rw-r--r--snac.h4
4 files changed, 7 insertions, 3 deletions
diff --git a/data.c b/data.c
index 5e6bcac..97cf8b4 100644
--- a/data.c
+++ b/data.c
@@ -545,7 +545,7 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
"\"children\": [],"
"\"liked_by\": [],"
"\"announced_by\": [],"
- "\"version\": \"snac/2.x\","
+ "\"version\": \"" USER_AGENT "\","
"\"referrer\": null,"
"\"parent\": null"
"}");
diff --git a/http.c b/http.c
index c57714d..7c9b598 100644
--- a/http.c
+++ b/http.c
@@ -90,7 +90,7 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
hdrs = xs_dict_append(hdrs, "signature", signature);
hdrs = xs_dict_append(hdrs, "digest", digest);
hdrs = xs_dict_append(hdrs, "host", host);
- hdrs = xs_dict_append(hdrs, "user-agent", "snac/2.x");
+ hdrs = xs_dict_append(hdrs, "user-agent", USER_AGENT);
response = xs_http_request(method, url, hdrs,
body, b_size, status, payload, p_size);
diff --git a/httpd.c b/httpd.c
index 5b26122..13591a1 100644
--- a/httpd.c
+++ b/httpd.c
@@ -158,7 +158,7 @@ void httpd_connection(int rs)
ctype = "text/html; charset=utf-8";
headers = xs_dict_append(headers, "content-type", ctype);
- headers = xs_dict_append(headers, "x-creator", "snac/2.x");
+ headers = xs_dict_append(headers, "x-creator", USER_AGENT);
if (b_size == 0 && body != NULL)
b_size = strlen(body);
diff --git a/snac.h b/snac.h
index 3e83be0..2b76939 100644
--- a/snac.h
+++ b/snac.h
@@ -1,6 +1,10 @@
/* snac - A simple, minimalistic ActivityPub instance */
/* copyright (c) 2022 grunfink - MIT license */
+#define VERSION "2.0001"
+
+#define USER_AGENT "snac/" VERSION
+
extern d_char *srv_basedir;
extern d_char *srv_config;
extern d_char *srv_baseurl;