commit 7a20b14
default
·
2024-07-24 16:31:49 +0000 UTC
parent de628c5
mastoapi: opening a token file updates its file date and its app's.
1 files changed,
+13,
-0
+13,
-0
1@@ -18,6 +18,8 @@
2
3 #include "snac.h"
4
5+#include <sys/time.h>
6+
7 static xs_str *random_str(void)
8 /* just what is says in the tin */
9 {
10@@ -129,6 +131,17 @@ xs_dict *token_get(const char *id)
11 if ((f = fopen(fn, "r")) != NULL) {
12 token = xs_json_load(f);
13 fclose(f);
14+
15+ /* 'touch' the file */
16+ utimes(fn, NULL);
17+
18+ /* also 'touch' the app */
19+ const char *app_id = xs_dict_get(token, "client_id");
20+
21+ if (app_id) {
22+ xs *afn = xs_fmt("%s/app/%s.json", srv_basedir, app_id);
23+ utimes(afn, NULL);
24+ }
25 }
26
27 return token;