Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web server to portdunio linux version so the web gui can be served. Configuration doesn't need the CLI Interface anymore for the Linux Version #3265

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c0bd58d
Added WebServer/WebServices for Native Linux Meshtastic and web gui
marelab Feb 22, 2024
b9972b8
Fix bug in login functionality
marelab Feb 22, 2024
8e9af81
Added customized config of portdunio.ini with LovyannGFX from marelab…
marelab Feb 22, 2024
f6a978f
Compile Problem resolved with developer version of LovyanGFX.git
marelab Feb 22, 2024
7da107f
Compile against dev version
marelab Feb 22, 2024
f910e79
Fixes to fit into main branch
marelab Feb 22, 2024
39984e4
Merge branch 'meshtastic:master' into master
marelab Feb 22, 2024
354c1cf
Merge branch 'master' into master
thebentern Feb 23, 2024
a094d97
Update variant.h, main.cpp, .gitignore, WebServer.cpp, esp32s2.ini, W…
marelab Feb 23, 2024
93cd5ec
Added linux pi std /usr/include dir
marelab Feb 23, 2024
19d33b2
Adding /usr/innclude for Linux compile against native libs that are n…
marelab Feb 23, 2024
dbbd35e
Review log level changes & translation
marelab Feb 23, 2024
c52741f
Update Dockerfile
marelab Feb 24, 2024
18cf6cb
Merge branch 'master' into master
thebentern Feb 24, 2024
e637b46
Merge branch 'master' into master
caveman99 Feb 25, 2024
7cbde1a
Merge branch 'master' into master
jp-bennett Feb 25, 2024
0c5f68c
Merge branch 'master' into master
thebentern Feb 25, 2024
27c8241
Fix Typo & VFS ref. Part1
marelab Feb 26, 2024
5b626a7
Fix Typo & VFS ref.
marelab Feb 26, 2024
6361b6d
Merge pull request #2 from marelab:FixTypo-&-VFS-reference
marelab Feb 26, 2024
04312cd
Dev Version for ulfius web lib
marelab Feb 25, 2024
5028013
Update platformio.ini
marelab Feb 26, 2024
3256442
Free VFS path string
marelab Feb 26, 2024
16d3348
Merge branch 'master' into master
thebentern Feb 26, 2024
23d09f8
Merge branch 'master' into master
thebentern Feb 27, 2024
3efcf2f
Merge branch 'master' into master
thebentern Feb 28, 2024
fab61f2
Merge branch 'master' into master
thebentern Feb 29, 2024
839f280
Merge branch 'master' into master
thebentern Mar 3, 2024
3b90e10
Merge branch 'master' into master
thebentern Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .editorconfig
Empty file.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ __pycache__
venv/
release/
.vscode/extensions.json
/compile_commands.json
/compile_commands.json
7 changes: 4 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.cpptools",
"platformio.platformio-ide",
"trunk.io"
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
caveman99 marked this conversation as resolved.
Show resolved Hide resolved
72 changes: 71 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "trunk.io",
"trunk.enableWindows": true
"trunk.enableWindows": true,
"files.associations": {
"string": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats probably ok, but i'd prefer this in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get corrected to orignal first

}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install build deps
USER root
RUN apt-get update && \
apt-get -y install wget python3 g++ zip python3-venv git vim ca-certificates libgpiod-dev libyaml-cpp-dev libbluetooth-dev
apt-get -y install wget python3 g++ zip python3-venv git vim ca-certificates libgpiod-dev libyaml-cpp-dev libbluetooth-dev libgpiod2 openssl libssl-dev libulfius-dev liborcania-dev bash

# create a non-priveleged user & group
RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh
Expand All @@ -38,4 +38,4 @@ USER mesh
WORKDIR /home/mesh
CMD sh -cx "./meshtasticd_linux_x86_64 --hwid '${HWID:-$RANDOM}'"

HEALTHCHECK NONE
HEALTHCHECK NONE
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
5 changes: 4 additions & 1 deletion 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 All @@ -23,12 +24,14 @@ lib_deps =
${env.lib_deps}
${networking_base.lib_deps}
rweather/Crypto@^0.4.0
lovyan03/LovyanGFX@^1.1.12
https://github.com/lovyan03/LovyanGFX.git#develop
;lovyan03/LovyanGFX@^1.1.12

build_flags =
${arduino_base.build_flags}
-fPIC
-Isrc/platform/portduino
-I/usr/include
-DRADIOLIB_EEPROM_UNSUPPORTED
-DPORTDUINO_LINUX_HARDWARE
-lbluetooth
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: 9001 # Port for Webserver & Webservices
RootPath: /home/user/web # Root Dir of WebServer
2 changes: 2 additions & 0 deletions bin/prepare-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo apt -y install openssl libssl-dev libsdl2-dev libulfius-dev liborcania-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be included in the CI builder scripts on github, or the builds will fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry didn't looked into the build pipline of Github. Then I first have to prepare a change for the build pipeline I guess. I think for native linux build the .github/actions/setup-base/action.yml would be the best place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's something we can do afterwards. i commented more like a todo item :-)

the runners are always picked up from master, you can't fix that here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these packages to the Pi builder now.

2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ lib_deps =
adafruit/Adafruit PM25 AQI Sensor@^1.0.6
adafruit/Adafruit MPU6050@^2.2.4
adafruit/Adafruit LIS3DH@^1.2.4
https://github.com/lewisxhe/BMA423_Library@^0.0.1
https://github.com/lewisxhe/BMA423_Library@^0.0.1
2 changes: 2 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,7 @@ void setup()
#endif

#ifdef ARCH_PORTDUINO
piwebServerThread = new PiWebServerThread();
initApiServer(TCPPort);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/mesh/http/ContentHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,4 +854,4 @@ void handleScanNetworks(HTTPRequest *req, HTTPResponse *res)
JSONValue *value = new JSONValue(jsonObjOuter);
res->print(value->Stringify().c_str());
delete value;
}
}
2 changes: 1 addition & 1 deletion src/mesh/http/ContentHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ void replaceAll(std::string &str, const std::string &from, const std::string &to
str.replace(start_pos, from.length(), to);
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
}
}
}
2 changes: 1 addition & 1 deletion src/mesh/http/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class WebServerThread : private concurrency::OSThread
virtual int32_t runOnce() override;
};

extern WebServerThread *webServerThread;
extern WebServerThread *webServerThread;
Loading
Loading