mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
FIX: recorder, storage, and HTTP honour --norevgeo
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
#include "storage.h"
|
||||
#include "udata.h"
|
||||
#ifdef HAVE_HTTP
|
||||
# include "http.h"
|
||||
#endif
|
||||
@@ -86,10 +87,10 @@ void push_geojson(struct mg_connection *conn)
|
||||
|
||||
JsonNode *obj, *locs, *arr, *f, *geojson, *json, *fields = NULL;
|
||||
time_t s_lo, s_hi;
|
||||
char *time_from = "2015-08-28", *time_to = NULL;
|
||||
char *time_from = "2015-08-24", *time_to = NULL;
|
||||
char *js;
|
||||
|
||||
char *username = "jpm", *device = "5s";
|
||||
char *username = "jpm", *device = "test";
|
||||
|
||||
if (make_times(time_from, &s_lo, time_to, &s_hi) != 1) {
|
||||
return;
|
||||
@@ -205,8 +206,6 @@ int ev_handler(struct mg_connection *conn, enum mg_event ev)
|
||||
return (MG_FALSE); /* Fail it */
|
||||
}
|
||||
|
||||
storage_init();
|
||||
|
||||
/* GET */
|
||||
if (!strcmp(conn->uri, "/api/me")) {
|
||||
push_geojson(conn);
|
||||
|
||||
@@ -841,6 +841,7 @@ int main(int argc, char **argv)
|
||||
syslog(LOG_WARNING, "Can't initialize gcache in %s", db_filename);
|
||||
exit(1);
|
||||
}
|
||||
storage_init(ud->revgeo); /* For the HTTP server */
|
||||
#endif
|
||||
revgeo_init();
|
||||
}
|
||||
@@ -938,6 +939,7 @@ int main(int argc, char **argv)
|
||||
// mg_set_option(udata.server, "cgi_pattern", "**.cgi");
|
||||
|
||||
syslog(LOG_INFO, "HTTP listener started on %s", mg_get_option(udata.server, "listening_port"));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,14 +44,16 @@ char STORAGEDIR[BUFSIZ] = "./store";
|
||||
|
||||
static struct gcache *gc = NULL;
|
||||
|
||||
void storage_init()
|
||||
void storage_init(int revgeo)
|
||||
{
|
||||
char path[BUFSIZ];
|
||||
|
||||
setenv("TZ", "UTC", 1);
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
gc = gcache_open(path, TRUE);
|
||||
if (revgeo) {
|
||||
snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
gc = gcache_open(path, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void get_geo(JsonNode *o, char *ghash)
|
||||
@@ -504,7 +506,6 @@ static int candidate_line(char *line, void *param)
|
||||
if (locs == NULL || locs->tag != JSON_ARRAY)
|
||||
return (-1);
|
||||
|
||||
|
||||
if (limit == 0) {
|
||||
/* Reading forwards; account for time */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user