mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 09:58:40 -07:00
http publishes are marked with _http:true in JSON
This commit is contained in:
parent
be3af09040
commit
9ca53b264f
@ -168,6 +168,11 @@
|
||||
title: config.column_titles.user,
|
||||
visible: true,
|
||||
data: null,
|
||||
createdCell: function(td, cellData, rowData, row, col) {
|
||||
if (rowData._http) {
|
||||
$(td).css('color', 'gray');
|
||||
}
|
||||
},
|
||||
render: function(data, type, row) {
|
||||
var t = "{{username}}/{{device}}";
|
||||
return Mustache.render(t, data);
|
||||
|
2
http.c
2
http.c
@ -589,7 +589,7 @@ static int dopublish(struct mg_connection *conn, const char *uri)
|
||||
|
||||
debug(ud, "HTTPPUB clen=%zu, topic=%s", conn->content_len, UB(topic));
|
||||
|
||||
handle_message(ud, UB(topic), payload, conn->content_len, 0);
|
||||
handle_message(ud, UB(topic), payload, conn->content_len, 0, TRUE);
|
||||
|
||||
|
||||
jarray = populate_friends(conn, u, d);
|
||||
|
10
recorder.c
10
recorder.c
@ -523,7 +523,7 @@ unsigned char *decrypt(struct udata *ud, char *topic, char *p64, char *username,
|
||||
}
|
||||
#endif /* ENCRYPT */
|
||||
|
||||
void handle_message(void *userdata, char *topic, char *payload, size_t payloadlen, int retain)
|
||||
void handle_message(void *userdata, char *topic, char *payload, size_t payloadlen, int retain, int httpmode)
|
||||
{
|
||||
JsonNode *json, *j, *geo = NULL;
|
||||
char *tid = NULL, *t = NULL, *p;
|
||||
@ -729,7 +729,7 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
|
||||
|
||||
cleartext = (char *)decrypt(ud, topic, j->string_, UB(username), UB(device));
|
||||
if (cleartext != NULL) {
|
||||
handle_message(ud, topic, cleartext, strlen(cleartext), retain);
|
||||
handle_message(ud, topic, cleartext, strlen(cleartext), retain, httpmode);
|
||||
free(cleartext);
|
||||
}
|
||||
if (_typestr) free(_typestr);
|
||||
@ -875,6 +875,10 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
|
||||
utstring_printf(addr, "n.a.");
|
||||
}
|
||||
|
||||
if (httpmode) {
|
||||
json_append_member(json, "_http", json_mkbool(1));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We have normalized data in the JSON, so we can now write it
|
||||
@ -1018,7 +1022,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
{
|
||||
struct udata *ud = (struct udata *)userdata;
|
||||
|
||||
handle_message(ud, m->topic, m->payload, m->payloadlen, m->retain);
|
||||
handle_message(ud, m->topic, m->payload, m->payloadlen, m->retain, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef _RECORDER_H_INCL_
|
||||
# define _RECORDER_H_INCL_
|
||||
|
||||
void handle_message(void *userdata, char *topic, char *payload, size_t payloadlen, int retain);
|
||||
void handle_message(void *userdata, char *topic, char *payload, size_t payloadlen, int retain, int httpmode);
|
||||
|
||||
#endif /* _RECORDER_H_INCL_ */
|
||||
|
Loading…
Reference in New Issue
Block a user