mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
mastoapi: opening a token file updates its file date and its app's.
This commit is contained in:
parent
de628c5f33
commit
7a20b14fbc
1 changed files with 13 additions and 0 deletions
13
mastoapi.c
13
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;
|
||||
|
|
Loading…
Reference in a new issue