http: surface LAST to /last

This commit is contained in:
Jan-Piet Mens
2015-09-08 19:23:04 +02:00
parent 95b83a4ae3
commit b8031a9211

8
http.c
View File

@@ -182,6 +182,14 @@ static int dispatch(struct mg_connection *conn, const char *uri)
fprintf(stderr, "%d = %s\n", ret, uparts[ret]);
}
if (nparts == 1 && !strcmp(uparts[0], "last")) {
JsonNode *user_array;
if ((user_array = last_users()) != NULL) {
return (json_response(conn, user_array));
}
}
u = field(conn, "user");
d = field(conn, "device");
time_from = field(conn, "from");