summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-07-24 18:31:49 +0200
committerdefault <nobody@localhost>2024-07-24 18:31:49 +0200
commit7a20b14fbcc169833190e03a5964944e0dcd9e65 (patch)
treeaa774822ee9139b7088a8a4ae42f9a6fcba48cde /mastoapi.c
parentde628c5f33fa7989a14a3748a713d73e1ea6ff23 (diff)
mastoapi: opening a token file updates its file date and its app's.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 8a6cbe6..80d03be 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -18,6 +18,8 @@
#include "snac.h"
+#include <sys/time.h>
+
static xs_str *random_str(void)
/* just what is says in the tin */
{
@@ -129,6 +131,17 @@ xs_dict *token_get(const char *id)
if ((f = fopen(fn, "r")) != NULL) {
token = xs_json_load(f);
fclose(f);
+
+ /* 'touch' the file */
+ utimes(fn, NULL);
+
+ /* also 'touch' the app */
+ const char *app_id = xs_dict_get(token, "client_id");
+
+ if (app_id) {
+ xs *afn = xs_fmt("%s/app/%s.json", srv_basedir, app_id);
+ utimes(afn, NULL);
+ }
}
return token;