Skip to content

Commit

Permalink
Native Webserver (#3343)
Browse files Browse the repository at this point in the history
* Added WebServer/WebServices for Native Linux Meshtastic and web gui

* Fix bug in login functionality

* Added customized config of portdunio.ini with LovyannGFX from marelab repro

* Compile Problem resolved with developer version of LovyanGFX.git

* Compile against dev version

* Fixes to fit into main branch

* Update variant.h, main.cpp, .gitignore, WebServer.cpp, esp32s2.ini, WebServer.h, ContentHandler.cpp, rp2040.ini, nrf52.ini, ContentHelper.cpp, Dockerfile, ContentHandler.h, esp32.ini, stm32wl5e.ini

* Added linux pi std /usr/include dir

* Adding /usr/innclude for Linux compile against native libs that are not hadled by platformio

* Review log level changes & translation

* Update Dockerfile

* Fix Typo & VFS ref. Part1

* Fix Typo & VFS ref.

* Dev Version for ulfius web lib

* Update platformio.ini

* Free VFS path string

* Remove unintended changes

* More unintentional changes

* Make the HTTP server optional on native

* Tune-up for Native web defaults

* Don't modify build system yet

* Remove more unneeded changes

---------

Co-authored-by: marc hammermann <[email protected]>
Co-authored-by: Ben Meadors <[email protected]>
Co-authored-by: Thomas Göttgens <[email protected]>
  • Loading branch information
4 people authored Mar 6, 2024
1 parent 9d37a8d commit e174328
Show file tree
Hide file tree
Showing 14 changed files with 625 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ venv/
release/
.vscode/extensions.json
/compile_commands.json
src/mesh/raspihttp/certificate.pem
src/mesh/raspihttp/private_key.pem
2 changes: 1 addition & 1 deletion arch/esp32/esp32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extends = arduino_base
platform = platformio/[email protected] # This is a temporary fix to the S3-based devices bluetooth issues until we can determine what within ESP-IDF changed and can develop a suitable patch.

build_src_filter =
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<mesh/raspihttp>

upload_speed = 921600
debug_init_break = tbreak setup
Expand Down
5 changes: 2 additions & 3 deletions arch/esp32/esp32s2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extends = esp32_base

build_src_filter =
${esp32_base.build_src_filter} -<nimble/>
${esp32_base.build_src_filter} -<nimble/> -<mesh/raspihttp>

monitor_speed = 115200

Expand All @@ -12,5 +12,4 @@ build_flags =

lib_ignore =
${esp32_base.lib_ignore}
NimBLE-Arduino

NimBLE-Arduino
2 changes: 1 addition & 1 deletion arch/nrf52/nrf52.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build_flags =
-Isrc/platform/nrf52

build_src_filter =
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<platform/rp2040> -<mesh/eth/>
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<platform/rp2040> -<mesh/eth/> -<mesh/raspihttp>

lib_deps=
${arduino_base.lib_deps}
Expand Down
1 change: 1 addition & 0 deletions arch/portduino/portduino.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ build_src_filter =
-<platform/rp2040>
-<mesh/wifi/>
-<mesh/http/>
+<mesh/raspihttp/>
-<mesh/eth/>
-<modules/esp32>
-<modules/Telemetry/EnvironmentTelemetry.cpp>
Expand Down
2 changes: 1 addition & 1 deletion arch/rp2040/rp2040.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_flags =
-D__PLAT_RP2040__
# -D _POSIX_THREADS
build_src_filter =
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/>
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/> -<mesh/raspihttp>

lib_ignore =
BluetoothOTA
Expand Down
2 changes: 1 addition & 1 deletion arch/stm32/stm32wl5e.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build_flags =
-DVECT_TAB_OFFSET=0x08000000

build_src_filter =
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/Telemetry> -<platform/nrf52> -<platform/portduino> -<platform/rp2040>
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/Telemetry> -<platform/nrf52> -<platform/portduino> -<platform/rp2040> -<mesh/raspihttp>

board_upload.offset_address = 0x08000000
upload_protocol = stlink
Expand Down
4 changes: 4 additions & 0 deletions bin/config-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ Input:

Logging:
LogLevel: info # debug, info, warn, error

Webserver:
# Port: 443 # Port for Webserver & Webservices
# RootPath: /usr/share/doc/meshtasticd/web # Root Dir of WebServer
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ NRF52Bluetooth *nrf52Bluetooth;

#ifdef ARCH_PORTDUINO
#include "linux/LinuxHardwareI2C.h"
#include "mesh/raspihttp/PiWebServer.h"
#include "platform/portduino/PortduinoGlue.h"
#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -857,6 +858,11 @@ void setup()
#endif

#ifdef ARCH_PORTDUINO
#if __has_include(<ulfius.h>)
if (settingsMap[webserverport] != -1) {
piwebServerThread = new PiWebServerThread();
}
#endif
initApiServer(TCPPort);
#endif

Expand Down
Loading

0 comments on commit e174328

Please sign in to comment.