From f1dbd8e70092fac0b202a98a10a832851cdd7f14 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 27 Sep 2022 18:01:51 +0200 Subject: [PATCH] New variable USER_AGENT. --- data.c | 2 +- http.c | 2 +- httpd.c | 2 +- snac.h | 4 ++++ 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;