mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-24 09:14:02 +08:00
Various fixes
Dashboard include paths Libcommon.so not being installed snacraft packaging update http-api able to use compile time definition
This commit is contained in:
@@ -14,6 +14,6 @@ const SMOOTHED_CHART_UPDATE_INTERVAL_IN_MILLISECONDS =
|
||||
5; // 5 minutes
|
||||
const INTERVAL_5SECS_IN_MILLISECONDS = 1000 * 5;
|
||||
const CHARTJS_ANIMATION_DURATION_MS = 400;
|
||||
const SYSTOPIC_ENDPOINT = "/api/systree";
|
||||
const LISTENERS_ENDPOINT = "/api/listeners";
|
||||
const SYSTOPIC_ENDPOINT = "/api/v1/systree";
|
||||
const LISTENERS_ENDPOINT = "/api/v1/listeners";
|
||||
const CHART_DISPLAY_WINDOW = 16;
|
||||
|
||||
@@ -696,9 +696,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="lib/hammer.min.js"></script>
|
||||
<script src="lib/chart.umd.js"></script>
|
||||
<script src="lib/chartjs-plugin-zoom.min.js"></script>
|
||||
<script src="hammer.min.js"></script>
|
||||
<script src="chart.umd.js"></script>
|
||||
<script src="chartjs-plugin-zoom.min.js"></script>
|
||||
<script src="consts.js"></script>
|
||||
<script src="queue.js"></script>
|
||||
<script src="assert.js"></script>
|
||||
|
||||
@@ -44,6 +44,9 @@ OBJS= \
|
||||
all : libmosquitto_common.a libmosquitto_common.so.${SOVERSION}
|
||||
|
||||
install :
|
||||
$(INSTALL) -d "${DESTDIR}${libdir}/"
|
||||
$(INSTALL) ${STRIP_OPTS} libmosquitto_common.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquitto_common.so.${SOVERSION}"
|
||||
ln -sf libmosquitto_common.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquitto_common.so"
|
||||
|
||||
uninstall :
|
||||
|
||||
|
||||
+33
-49
@@ -10,7 +10,7 @@ description: This is a message broker that supports version 5.0, 3.1.1, and 3.1
|
||||
example.
|
||||
confinement: strict
|
||||
grade: stable
|
||||
base: core20
|
||||
base: core24
|
||||
|
||||
apps:
|
||||
mosquitto:
|
||||
@@ -31,6 +31,10 @@ apps:
|
||||
command: usr/bin/mosquitto_rr
|
||||
plugs: [home, network]
|
||||
|
||||
signal:
|
||||
command: usr/bin/mosquitto_signal
|
||||
plugs: [home, network]
|
||||
|
||||
sub:
|
||||
command: usr/bin/mosquitto_sub
|
||||
plugs: [home, network]
|
||||
@@ -53,78 +57,58 @@ parts:
|
||||
prime:
|
||||
- mosquitto.conf
|
||||
|
||||
dashboard:
|
||||
plugin: dump
|
||||
source: dashboard/src
|
||||
organize:
|
||||
'*': dashboard/
|
||||
|
||||
mosquitto:
|
||||
after:
|
||||
- lws
|
||||
plugin: make
|
||||
make-parameters:
|
||||
- prefix=/usr
|
||||
- WITH_WEBSOCKETS=lws
|
||||
- WITH_ADNS=yes
|
||||
- CFLAGS="-Wall -ggdb -O2 -I$SNAPCRAFT_STAGE/usr/include -D_GNU_SOURCE"
|
||||
source: https://github.com/eclipse/mosquitto
|
||||
- CFLAGS="-Wall -ggdb -O3 -I$SNAPCRAFT_STAGE/usr/include"
|
||||
source: https://github.com/eclipse-mosquitto/mosquitto
|
||||
source-type: git
|
||||
source-branch: develop
|
||||
|
||||
build-packages:
|
||||
- docbook-xsl
|
||||
- g++
|
||||
- gcc
|
||||
- libcjson-dev
|
||||
- libedit-dev
|
||||
- libmicrohttpd-dev
|
||||
- libsqlite3-dev
|
||||
- libssl-dev
|
||||
- xsltproc
|
||||
- docbook-xsl
|
||||
- gcc
|
||||
- g++
|
||||
stage-packages:
|
||||
- libssl1.1
|
||||
- ca-certificates
|
||||
- libcjson1
|
||||
- libmicrohttpd12t64
|
||||
- libssl3t64
|
||||
prime:
|
||||
- usr/sbin/mosquitto
|
||||
- usr/bin/mosquitto_ctrl
|
||||
- usr/bin/mosquitto_pub
|
||||
- usr/bin/mosquitto_rr
|
||||
- usr/bin/mosquitto_signal
|
||||
- usr/bin/mosquitto_sub
|
||||
- usr/bin/mosquitto_passwd
|
||||
- usr/lib/libmosquitto.so*
|
||||
- usr/lib/libmosquitto_common.so*
|
||||
- usr/lib/mosquitto_acl_file.so*
|
||||
- usr/lib/mosquitto_dynamic_security.so*
|
||||
- lib/*-linux-gnu/libcrypto.so*
|
||||
- lib/*-linux-gnu/libssl.so*
|
||||
- usr/lib/mosquitto_password_file.so*
|
||||
- usr/lib/mosquitto_persist_sqlite.so*
|
||||
- usr/lib/mosquitto_sparkplug_aware.so*
|
||||
- usr/lib/*-linux-gnu/libcjson.so*
|
||||
- usr/lib/*-linux-gnu/libcrypto.so*
|
||||
- usr/lib/*-linux-gnu/libmicrohttpd.so*
|
||||
- usr/lib/*-linux-gnu/libssl.so*
|
||||
- usr/include/mosquitto.h
|
||||
- usr/include/mosquitto_broker.h
|
||||
- usr/include/mosquitto_plugin.h
|
||||
- usr/include/mqtt_protocol.h
|
||||
- usr/include/mosquitto/*.h
|
||||
|
||||
lws:
|
||||
after:
|
||||
- cjson
|
||||
plugin: cmake
|
||||
cmake-parameters:
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
- -DLWS_IPV6=ON
|
||||
- -DLWS_WITHOUT_CLIENT=ON
|
||||
- -DLWS_WITHOUT_EXTENSIONS=ON
|
||||
- -DLWS_WITH_ZIP_FOPS=OFF
|
||||
- -DLWS_WITH_ZLIB=OFF
|
||||
- -DLWS_WITH_SHARED=OFF
|
||||
source: https://github.com/warmcat/libwebsockets/archive/v2.4.2.tar.gz
|
||||
source-type: tar
|
||||
stage:
|
||||
- usr/include/libwebsockets.h
|
||||
- usr/include/lws_config.h
|
||||
- usr/lib/libwebsockets.a
|
||||
prime: [-*]
|
||||
|
||||
cjson:
|
||||
plugin: cmake
|
||||
cmake-parameters:
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
- -DCMAKE_C_FLAGS=-fPIC
|
||||
- -DBUILD_SHARED_AND_STATIC_LIBS=OFF
|
||||
- -DBUILD_SHARED_LIBS=OFF
|
||||
- -DCJSON_BUILD_SHARED_LIBS=OFF
|
||||
- -DCJSON_OVERRIDE_BUILD_SHARED_LIBS=OFF
|
||||
- -DENABLE_CJSON_TEST=OFF
|
||||
source: https://github.com/DaveGamble/cJSON/archive/v1.7.14.tar.gz
|
||||
source-type: tar
|
||||
stage:
|
||||
- usr/include/cjson/cJSON.h
|
||||
- usr/lib/libcjson.a
|
||||
prime: [-*]
|
||||
|
||||
+35
-4
@@ -31,6 +31,10 @@ Contributors:
|
||||
|
||||
#ifdef WITH_HTTP_API
|
||||
|
||||
#ifndef HTTP_API_DIR
|
||||
# define HTTP_API_DIR ""
|
||||
#endif
|
||||
|
||||
struct metric{
|
||||
int64_t current;
|
||||
int64_t next;
|
||||
@@ -337,10 +341,35 @@ static enum MHD_Result http_api_handler(void *cls, struct MHD_Connection
|
||||
}
|
||||
|
||||
|
||||
int http_api__start_local(struct mosquitto__listener *listener)
|
||||
{
|
||||
listener->host = mosquitto_strdup("127.0.0.1");
|
||||
if(!listener->host){
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
listener->port = 9883;
|
||||
|
||||
if(listener->http_dir == NULL && strlen(HTTP_API_DIR) > 1){
|
||||
#ifdef WIN32
|
||||
char *http_dir_canonical = _fullpath(NULL, HTTP_API_DIR, 0);
|
||||
#else
|
||||
char *http_dir_canonical = realpath(HTTP_API_DIR, NULL);
|
||||
#endif
|
||||
if(!http_dir_canonical){
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
mosquitto_FREE(listener->http_dir);
|
||||
listener->http_dir = mosquitto_strdup(http_dir_canonical);
|
||||
mosquitto_FREE(http_dir_canonical);
|
||||
}
|
||||
|
||||
return http_api__start(listener);
|
||||
}
|
||||
|
||||
int http_api__start(struct mosquitto__listener *listener)
|
||||
{
|
||||
unsigned int flags = MHD_USE_AUTO_INTERNAL_THREAD;
|
||||
const char *bind_address = "127.0.0.1";
|
||||
const char *bind_address;
|
||||
uint16_t port = 9883;
|
||||
char *x509_cert = NULL;
|
||||
char *x509_key = NULL;
|
||||
@@ -352,11 +381,10 @@ int http_api__start(struct mosquitto__listener *listener)
|
||||
}
|
||||
}
|
||||
listener->security_options->allow_anonymous = true;
|
||||
listener->protocol = mp_http_api;
|
||||
|
||||
bind_address = listener->host;
|
||||
if(listener->port){
|
||||
port = listener->port;
|
||||
}
|
||||
port = listener->port;
|
||||
|
||||
if(listener->certfile && listener->keyfile){
|
||||
if(mosquitto_read_file(listener->certfile, &x509_cert)){
|
||||
@@ -426,6 +454,9 @@ int http_api__start(struct mosquitto__listener *listener)
|
||||
|
||||
if(listener->mhd){
|
||||
log__printf(NULL, MOSQ_LOG_INFO, "Opening http api listen socket on port %d.", port);
|
||||
if(listener->http_dir){
|
||||
log__printf(NULL, MOSQ_LOG_INFO, "Using http_dir %s", listener->http_dir);
|
||||
}
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
return MOSQ_ERR_UNKNOWN;
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ static int listeners__start_local_only(void)
|
||||
if(db.config->listener_count > 0){
|
||||
#ifdef WITH_HTTP_API
|
||||
db.config->listener_count++;
|
||||
http_api__start(&db.config->listeners[db.config->listener_count-1]);
|
||||
http_api__start_local(&db.config->listeners[db.config->listener_count-1]);
|
||||
#endif
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
|
||||
@@ -987,6 +987,7 @@ void will_delay__remove(struct mosquitto *mosq);
|
||||
/* ============================================================
|
||||
* HTTP Info
|
||||
* ============================================================ */
|
||||
int http_api__start_local(struct mosquitto__listener *listener);
|
||||
int http_api__start(struct mosquitto__listener *listener);
|
||||
void http_api__stop(struct mosquitto__listener *listener);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user