snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 0f9a859f734e55ec2f853cf910c0a429ef4c77dd
parent a0429d46994090f7837ff8c0d3cfea8df81b4c90
Author: default <nobody@localhost>
Date:   Wed,  3 Apr 2024 08:58:44 +0200

Added some error logging regarding the emojis.json file.

Diffstat:
Mdoc/snac.8 | 4++--
Mformat.c | 7+++++++
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/snac.8 b/doc/snac.8 @@ -249,8 +249,8 @@ e.g. :happydoggo:). These images can be served from an external source or from t .Pa static directory of the instance admin. .Pp -If you want to disable any Emoji substitution, leave it as a 0 byte file -or with an empty JSON object ({}). +If you want to disable any Emoji substitution, change the file to contain +just an empty JSON object ({}). .Ss SPAM Mitigation There have been some SPAM attacks on the Fediverse and, as too many instances and server implementations out there still allow automatic diff --git a/format.c b/format.c @@ -58,6 +58,8 @@ xs_dict *emojis(void) xs_json_dump(d, 4, f); fclose(f); } + else + srv_log(xs_fmt("Error creating '%s'", fn)); } xs_dict *d = NULL; @@ -65,7 +67,12 @@ xs_dict *emojis(void) if ((f = fopen(fn, "r")) != NULL) { d = xs_json_load(f); fclose(f); + + if (d == NULL) + srv_log(xs_fmt("JSON parse error in '%s'", fn)); } + else + srv_log(xs_fmt("Error opening '%s'", fn)); return d; }