New variable USER_AGENT.

This commit is contained in:
default 2022-09-27 18:01:51 +02:00
parent 5784ddecb4
commit f1dbd8e700
4 changed files with 7 additions and 3 deletions

2
data.c
View file

@ -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"
"}");

2
http.c
View file

@ -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);

View file

@ -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);

4
snac.h
View file

@ -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;