mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 22:45:05 +00:00
New variable USER_AGENT.
This commit is contained in:
parent
5784ddecb4
commit
f1dbd8e700
4 changed files with 7 additions and 3 deletions
2
data.c
2
data.c
|
@ -545,7 +545,7 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
|
||||||
"\"children\": [],"
|
"\"children\": [],"
|
||||||
"\"liked_by\": [],"
|
"\"liked_by\": [],"
|
||||||
"\"announced_by\": [],"
|
"\"announced_by\": [],"
|
||||||
"\"version\": \"snac/2.x\","
|
"\"version\": \"" USER_AGENT "\","
|
||||||
"\"referrer\": null,"
|
"\"referrer\": null,"
|
||||||
"\"parent\": null"
|
"\"parent\": null"
|
||||||
"}");
|
"}");
|
||||||
|
|
2
http.c
2
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, "signature", signature);
|
||||||
hdrs = xs_dict_append(hdrs, "digest", digest);
|
hdrs = xs_dict_append(hdrs, "digest", digest);
|
||||||
hdrs = xs_dict_append(hdrs, "host", host);
|
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,
|
response = xs_http_request(method, url, hdrs,
|
||||||
body, b_size, status, payload, p_size);
|
body, b_size, status, payload, p_size);
|
||||||
|
|
2
httpd.c
2
httpd.c
|
@ -158,7 +158,7 @@ void httpd_connection(int rs)
|
||||||
ctype = "text/html; charset=utf-8";
|
ctype = "text/html; charset=utf-8";
|
||||||
|
|
||||||
headers = xs_dict_append(headers, "content-type", ctype);
|
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)
|
if (b_size == 0 && body != NULL)
|
||||||
b_size = strlen(body);
|
b_size = strlen(body);
|
||||||
|
|
4
snac.h
4
snac.h
|
@ -1,6 +1,10 @@
|
||||||
/* snac - A simple, minimalistic ActivityPub instance */
|
/* snac - A simple, minimalistic ActivityPub instance */
|
||||||
/* copyright (c) 2022 grunfink - MIT license */
|
/* copyright (c) 2022 grunfink - MIT license */
|
||||||
|
|
||||||
|
#define VERSION "2.0001"
|
||||||
|
|
||||||
|
#define USER_AGENT "snac/" VERSION
|
||||||
|
|
||||||
extern d_char *srv_basedir;
|
extern d_char *srv_basedir;
|
||||||
extern d_char *srv_config;
|
extern d_char *srv_config;
|
||||||
extern d_char *srv_baseurl;
|
extern d_char *srv_baseurl;
|
||||||
|
|
Loading…
Reference in a new issue