mirror of
https://github.com/cesanta/mongoose.git
synced 2026-09-30 13:32:29 +07:00
Shipping dashboard in the pack
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2026 Cesanta Software Limited
|
||||
// SPDX-License-Identifier: GPL-2.0-only or commercial
|
||||
//
|
||||
// See guides:
|
||||
// https://mongoose.ws/docs/guides/web-dashboard-guide/ - device dashboard
|
||||
|
||||
#include "mongoose.h"
|
||||
|
||||
#if MG_ARCH == MG_ARCH_UNIX || MG_ARCH == MG_ARCH_WIN32
|
||||
#define HTTP_ADDR "http://0.0.0.0:8000"
|
||||
#else
|
||||
#define HTTP_ADDR "http://0.0.0.0:80"
|
||||
#endif
|
||||
|
||||
static struct mg_mgr s_mgr;
|
||||
|
||||
// Connection event handler function
|
||||
static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
if (ev == MG_EV_HTTP_MSG) { // New HTTP request received
|
||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||
if (mg_match(hm->uri, mg_str("/api/hello"), NULL)) {
|
||||
mg_http_reply(c, 200, "", "{%m:%d}\n", MG_ESC("status"), 1);
|
||||
} else {
|
||||
mg_http_reply(c, 200, "", "Hello from Mongoose %s\n", MG_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
void mongoose_init(void) {
|
||||
mg_mgr_init(&s_mgr);
|
||||
mg_http_listen(&s_mgr, HTTP_ADDR, http_ev_handler, NULL);
|
||||
}
|
||||
|
||||
void mongoose_poll(void) {
|
||||
mg_mgr_poll(&s_mgr, 1);
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<license>License.txt</license>
|
||||
<supportContact>https://mongoose.ws/contact/</supportContact>
|
||||
<releases>
|
||||
<release date="2026-04-22" version="7.21.1">See https://github.com/cesanta/mongoose/releases/tag/7.21</release>
|
||||
<release date="2026-04-22" version="7.21.2">See https://github.com/cesanta/mongoose/releases/tag/7.21</release>
|
||||
<release date="2026-04-08" version="7.21.0">See https://github.com/cesanta/mongoose/releases/tag/7.21</release>
|
||||
<release date="2024-03-01" version="7.13.0">See https://github.com/cesanta/mongoose/releases/tag/7.13</release>
|
||||
</releases>
|
||||
@@ -21,13 +21,14 @@
|
||||
</description>
|
||||
</taxonomy>
|
||||
<components>
|
||||
<component Cclass="Network" Cgroup="Mongoose" Cversion="7.21.1" maxInstances="1">
|
||||
<component Cclass="Network" Cgroup="Mongoose" Cversion="7.21.2" maxInstances="1">
|
||||
<description>Mongoose - TCP/IP stack + TLS + HTTP + WebSocket + MQTT + Firmware OTA</description>
|
||||
<files>
|
||||
<file category="header" name="Mongoose/mongoose.h" />
|
||||
<file category="sourceC" name="Mongoose/mongoose.c" />
|
||||
<file category="sourceC" name="App/mongoose_app.c" attr="config" version="7.21.1" />
|
||||
<file category="header" name="App/mongoose_config.h" attr="config" version="7.21.1" />
|
||||
<file category="sourceC" name="App/mongoose_app.c" attr="config" version="7.21.2" />
|
||||
<file category="sourceC" name="App/dashboard.html.c" attr="config" version="7.21.2" />
|
||||
<file category="header" name="App/mongoose_config.h" attr="config" version="7.21.2" />
|
||||
</files>
|
||||
</component>
|
||||
</components>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
VERSION = 7.21.1
|
||||
PACKPATH = Mongoose
|
||||
FILES = $(PACKPATH) App Cesanta.I-CUBE-Mongoose.pdsc License.txt Release_Notes.html
|
||||
VERSION = 7.21.2
|
||||
REPO_ROOT = ../..
|
||||
FILES = Mongoose App Cesanta.I-CUBE-Mongoose.pdsc License.txt Release_Notes.html
|
||||
|
||||
all: Cesanta.I-CUBE-Mongoose.$(VERSION).pack
|
||||
|
||||
Cesanta.I-CUBE-Mongoose.$(VERSION).pack: $(FILES) $(PACKPATH)/mongoose.h $(PACKPATH)/mongoose.c
|
||||
Cesanta.I-CUBE-Mongoose.$(VERSION).pack: $(FILES) Mongoose/mongoose.h Mongoose/mongoose.c App/mongoose_app.c App/dashboard.html.c
|
||||
zip -r $@ $^
|
||||
|
||||
# Get packchk from https://github.com/Open-CMSIS-Pack/cmsis-toolbox
|
||||
@@ -13,13 +13,18 @@ check: Cesanta.I-CUBE-Mongoose.$(VERSION).pack
|
||||
packchk Cesanta.I-CUBE-Mongoose.pdsc
|
||||
|
||||
License.txt:
|
||||
cp ../../LICENSE $@
|
||||
$(PACKPATH):
|
||||
mkdir -p $(PACKPATH)
|
||||
$(PACKPATH)/mongoose.h: $(PACKPATH)
|
||||
cp ../../mongoose.h $@
|
||||
$(PACKPATH)/mongoose.c: $(PACKPATH)
|
||||
cp ../../mongoose.c $@
|
||||
cp $(REPO_ROOT)/LICENSE $@
|
||||
Mongoose:
|
||||
mkdir -p Mongoose
|
||||
App/mongoose_app.c:
|
||||
cp $(REPO_ROOT)/tutorials/device-dashboard/mongoose_app.c $@
|
||||
App/dashboard.html.c:
|
||||
make -C $(REPO_ROOT)/tutorials/device-dashboard dashboard.html.c
|
||||
cp $(REPO_ROOT)/tutorials/device-dashboard/dashboard.html.c $@
|
||||
Mongoose/mongoose.h: Mongoose
|
||||
cp $(REPO_ROOT)/mongoose.h $@
|
||||
Mongoose/mongoose.c: Mongoose
|
||||
cp $(REPO_ROOT)/mongoose.c $@
|
||||
|
||||
clean:
|
||||
rm -rf *.pack License.txt $(PACKPATH)
|
||||
rm -rf *.pack License.txt Mongoose App/*.{html,js,c}
|
||||
|
||||
Reference in New Issue
Block a user