diff options
| -rw-r--r-- | data.c | 4 | ||||
| -rw-r--r-- | html.c | 2 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | mastoapi.c | 2 | ||||
| -rw-r--r-- | snac.h | 2 |
5 files changed, 7 insertions, 5 deletions
| @@ -1575,14 +1575,14 @@ xs_list *history_list(snac *snac) | |||
| 1575 | } | 1575 | } |
| 1576 | 1576 | ||
| 1577 | 1577 | ||
| 1578 | void lastlog_write(snac *snac) | 1578 | void lastlog_write(snac *snac, const char *source) |
| 1579 | /* writes the last time the user logged in */ | 1579 | /* writes the last time the user logged in */ |
| 1580 | { | 1580 | { |
| 1581 | xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir); | 1581 | xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir); |
| 1582 | FILE *f; | 1582 | FILE *f; |
| 1583 | 1583 | ||
| 1584 | if ((f = fopen(fn, "w")) != NULL) { | 1584 | if ((f = fopen(fn, "w")) != NULL) { |
| 1585 | fprintf(f, "%lf\n", ftime()); | 1585 | fprintf(f, "%lf %s\n", ftime(), source); |
| 1586 | fclose(f); | 1586 | fclose(f); |
| 1587 | } | 1587 | } |
| 1588 | } | 1588 | } |
| @@ -34,7 +34,7 @@ int login(snac *snac, const xs_dict *headers) | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | if (logged_in) | 36 | if (logged_in) |
| 37 | lastlog_write(snac); | 37 | lastlog_write(snac, "web"); |
| 38 | 38 | ||
| 39 | return logged_in; | 39 | return logged_in; |
| 40 | } | 40 | } |
| @@ -145,6 +145,8 @@ int main(int argc, char *argv[]) | |||
| 145 | return 1; | 145 | return 1; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | lastlog_write(&snac, "cmdline"); | ||
| 149 | |||
| 148 | if (strcmp(cmd, "resetpwd") == 0) { | 150 | if (strcmp(cmd, "resetpwd") == 0) { |
| 149 | return resetpwd(&snac); | 151 | return resetpwd(&snac); |
| 150 | } | 152 | } |
| @@ -854,7 +854,7 @@ int process_auth_token(snac *snac, const xs_dict *req) | |||
| 854 | logged_in = 1; | 854 | logged_in = 1; |
| 855 | 855 | ||
| 856 | /* this counts as a 'login' */ | 856 | /* this counts as a 'login' */ |
| 857 | lastlog_write(snac); | 857 | lastlog_write(snac, "mastoapi"); |
| 858 | 858 | ||
| 859 | srv_debug(2, xs_fmt("mastoapi auth: valid token for user %s", uid)); | 859 | srv_debug(2, xs_fmt("mastoapi auth: valid token for user %s", uid)); |
| 860 | } | 860 | } |
| @@ -142,7 +142,7 @@ xs_str *history_get(snac *snac, const char *id); | |||
| 142 | int history_del(snac *snac, const char *id); | 142 | int history_del(snac *snac, const char *id); |
| 143 | xs_list *history_list(snac *snac); | 143 | xs_list *history_list(snac *snac); |
| 144 | 144 | ||
| 145 | void lastlog_write(snac *snac); | 145 | void lastlog_write(snac *snac, const char *source); |
| 146 | 146 | ||
| 147 | xs_str *notify_check_time(snac *snac, int reset); | 147 | xs_str *notify_check_time(snac *snac, int reset); |
| 148 | void notify_add(snac *snac, const char *type, const char *utype, | 148 | void notify_add(snac *snac, const char *type, const char *utype, |